Skip to content

Commit 41460dd

Browse files
authored
chore: update golangci-lint (#34)
1 parent 6afd05f commit 41460dd

File tree

3 files changed

+55
-56
lines changed

3 files changed

+55
-56
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
env:
1111
GO_VERSION: oldstable
12-
GOLANGCI_LINT_VERSION: v1.64.8
12+
GOLANGCI_LINT_VERSION: v2.1
1313

1414
jobs:
1515
go_install:
@@ -30,10 +30,9 @@ jobs:
3030
with:
3131
go-version: ${{ env.GO_VERSION }}
3232
- uses: actions/checkout@v3
33-
- uses: golangci/golangci-lint-action@v6.5.2
33+
- uses: golangci/golangci-lint-action@v8
3434
with:
3535
version: ${{ env.GOLANGCI_LINT_VERSION }}
36-
args: --timeout=5m
3736

3837
test:
3938
runs-on: ubuntu-latest

.golangci.yml

Lines changed: 52 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
## A good ref for this: https://gist.github.com/maratori/47a4d00457a92aa426dbd48a18776322
2-
1+
version: "2"
32
run:
4-
timeout: 5m
53
tests: true
64
linters:
75
enable:
@@ -14,16 +12,11 @@ linters:
1412
- dogsled
1513
- dupword # checks for duplicate words in the source code
1614
- durationcheck # checks for two durations multiplied together
17-
- errcheck
1815
- errname
1916
- errorlint
20-
- gci
2117
- gochecknoinits # checks that no init functions are present in Go code
2218
- gocritic
23-
- gosimple
24-
- govet
2519
- importas # enforces consistent import aliases
26-
- ineffassign
2720
- loggercheck
2821
- makezero # finds slice declarations with non-zero initial length
2922
- mirror
@@ -39,55 +32,61 @@ linters:
3932
- reassign # checks that package variables are not reassigned
4033
- revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
4134
- staticcheck
42-
- stylecheck
4335
- thelper # detects golang test helpers without t.Helper() call and checks the consistency of test helpers
4436
- unconvert # removes unnecessary type conversions
4537
- unparam # reports unused function parameters
4638
- unused
4739
- usestdlibvars # detects the possibility to use variables/constants from the Go standard library
4840
- wastedassign # finds wasted assignment statements
4941
- whitespace # detects leading and trailing whitespace
50-
linters-settings:
51-
gci:
52-
skip-generated: true
53-
custom-order: true
54-
sections:
55-
- standard # Standard section: captures all standard packages.
56-
- default # Default section: contains all imports that could not be matched to another section type.
57-
- prefix(github.com/jjti)
58-
gocritic:
59-
settings:
60-
captLocal:
61-
# Whether to restrict checker to params only.
62-
# Default: true
63-
paramsOnly: false
64-
underef:
65-
# Whether to skip (*x).method() calls where x is a pointer receiver.
66-
# Default: true
67-
skipRecvDeref: false
68-
govet:
69-
enable-all: true
70-
disable:
71-
- fieldalignment # too strict
72-
- shadow # bunch of false positive, doesn't realize when we return from a func
73-
misspell:
74-
locale: US
75-
nakedret:
76-
max-func-lines: 0
77-
nestif:
78-
# Minimal complexity of if statements to report.
79-
# Default: 5
80-
min-complexity: 5
81-
nolintlint:
82-
# Enable to require an explanation of nonzero length after each nolint directive.
83-
# Default: false
84-
require-explanation: true
85-
stylecheck:
86-
checks: ["all"]
87-
issues:
88-
include:
89-
- EXC0001 # Error return value of x is not checked
90-
- EXC0013 # package comment should be of the form "(.+)...
91-
- EXC0014 # comment on exported (.+) should be of the form "(.+)..."
92-
exclude:
93-
- ifElseChain
42+
43+
settings:
44+
gocritic:
45+
settings:
46+
captLocal:
47+
# Whether to restrict checker to params only.
48+
# Default: true
49+
paramsOnly: false
50+
underef:
51+
# Whether to skip (*x).method() calls where x is a pointer receiver.
52+
# Default: true
53+
skipRecvDeref: false
54+
govet:
55+
disable:
56+
- fieldalignment # too strict
57+
- shadow # bunch of false positive, doesn't realize when we return from a func
58+
enable-all: true
59+
misspell:
60+
locale: US
61+
nakedret:
62+
max-func-lines: 0
63+
nestif:
64+
# Minimal complexity of if statements to report.
65+
# Default: 5
66+
min-complexity: 5
67+
nolintlint:
68+
# Enable to require an explanation of nonzero length after each nolint directive.
69+
# Default: false
70+
require-explanation: true
71+
staticcheck:
72+
checks:
73+
- all
74+
75+
exclusions:
76+
presets:
77+
- common-false-positives
78+
- legacy
79+
rules:
80+
- path: (.+)\.go$
81+
text: ifElseChain
82+
83+
formatters:
84+
enable:
85+
- gci
86+
settings:
87+
gci:
88+
sections:
89+
- standard # Standard section: captures all standard packages.
90+
- default # Default section: contains all imports that could not be matched to another section type.
91+
- prefix(github.com/jjti)
92+
custom-order: true

cmd/spancheck/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package main is the command line for go-spancheck.
12
package main
23

34
import (

0 commit comments

Comments
 (0)