Skip to content
New issue

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

stacktrace_ext_test.go stomps on GOPATH, losing track of code needed for the test #515

Closed
nim-nim opened this issue Oct 19, 2017 · 2 comments

Comments

@nim-nim
Copy link

nim-nim commented Oct 19, 2017

$ echo $GOPATH
/home/test/zap/zap-1.7.1/_build:/usr/share/gocode

$ ls /usr/share/gocode/src/github.com/stretchr/testify/assert/
assertion_forward.go  assertions.go  doc.go  errors.go  forward_assertions.go  http_assertions.go

$ cd /home/test/zap/zap-1.7.1/_build/src/go.uber.org/zap

$ go test -compiler gc -ldflags ''
# go.uber.org/zap
error_test.go:29:2: cannot find package "github.com/pkg/errors" in any of:
        /usr/lib/golang/src/github.com/pkg/errors (from $GOROOT)
        /home/test/zap/zap-1.7.1/_build/src/github.com/pkg/errors (from $GOPATH)
        /usr/share/gocode/src/github.com/pkg/errors
FAIL    go.uber.org/zap [setup failed]
[test@localhost zap]$ go test -compiler gc -ldflags ''
invalid value "unknown" for flag -level: unrecognized level: "unknown"
Usage of test:
  -level value
        minimum enabled logging level
--- FAIL: TestStacktraceFiltersVendorZap (0.05s)
        Error Trace:    stacktrace_ext_test.go:112
                        stacktrace_ext_test.go:141
                        stacktrace_ext_test.go:114
        Error:          Received unexpected error exit status 1
        Messages:       Failed to run test in vendor directory, output: # go.uber.org/zap_test
                stacktrace_ext_test.go:36:2: cannot find package "github.com/stretchr/testify/assert" in any of:
                        /tmp/gopath148698364/src/go.uber.org/zap_test/vendor/github.com/stretchr/testify/assert (vendor tree)
                        /usr/lib/golang/src/github.com/stretchr/testify/assert (from $GOROOT)
                        /tmp/gopath148698364/src/github.com/stretchr/testify/assert (from $GOPATH)
                FAIL    go.uber.org/zap_test [setup failed]


FAIL
exit status 1
FAIL    go.uber.org/zap 0.224s
@nim-nim
Copy link
Author

nim-nim commented Oct 19, 2017

stacktrace_ext_test.go:87: // We need to simulate a zap as a vendor library, so we're going to create a fake GOPATH

@prashantv
Copy link
Collaborator

To run zap tests, you need to install the Glide dependencies. This is done by running make dependencies as documented in the CONTRIBUTING doc:
https://github.com/uber-go/zap/blob/master/CONTRIBUTING.md

Tests are passing on Travis without any issue, and I've verified this locally. If I move my vendor directory, I'm able to reproduce the issue above, so running make dependencies should fix your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants