Skip to content

Instantly share code, notes, and snippets.

@d-kuro

d-kuro/config.yml

Last active Oct 9, 2019
Embed
What would you like to do?
Golang CircieCI config
version: 2.1
executors:
build:
parameters:
go-version:
type: string
docker:
- image: circleci/golang:<< parameters.go-version >>
environment:
GO111MODULE: "on"
working_directory: /go/src/d-kuro/go-sandbox
commands:
go_mod_download:
steps:
- restore_cache:
name: Restore go modules cache
keys:
- go-modules-{{ checksum "go.sum" }}
- run: go mod download
- save_cache:
name: Save go modules cache
key: go-modules-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod"
jobs:
build:
parameters:
go-version:
type: string
golangci-lint-version:
type: string
executor:
name: build
go-version: << parameters.go-version >>
steps:
- checkout
- go_mod_download
- run:
name: Install GolangCI-Lint
command: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v<< parameters.golangci-lint-version >>
- run:
name: Run GolangCI-Lint
command: ./bin/golangci-lint run --tests --disable-all --enable=goimports --enable=golint --enable=govet --enable=errcheck --enable=staticcheck
- run:
name: Run Tests
command: go test -race -v ./...
workflows:
golang-workflow:
jobs:
- build:
go-version: "1.11.5"
golangci-lint-version: "1.15.0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment