Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.12.8 darwin/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GOARCH="amd64" GOBIN="" GOCACHE="/Users/jonathon.frisby/Library/Caches/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/jonathon.frisby/go" GOPROXY="" GORACE="" GOROOT="/Users/jonathon.frisby/.gimme/versions/go1.12.9.darwin.amd64" GOTMPDIR="" GOTOOLDIR="/Users/jonathon.frisby/.gimme/versions/go1.12.9.darwin.amd64/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/k5/w0_r1hrd6tqgb0k86pfgpq900000gp/T/go-build524396974=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
This code: https://play.golang.org/p/vYYtv0x4IyJ
Produces this error:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0xffffffff addr=0x0 pc=0xd97fb]
goroutine 1 [running]:
main.(*APIErrorResponseImpl).Error(...)
/tmp/sandbox612567163/prog.go:21
main.main()
/tmp/sandbox612567163/prog.go:31 +0x1b
However, if you uncomment the fmt.Printf
statement: https://play.golang.org/p/A0mCRgbR8OJ
Then, you get this, which seems to be the "correct" stack trace:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0xffffffff addr=0x0 pc=0xd97fa]
goroutine 1 [running]:
main.main()
/tmp/sandbox315389324/prog.go:31 +0x1a
What did you expect to see?
The second error.
What did you see instead?
The first error.