<p>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.</p>
<p>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.</p>
<p>When I move all my files back to one folder and rename everything back to "main" package it starts working.</p>
<p>This is the error I get:</p>
<pre><code>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)
</code></pre>
<p>And here is a public GitHub repo with my entire setup and installation steps: <a href="https://github.com/doomhz/my-go-project" rel="nofollow">https://github.com/doomhz/my-go-project</a></p>
<p>Any idea how to fix this? Any help would be much appreciated. Thanks in advance.</p>
<hr/>**评论:**<br/><br/>edwinTop: <pre><p>you can put them back in multiple directory, but your docker file should look something like this..</p>
<pre><code>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"]
</code></pre></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传