This commit is contained in:
chai2010
2016-01-18 10:52:21 +08:00
parent edd55ba1f3
commit a91355f5f1
4 changed files with 210 additions and 198 deletions

View File

@@ -4,7 +4,7 @@
```go
type error interface {
Error() string
Error() string
}
```
@@ -46,17 +46,17 @@ package syscall
type Errno uintptr // operating system error code
var errors = [...]string{
1: "operation not permitted", // EPERM
2: "no such file or directory", // ENOENT
3: "no such process", // ESRCH
// ...
1: "operation not permitted", // EPERM
2: "no such file or directory", // ENOENT
3: "no such process", // ESRCH
// ...
}
func (e Errno) Error() string {
if 0 <= int(e) && int(e) < len(errors) {
return errors[e]
}
return fmt.Sprintf("errno %d", e)
if 0 <= int(e) && int(e) < len(errors) {
return errors[e]
}
return fmt.Sprintf("errno %d", e)
}
```