From 974bc55c8721b53b0c2c07baad59b86c08d07104 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 24 Nov 2009 13:43:18 -0800 Subject: Change to container/vector interface: - removed New(len int) in favor of new(Vector).Resize(len, cap) - removed Init(len int) in favor of Resize(len, cap) - runs all.bash Fixes issue 294. R=rsc, r, r1 http://codereview.appspot.com/157143 --- src/pkg/go/scanner/errors.go | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/pkg/go/scanner/errors.go') diff --git a/src/pkg/go/scanner/errors.go b/src/pkg/go/scanner/errors.go index 16ad53260..12c1c852f 100644 --- a/src/pkg/go/scanner/errors.go +++ b/src/pkg/go/scanner/errors.go @@ -24,9 +24,9 @@ type ErrorHandler interface { } -// ErrorVector implements the ErrorHandler interface. It must be -// initialized with Init(). It maintains a list of errors which can -// be retrieved with GetErrorList and GetError. +// ErrorVector implements the ErrorHandler interface. It maintains a list +// of errors which can be retrieved with GetErrorList and GetError. The +// zero value for an ErrorVector is an empty ErrorVector ready to use. // // A common usage pattern is to embed an ErrorVector alongside a // scanner in a data structure that uses the scanner. By passing a @@ -38,16 +38,8 @@ type ErrorVector struct { } -// Init initializes an ErrorVector. -func (h *ErrorVector) Init() { h.errors.Init(0) } - - -// NewErrorVector creates a new ErrorVector. -func NewErrorVector() *ErrorVector { - h := new(ErrorVector); - h.Init(); - return h; -} +// Reset resets an ErrorVector to no errors. +func (h *ErrorVector) Reset() { h.errors.Resize(0, 0) } // ErrorCount returns the number of errors collected. -- cgit v1.2.3