From d9527dd16f72598b54a64550607bf892efa12384 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 15 Dec 2009 15:33:31 -0800 Subject: 1) Change default gofmt default settings for parsing and printing to new syntax. Use -oldparser to parse the old syntax, use -oldprinter to print the old syntax. 2) Change default gofmt formatting settings to use tabs for indentation only and to use spaces for alignment. This will make the code alignment insensitive to an editor's tabwidth. Use -spaces=false to use tabs for alignment. 3) Manually changed src/exp/parser/parser_test.go so that it doesn't try to parse the parser's source files using the old syntax (they have new syntax now). 4) gofmt -w src misc test/bench 1st set of files. R=rsc CC=agl, golang-dev, iant, ken2, r http://codereview.appspot.com/180047 --- src/pkg/container/vector/stringvector.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/pkg/container/vector/stringvector.go') diff --git a/src/pkg/container/vector/stringvector.go b/src/pkg/container/vector/stringvector.go index 93a4197a5..821a7a101 100644 --- a/src/pkg/container/vector/stringvector.go +++ b/src/pkg/container/vector/stringvector.go @@ -6,7 +6,7 @@ package vector // StringVector is a specialization of Vector that hides the wrapping of Elements around strings. type StringVector struct { - Vector; + Vector } @@ -16,34 +16,34 @@ type StringVector struct { // Resize adds "" elements. The capacity parameter is ignored unless the // new length or capacity is longer that the current capacity. func (p *StringVector) Resize(length, capacity int) *StringVector { - i := p.Len(); - p.Vector.Resize(length, capacity); + i := p.Len() + p.Vector.Resize(length, capacity) for a := p.a; i < len(a); i++ { a[i] = "" } - return p; + return p } // At returns the i'th element of the vector. -func (p *StringVector) At(i int) string { return p.Vector.At(i).(string) } +func (p *StringVector) At(i int) string { return p.Vector.At(i).(string) } // Set sets the i'th element of the vector to value x. -func (p *StringVector) Set(i int, x string) { p.a[i] = x } +func (p *StringVector) Set(i int, x string) { p.a[i] = x } // Last returns the element in the vector of highest index. -func (p *StringVector) Last() string { return p.Vector.Last().(string) } +func (p *StringVector) Last() string { return p.Vector.Last().(string) } // Data returns all the elements as a slice. func (p *StringVector) Data() []string { - arr := make([]string, p.Len()); + arr := make([]string, p.Len()) for i, v := range p.a { arr[i] = v.(string) } - return arr; + return arr } @@ -69,11 +69,11 @@ func (p *StringVector) Slice(i, j int) *StringVector { // Push appends x to the end of the vector. -func (p *StringVector) Push(x string) { p.Vector.Push(x) } +func (p *StringVector) Push(x string) { p.Vector.Push(x) } // Pop deletes and returns the last element of the vector. -func (p *StringVector) Pop() string { return p.Vector.Pop().(string) } +func (p *StringVector) Pop() string { return p.Vector.Pop().(string) } // AppendVector appends the entire StringVector x to the end of this vector. @@ -84,7 +84,7 @@ func (p *StringVector) AppendVector(x *StringVector) { // sort.Interface support // Less returns a boolean denoting whether the i'th element is less than the j'th element. -func (p *StringVector) Less(i, j int) bool { return p.At(i) < p.At(j) } +func (p *StringVector) Less(i, j int) bool { return p.At(i) < p.At(j) } // Iterate over all elements; driver for range @@ -92,13 +92,13 @@ func (p *StringVector) iterate(c chan<- string) { for _, v := range p.a { c <- v.(string) } - close(c); + close(c) } // Channel iterator for range. func (p *StringVector) Iter() <-chan string { - c := make(chan string); - go p.iterate(c); - return c; + c := make(chan string) + go p.iterate(c) + return c } -- cgit v1.2.3