Hi guys, I'm stuck on this Dep issue that I can't fix, it's probably something stupid that I'm missing, maybe you can give me some hints on it.
I've got my Go project running in a Docker container. I install and manage my dependencies with Dep. So far so good until I'm trying to split my code in a different package. The sub-packages won't find my vendor dependencies installed with Dep anymore.
When I move all my files back to one folder and rename everything back to "main" package it starts working.
This is the error I get:
root@c348fbca321e:/go# go run src/my-lib/main.go
src/my-lib/mySubLib/db.go:6:2: cannot find package "_/go/src/my-lib/vendor/github.com/go-sql-driver/mysql" in any of:
/usr/local/go/src/_/go/src/my-lib/vendor/github.com/go-sql-driver/mysql (from $GOROOT)
/go/src/_/go/src/my-lib/vendor/github.com/go-sql-driver/mysql (from $GOPATH)
And here is a public GitHub repo with my entire setup and installation steps: https://github.com/doomhz/my-go-project
Any idea how to fix this? Any help would be much appreciated. Thanks in advance.
评论:
edwinTop:
you can put them back in multiple directory, but your docker file should look something like this..
FROM golang:alpine WORKDIR /go/src/github.com/doomhz/my-go-project COPY . . RUN go get -d -v ./... RUN go install -v ./... ENTRYPOINT ["my-go-project"]
