diff options
author | Robert Griesemer <gri@golang.org> | 2009-11-06 14:24:38 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2009-11-06 14:24:38 -0800 |
commit | 828334dd95ce8e4bf3662bd5c89d7c417f0741d0 (patch) | |
tree | fd7e0c9961bc3af2ddf105e9cc1943f2509ac584 /src/pkg/testing/script/script.go | |
parent | eb5cdfd67ff6d32df4c4c27840eaee027c5e3512 (diff) | |
download | golang-828334dd95ce8e4bf3662bd5c89d7c417f0741d0.tar.gz |
- fine-tuning of one-line func heuristic (nodes.go)
- enabled for function declarations (not just function literals)
- applied gofmt -w $GOROOT/src
(look for instance at src/pkg/debug/elf/elf.go)
R=r, rsc
CC=go-dev
http://go/go-review/1026006
Diffstat (limited to 'src/pkg/testing/script/script.go')
-rw-r--r-- | src/pkg/testing/script/script.go | 68 |
1 files changed, 17 insertions, 51 deletions
diff --git a/src/pkg/testing/script/script.go b/src/pkg/testing/script/script.go index 65ccb09dd..6bf6ca26f 100644 --- a/src/pkg/testing/script/script.go +++ b/src/pkg/testing/script/script.go @@ -57,17 +57,11 @@ type Recv struct { Expected interface{}; } -func (r Recv) getRecv() recvAction { - return r; -} +func (r Recv) getRecv() recvAction { return r } -func (Recv) getSend() sendAction { - return nil; -} +func (Recv) getSend() sendAction { return nil } -func (r Recv) getChannel() interface{} { - return r.Channel; -} +func (r Recv) getChannel() interface{} { return r.Channel } func (r Recv) recvMatch(chanEvent interface{}) bool { c, ok := chanEvent.(channelRecv); @@ -85,17 +79,11 @@ type RecvMatch struct { Match func(interface{}) bool; } -func (r RecvMatch) getRecv() recvAction { - return r; -} +func (r RecvMatch) getRecv() recvAction { return r } -func (RecvMatch) getSend() sendAction { - return nil; -} +func (RecvMatch) getSend() sendAction { return nil } -func (r RecvMatch) getChannel() interface{} { - return r.Channel; -} +func (r RecvMatch) getChannel() interface{} { return r.Channel } func (r RecvMatch) recvMatch(chanEvent interface{}) bool { c, ok := chanEvent.(channelRecv); @@ -113,17 +101,11 @@ type Closed struct { Channel interface{}; } -func (r Closed) getRecv() recvAction { - return r; -} +func (r Closed) getRecv() recvAction { return r } -func (Closed) getSend() sendAction { - return nil; -} +func (Closed) getSend() sendAction { return nil } -func (r Closed) getChannel() interface{} { - return r.Channel; -} +func (r Closed) getChannel() interface{} { return r.Channel } func (r Closed) recvMatch(chanEvent interface{}) bool { c, ok := chanEvent.(channelClosed); @@ -141,17 +123,11 @@ type Send struct { Value interface{}; } -func (Send) getRecv() recvAction { - return nil; -} +func (Send) getRecv() recvAction { return nil } -func (s Send) getSend() sendAction { - return s; -} +func (s Send) getSend() sendAction { return s } -func (s Send) getChannel() interface{} { - return s.Channel; -} +func (s Send) getChannel() interface{} { return s.Channel } func newEmptyInterface(args ...) reflect.Value { return reflect.NewValue(args).(*reflect.StructValue).Field(0); @@ -176,21 +152,13 @@ type Close struct { Channel interface{}; } -func (Close) getRecv() recvAction { - return nil; -} +func (Close) getRecv() recvAction { return nil } -func (s Close) getSend() sendAction { - return s; -} +func (s Close) getSend() sendAction { return s } -func (s Close) getChannel() interface{} { - return s.Channel; -} +func (s Close) getChannel() interface{} { return s.Channel } -func (s Close) send() { - reflect.NewValue(s.Channel).(*reflect.ChanValue).Close(); -} +func (s Close) send() { reflect.NewValue(s.Channel).(*reflect.ChanValue).Close() } // A ReceivedUnexpected error results if no active Events match a value // received from a channel. @@ -211,9 +179,7 @@ func (r ReceivedUnexpected) String() string { // Events. type SetupError string -func (s SetupError) String() string { - return string(s); -} +func (s SetupError) String() string { return string(s) } func NewEvent(name string, predecessors []*Event, action action) *Event { e := &Event{name, false, predecessors, action}; |