Skip to content

Commit

Permalink
Update golangci-lint and enable most go-vet checks (#314)
Browse files Browse the repository at this point in the history
* 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 6b1fabb.

* Disable fieldalignment in govet

* Fix golangci-lint workflow

* Fix go-version config in setup go action
  • Loading branch information
optik-aper authored Jun 5, 2024
1 parent 2968a63 commit 5ce1680
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
32 changes: 12 additions & 20 deletions .github/workflows/gochecks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
9 changes: 5 additions & 4 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -74,14 +76,14 @@ linters:
- gocyclo
- gofmt
- goimports
- gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- mnd
- nakedret
- noctx
- nolintlint
Expand Down Expand Up @@ -132,6 +134,5 @@ issues:
- lll
- goconst
- dogsled

run:
timeout: 5m

0 comments on commit 5ce1680

Please sign in to comment.