drwj4061
2018-10-01 13:38
浏览 80
已采纳

设置go dep后依赖关系出现问题

My project is located in $GOPATH/src/smp-cloudupload

I can run dep init without errors. After that I cant compile the project anymore. One of the errors:

main/scs/scsApiGateway.go:5:2: cannot find package "_/home/dev/go/src/smp-cloudupload/vendor/github.com/dgrijalva/jwt-go" in any of:
/usr/lib/go-1.10/src/_/home/dev/go/src/smp-cloudupload/vendor/github.com/dgrijalva/jwt-go (from $GOROOT)
/home/dev/go/src/_/home/dev/go/src/smp-cloudupload/vendor/github.com/dgrijalva/jwt-go (from $GOPATH)

I am new to GO and I have a feeling, that there are either issues with my project structure or the GOPATH. The shown path is wrong. The correct path is: /home/dev/go/src/smp-cloudupload/vendor/github.com/dgrijalva/jwt-go

What am I doing wrong?

EDIT:

Output of echo $GOPATH: dev@dev-VirtualBox:~/go/src/smp-cloudupload/main$ echo $GOPATH

/home/dev/go

I have no idea why there is a underscore in the path. The actual path of my project contains no underscores

图片转代码服务由CSDN问答提供 功能建议

我的项目位于 $ GOPATH / src / smp-cloudupload

我可以没有错误地运行 dep init 。 此后,我无法再编译项目了。 错误之一:

  main / scs / scsApiGateway.go:5:2:找不到软件包“ _ / home / dev / go / src / smp-cloudupload / vendor  /github.com/dgrijalva/jwt-go”中的任何一个:
 / usr / lib / go-1.10 / src / _ / home / dev / go / src / smp-cloudupload / vendor / github.com / dgrijalva /  jwt-go(来自$ GOROOT)
 / home / dev / go / src / _ / home / dev / go / src / smp-cloudupload / vendor / github.com / dgrijalva / jwt-go(来自$ GOPATH)\  n   
 
 

我是GO的新手,我有一种感觉,我的项目结构或GOPATH都有问题。 所示路径错误。 正确的路径是: /home/dev/go/src/smp-cloudupload/vendor/github.com/dgrijalva/jwt-go

我是什么

编辑:

echo $ GOPATH 的输出: dev @ dev-VirtualBox:〜/ go / src / smp-cloudupload / main $ echo $ GOPATH

  / home / dev / go 
   \  n 
 

我不知道为什么路径中会有下划线。 我项目的实际路径不包含下划线

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题