Skip to content

Instantly share code, notes, and snippets.

@g-dormoy
Created February 16, 2017 08:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save g-dormoy/c707ebed2381f5eb08eaec93ac1d4efb to your computer and use it in GitHub Desktop.
Save g-dormoy/c707ebed2381f5eb08eaec93ac1d4efb to your computer and use it in GitHub Desktop.
gitlab-ci for golang dev
image: golang:1.7
before_script:
- export GO_PROJECT_PATH="$GOPATH/src/git.int.rtblw.com/$CI_PROJECT_NAMESPACE"
- echo $GO_PROJECT_PATH
- mkdir -p $GO_PROJECT_PATH
- ln -s $(pwd) $GO_PROJECT_PATH
- export GO_PROJECT_PATH="$GO_PROJECT_PATH/$CI_PROJECT_NAME"
- echo $GO_PROJECT_PATH
- cd $GO_PROJECT_PATH
stages:
- build
- verify
- style
go_build:
stage: build
script:
- go build -race
go_test:
stage: verify
script:
- go test -race -cover $(go list ./... | grep -v "vendor")
go_vet:
stage: verify
script:
- go vet $(go list ./... | grep -v "vendor")
staticcheck:
stage: verify
script:
- go get -u honnef.co/go/staticcheck/cmd/staticcheck
- staticcheck $(go list ./... | grep -v "vendor")
golint:
stage: style
script:
- go get -u github.com/golang/lint/golint
- out=$(golint $(go list ./... | grep -v "vendor"))
- if [ "$out" ]; then echo "$out"; exit 1; fi
gosimple:
stage: style
script:
- go get -u honnef.co/go/simple/cmd/gosimple
- gosimple $(go list ./... | grep -v "vendor")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment