拥有Golang项目和Go工作区。我试图运行我的测试,但我有以下错误:Golang的gitlab-ci不会创建正确的文件夹结构
api/server.go:8:2: cannot find package "github.com/braintree/manners" in any of:
/usr/local/go/src/github.com/braintree/manners (from $GOROOT)
/go/src/github.com/braintree/manners (from $GOPATH)
克隆它确实该文件夹中的项目时,问题来自于:
克隆到“/构建/ COMPAGNY /项目” ......
$GOPATH is /go
,然后将该文件夹内我应该是这样:src/github.com/compagny/project
我可以:export GOPATH=$(pwd)
,但也不至于他lp,期待一个/ src文件夹。
但我没有控制gitlab-ci克隆项目,是吗?
我gitlab-ci.yml:
stages:
- build
- test
build-my-project:
image: golang:1.6
stage: build
script:
- go get -u github.com/Masterminds/glide
- glide install
- go build
test-my-project:
image: golang:1.6
stage: test
script:
- go get -u github.com/Masterminds/glide
- glide install
- go test -v ./...
你必须运行'去获得... '加载项目的依赖关系。 – Martin
@mgansler滑翔确实有效 –