Skip to content

Commit 68b779b

Browse files
Bump golangci-lint to v2 (#904)
Bump `golangci-lint` to `v2`. Required rewriting `.golangci.yml` which was automated with `golangci-lint migrate` [[docs](https://golangci-lint.run/product/migration-guide/)]. Fix one linter issue that was uncovered by the upgrade.
1 parent c3fddb3 commit 68b779b

File tree

3 files changed

+62
-76
lines changed

3 files changed

+62
-76
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,10 @@ jobs:
8181
cache: false
8282

8383
- name: golangci-lint
84-
uses: golangci/golangci-lint-action@v4
84+
uses: golangci/golangci-lint-action@v8
8585
with:
86-
# Require: The version of golangci-lint to use.
87-
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
88-
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
89-
version: v1.64.5
90-
91-
# Optional: golangci-lint command line arguments.
92-
#
93-
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
94-
# The location of the configuration file can be changed by using `--config=`
95-
args: --timeout=30m --out-format=colored-line-number --config=.golangci.yml
86+
version: v2.1
87+
args: --timeout=30m --config=.golangci.yml
9688

9789
format:
9890
name: format

.golangci.yml

Lines changed: 58 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,74 @@
1-
goVersion: &goVersion "1.24"
2-
3-
run:
4-
go: *goVersion
5-
timeout: 5m
6-
1+
version: "2"
72
linters:
8-
disable-all: true
9-
# Enable specific linter
10-
# https://golangci-lint.run/usage/linters/#enabled-by-default-linters
3+
default: none
114
enable:
12-
- errorlint
135
- copyloopvar
6+
- errorlint
147
- forcetypeassert
158
- goconst
169
- gocritic
17-
- gofumpt
1810
- gosec
19-
- gosimple
2011
- govet
2112
- ineffassign
2213
- makezero
2314
- misspell
2415
- nakedret
2516
- nolintlint
2617
- prealloc
27-
- prealloc
2818
- staticcheck
29-
- stylecheck
3019
- unused
31-
32-
linters-settings:
33-
errorlint:
34-
errorf: true
35-
36-
gomodguard:
37-
blocked:
38-
# List of blocked modules.
39-
modules:
40-
# Blocked module.
41-
- github.com/pkg/errors:
42-
# Recommended modules that should be used instead. (Optional)
43-
recommendations:
44-
- errors
45-
- fmt
46-
reason: "This package is deprecated, use `fmt.Errorf` with `%w` instead"
47-
48-
goconst:
49-
ignore-tests: true
50-
numbers: true
51-
52-
gocritic:
53-
disabled-checks:
54-
- exitAfterDefer
55-
- ifElseChain
56-
- commentFormatting
57-
58-
gofumpt:
59-
module-path: "pgroll"
60-
extra-rules: false
61-
62-
staticcheck:
63-
checks: ["all"]
64-
65-
stylecheck:
66-
checks: ["all", "-ST1000", "-ST1005"]
67-
68-
unused:
69-
go: *goVersion
70-
71-
makezero:
72-
always: false
73-
74-
gosec:
75-
exclude-generated: true
76-
severity: low
77-
includes: []
20+
settings:
21+
errorlint:
22+
errorf: true
23+
goconst:
24+
numbers: true
25+
gocritic:
26+
disabled-checks:
27+
- exitAfterDefer
28+
- ifElseChain
29+
- commentFormatting
30+
gomodguard:
31+
blocked:
32+
modules:
33+
- github.com/pkg/errors:
34+
recommendations:
35+
- errors
36+
- fmt
37+
reason: This package is deprecated, use `fmt.Errorf` with `%w` instead
38+
gosec:
39+
severity: low
40+
makezero:
41+
always: false
42+
staticcheck:
43+
checks:
44+
- all
45+
- -ST1000
46+
- -ST1005
47+
exclusions:
48+
generated: lax
49+
presets:
50+
- comments
51+
- common-false-positives
52+
- legacy
53+
- std-error-handling
54+
rules:
55+
- linters:
56+
- goconst
57+
path: (.+)_test\.go
58+
paths:
59+
- third_party$
60+
- builtin$
61+
- examples$
62+
formatters:
63+
enable:
64+
- gofumpt
65+
settings:
66+
gofumpt:
67+
module-path: pgroll
68+
extra-rules: false
69+
exclusions:
70+
generated: lax
71+
paths:
72+
- third_party$
73+
- builtin$
74+
- examples$

pkg/sql2pgroll/create_index.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,7 @@ func convertCreateIndexStmt(stmt *pgq.IndexStmt) (migrations.Operations, error)
9090
}
9191

9292
// Get index uniqueness
93-
unique := false
94-
if stmt.GetUnique() {
95-
unique = true
96-
}
93+
unique := stmt.GetUnique()
9794

9895
// Deparse WHERE clause
9996
var predicate string

0 commit comments

Comments
 (0)