我正在寫在GO一個簡單的應用程序,我有這樣的文件夾結構搬運工,撰寫找不到包(golang)
泊塢窗,compose.yml文件內容是:
version: '2'
services:
db:
image: rethinkdb:latest
ports:
- "38080:8080"
- "38015:28015"
- "39015:29015"
api:
image: golang:1.8-alpine
volumes:
- .:/go/src/test_server/
working_dir: /go/src/test_server
command: go run server.go
container_name: test_server
ports:
- "8085:8085"
links:
- db
tty: true
每次我跑碼頭工人,組成了我收到此錯誤信息:
test_server | controllers/users.go:4:3: cannot find package "_/go/src/test_server/vendor/github.com/gin-gonic/gin" in any of: test_server |
/usr/local/go/src/_/go/src/test_server/vendor/github.com/gin-gonic/gin (from $GOROOT) test_server |
/go/src/_/go/src/test_server/vendor/github.com/gin-gonic/gin (from $GOPATH)
它指的是控制器包。我正在使用github.com/kardianos/govendor來供應我的軟件包。你知道發生了什麼事嗎?
我做到了,但它不起作用,現在的錯誤信息是這樣的: test_server | ers/users.go:4:3:無法在以下任何位置找到軟件包「github.com/gin-gonic/gin」: test_server | /usr/local/go/src/github.com/gin-gonic/gin(來自$ GOROOT) test_server | /go/src/test_server/src/github.com/gin-gonic/gin(from $ GOPATH) 我嘗試過使用Dockerfile,因爲我雖然是更優雅的解決方案,但每次構建它時,都會出現錯誤: 這是Dockerfile內容: FROM golang:1.8高山 RUN去拿github.com/gin-gonic/gin EXPOSE 8085 – utiq
https://www.evernote.com/l/ADkxl1UoBy1IsYPq4u_YhyzR-N8FfIwZQCs – utiq