|
|
|
|
|
by enneff
4760 days ago
|
|
No, it's just that's not how it works. For instance, s, err := server.New()
if err != nil {
// handle error
}
s.Foo()
You're not going to check that s != nil before calling s.Foo, even though s is probably a *server.Server and could be nil. But it won't be, if the New function is correct. Yes, the compiler doesn't guarantee that New gives you a non-nil pointer, but it also doesn't guarantee a lot of things about the behavior of the program. |
|