定义 nil是标识符 nil 为预声明的标示符,定义在builtin/builtin.go, 1 2 3 4 5 6 7 8 9 // nil is a predeclared identifier representing the zero value for a // pointer, channel, func, interface, map, or slice
Error vs Exception error的定义 Go error 就是普通的一个接口,普通的值。 1 2 3 4 5 // The error built-in interface type is the conventional interface for // representing an error condition, with the nil value representing no error. type error interface { Error() string } 只要实现了Er