Problem that I have met today:
$ go build
# github.com/pkg/errors
../../../../pkg/mod/github.com/pkg/errors@v0.8.0/errors.go:121:2: undefined: stack
#How to solve
I don't know the source of the problem, but I have fixed it with upgrading errors package version in my go.mod file:module github.com/project_package
require ( // ... github.com/pkg/errors v0.8.1 // indirect // ... )