简体   繁体   中英

GO test gives very strange error - cannot find package command-line-a/vendor

I've update to GO 1.6 and now I get very strange error when running go test

pawel@pawel:~/work/src/...../web/workers$ go test email_test.go 
# command-line-arguments
email_test.go:16:2: cannot find package "command-line-a/vendor/github.com/jpoehls/gophermail" in any of:
    /usr/local/go/src/command-line-a/vendor/github.com/jpoehls/gophermail (from $GOROOT)
    /home/pawel/work/src/command-line-a/vendor/github.com/jpoehls/gophermail (from $GOPATH)
    /home/pawel/work/src/...../web/_vendor/src/command-line-a/vendor/github.com/jpoehls/gophermail
FAIL    command-line-arguments [setup failed]

I've also tried to run it with go test email_test.go email.go but result is the same. I grep for "command-line" in my whole project and vendor and haven't find it.

Running go run email.go works correctly. My project dependencies are in directory vendor (which is one level higher), it contains github.com/jpoehls/gophermail

As @volker explained in a comment, my problem was that I wanted to test files instead of packages. When I reorganize my project and test simply by go test it works fine.

Nevertheless it doesn't explain why I get such a strange error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM