From 5ce16808b7b3df50ff9261242add8f9d03af1944 Mon Sep 17 00:00:00 2001 From: Michael Riley Date: Wed, 5 Jun 2024 13:19:36 -0400 Subject: [PATCH] Update golangci-lint and enable most go-vet checks (#314) * Update golangci-lint config for 1.59 * Apply fieldalignment fixes for struct byte sizes * Revert "Apply fieldalignment fixes for struct byte sizes" This reverts commit 6b1fabb42cee0e4a09af24ef4bceaf4eba6c77e8. * Disable fieldalignment in govet * Fix golangci-lint workflow * Fix go-version config in setup go action --- .github/workflows/gochecks.yml | 32 ++++++++++++-------------------- .golangci.yaml | 9 +++++---- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/.github/workflows/gochecks.yml b/.github/workflows/gochecks.yml index c4011df..e5df2d3 100644 --- a/.github/workflows/gochecks.yml +++ b/.github/workflows/gochecks.yml @@ -5,38 +5,30 @@ on: branches: - master pull_request: - branches: - - master - jobs: - Go-Lint: + Golangci-lint: + name: Check golangci-lint runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: - go-version: '1.19' - - - name: Install dependencies - run: | - go version - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.49.0 - + go-version: "1.22" - name: Run golangci-lint - run: | - golangci-lint run ./... + uses: golangci/golangci-lint-action@v6 + with: + version: "latest" + args: "./..." Go-Fmt: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: - go-version: '1.19' + go-version: '1.22' - name: Run fmt run: | diff --git a/.golangci.yaml b/.golangci.yaml index cf83e85..c5060cb 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -23,7 +23,7 @@ linters-settings: min-complexity: 15 goimports: local-prefixes: github.com/golangci/golangci-lint - gomnd: + mnd: # don't include the "operation" and "assign" checks: - argument @@ -39,7 +39,9 @@ linters-settings: - strings.SplitN govet: - check-shadowing: true + enable-all: true + disable: + - fieldalignment # a lot of manual overhead for reduced readability and adding a linter "gotcha" settings: printf: funcs: @@ -74,7 +76,6 @@ linters: - gocyclo - gofmt - goimports - - gomnd - goprintffuncname - gosec - gosimple @@ -82,6 +83,7 @@ linters: - ineffassign - lll - misspell + - mnd - nakedret - noctx - nolintlint @@ -132,6 +134,5 @@ issues: - lll - goconst - dogsled - run: timeout: 5m