diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index afaaf37..c594fda 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -12,35 +12,30 @@ jobs: steps: - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: - stable: 'false' go-version: '1.21' - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v4 with: fetch-depth: 1 - name: Cache Go modules - uses: actions/cache@v1 + uses: actions/cache@v4 with: - path: ~/go/pkg/mod + path: | + ~/.cache/go-build + ~/go/pkg/mod key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} restore-keys: | - ${{ runner.OS }}-build-${{ env.cache-name }}- ${{ runner.OS }}-build- - ${{ runner.OS }}- - name: Lint - uses: golangci/golangci-lint-action@v2 + uses: golangci/golangci-lint-action@v4 with: - version: v1.54.2 - args: --timeout 10m - - - name: Vet - if: matrix.os == 'ubuntu-latest' - run: go vet -v ./... + version: latest + args: -v -c .golangci.yaml - name: Build env: @@ -48,4 +43,4 @@ jobs: run: go build -ldflags "-s -w" ./... - name: Test - run: go test -v -race ./... + run: go test -v -count=1 -race ./... diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..0c59097 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,36 @@ +run: + timeout: 10m + allow-parallel-runners: true + +linters: + enable: + - errname + - stylecheck + - importas + - errcheck + - gosimple + - govet + - ineffassign + - mirror + - staticcheck + - tagalign + - testifylint + - typecheck + - unused + - unconvert + - wastedassign + - whitespace + - gocritic + - exhaustive + - noctx + - promlinter + # TODO these fail on windows + # - gofmt + # - goimports + +linters-settings: + govet: + enable-all: true + disable: + - shadow + - fieldalignment