Switch to go modules for dependency management.
Added support for dependency management using go modules. Note that Go version 1.11+ is required if using go modules for dependency management. Updated the gitlab CI yaml file to use go modules instead of copying everything to GOPATH. Ran go mod download before running build script to download all dependencies into cache.
This commit is contained in:
parent
fca8887adf
commit
4fbbf91b00
5 changed files with 88 additions and 12 deletions
|
@ -1,18 +1,18 @@
|
|||
image: golang:1.11
|
||||
image: golang:1.12
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- /apt-cache
|
||||
- /go/src/github.com
|
||||
- /go/src/golang.org
|
||||
- /go/src/google.golang.org
|
||||
- /go/src/gopkg.in
|
||||
- /go/pkg/mod/github.com
|
||||
- /go/pkg/mod/golang.org
|
||||
- /go/pkg/mod/google.golang.org
|
||||
|
||||
before_script:
|
||||
- mkdir -p /go/src/gitlab.com/spdf /go/src/_/builds
|
||||
- cp -r $CI_PROJECT_DIR /go/src/gitlab.com/spdf/elektron
|
||||
- ln -s /go/src/gitlab.com/spdf /go/src/_/builds/elektron
|
||||
- export GOPATH="/go"
|
||||
- mkdir -p $GOPATH/pkg/mod github.com $GOPATH/pkg/mod/golang.org $GOPATH/pkg/mod/google.golang.org
|
||||
- cp -r $CI_PROJECT_DIR /elektron
|
||||
- cd /elektron
|
||||
- go mod download
|
||||
|
||||
build:
|
||||
script:
|
||||
- go build -o elektron /go/src/gitlab.com/spdf/elektron
|
||||
- go build -v -o elektron
|
||||
|
|
Reference in a new issue