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
I think this is resolved now. I was running into this problem: https://github.com/Masterminds/glide/issues/602
After reading this: https://thenewstack.io/understanding-golang-packages/
I setup my project structure as follows:
/home/dev/go/src/smp-cloudupload
pkg
src
main
somepackage
vendor
And it seems to work