dongre6270 2016-04-05 08:26
浏览 194
已采纳

GO测试给出了非常奇怪的错误-无法找到软件包命令行-a /供应商

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

  • 写回答

1条回答 默认 最新

  • dqrfdl5708 2016-04-05 09:07
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集