Closed meetme2meat closed 3 years ago
Following is the sample code the output would say a lot here. I tried debugging this myself but unable to find why the behavior is such.
func main() { err := DBErr() if err != nil { fmt.Printf("Main err was not nil %T %v\n", err, err) } else { fmt.Println("Main", "err was nil") } } func DBErr() error { e := errors.Wrap(nil, 1) fmt.Println("DBErr() err is nil", e == nil) return e }
Output:
DBErr() err is nil true Main err was not nil *errors.Error <nil>
running go version
go version go1.16 darwin/amd64
following is my go.mod definition
module test-errors go 1.16 require github.com/go-errors/errors v1.2.0
Following is the sample code the output would say a lot here. I tried debugging this myself but unable to find why the behavior is such.
Output:
running go version
following is my go.mod definition