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/os/error.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/os/error.go')
| -rw-r--r-- | src/pkg/os/error.go | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/pkg/os/error.go b/src/pkg/os/error.go index 809116cff..6bbf5371e 100644 --- a/src/pkg/os/error.go +++ b/src/pkg/os/error.go @@ -15,26 +15,20 @@ type Error interface { // Error. type ErrorString string -func (e ErrorString) String() string { - return string(e); -} +func (e ErrorString) String() string { return string(e) } // Note: If the name of the function NewError changes, // pkg/go/doc/doc.go should be adjusted since it hardwires // this name in a heuristic. // NewError converts s to an ErrorString, which satisfies the Error interface. -func NewError(s string) Error { - return ErrorString(s); -} +func NewError(s string) Error { return ErrorString(s) } // Errno is the Unix error number. Names such as EINVAL are simple // wrappers to convert the error number into an Error. type Errno int64 -func (e Errno) String() string { - return syscall.Errstr(int(e)); -} +func (e Errno) String() string { return syscall.Errstr(int(e)) } // Commonly known Unix errors. var ( @@ -84,9 +78,7 @@ type PathError struct { Error Error; } -func (e *PathError) String() string { - return e.Op + " " + e.Path + ": " + e.Error.String(); -} +func (e *PathError) String() string { return e.Op + " " + e.Path + ": " + e.Error.String() } // SyscallError records an error from a specific system call. type SyscallError struct { @@ -94,9 +86,7 @@ type SyscallError struct { Errno Errno; } -func (e *SyscallError) String() string { - return e.Syscall + ": " + e.Errno.String(); -} +func (e *SyscallError) String() string { return e.Syscall + ": " + e.Errno.String() } // Note: If the name of the function NewSyscallError changes, // pkg/go/doc/doc.go should be adjusted since it hardwires |
