25 lines
1.4 KiB
YAML
Raw Normal View History

2021-11-08 16:39:17 +00:00
# Go Linters - GitHub Actions
# This workflow runs golangci-lint with linters specified in .golangci.yml plus linters enabled here.
# To disable a linter, it must be removed from this file and also from .golangci.yml.
# Required linters must pass. Optional linters don't need to pass so they can be more aggressive.
name: linters
on: [push]
jobs:
# Check linters on latest-ubuntu with default version of Go.
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install golangci-lint
run: |
go version
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.1
- name: Run required linters in .golangci.yml plus hard-coded ones here
run: $(go env GOPATH)/bin/golangci-lint run --timeout=5m -E deadcode -E errcheck -E goconst -E gocyclo -E gofmt -E golint -E gosec -E govet -E ineffassign -E maligned -E misspell -E staticcheck -E structcheck -E typecheck -E unconvert -E varcheck
- name: Run optional linters (not required to pass)
run: $(go env GOPATH)/bin/golangci-lint run --timeout=5m --issues-exit-code=0 -E dupl -E gocritic -E gosimple -E lll -E prealloc -E deadcode -E errcheck -E goconst -E gocyclo -E gofmt -E golint -E gosec -E govet -E ineffassign -E lll -E maligned -E misspell -E staticcheck -E structcheck -E typecheck -E unconvert -E varcheck