We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please answer these questions before submitting your issue. Thanks!
go version
go version go1.8 darwin/amd64
package main import ( "fmt" ) type ValidationError struct { Code string Msg string } func (e ValidationError) Error() string { return e.Code + e.Msg } func ReturnErr() *ValidationError { return nil } func ReturnInterfaceErr() error { var err *ValidationError return err } func main() { var err1 error err1 = ReturnErr() var err2 error = ReturnErr() var err3 = ReturnErr() // err1 false fmt.Println("err1", err1 == nil) // err2 false fmt.Println("err2", err2 == nil) // err3 true fmt.Println("err3", err3 == nil) var err4 error err4 = ReturnInterfaceErr() // err4 false fmt.Println("err4", err4 == nil) }
The text was updated successfully, but these errors were encountered:
Is there a proposal here? This scenario is covered in the FAQ: https://golang.org/doc/faq#nil_error
Sorry, something went wrong.
Closing because there is no suggested action.
No branches or pull requests
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.8 darwin/amd64
The text was updated successfully, but these errors were encountered: