Skip to content

Commit 28ff28b

Browse files
authored
chore(ci/deps): upgrade CI dependencies and fix linting issues (#136)
1 parent 3cf1977 commit 28ff28b

File tree

6 files changed

+85
-70
lines changed

6 files changed

+85
-70
lines changed

.github/release-please-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"bootstrap-sha": "3d6c7fff64bda8ba0dbea181c9f94fb9716dd188",
3+
"always-update": true,
34
"packages": {
45
".": {
56
"release-type": "simple",

.github/workflows/ci.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
- uses: actions/checkout@v4
1111
- uses: actions/setup-go@v5
1212
with:
13-
go-version: "1.23"
13+
go-version-file: go.mod
1414
- name: golangci-lint
15-
uses: golangci/golangci-lint-action@v6
15+
uses: golangci/golangci-lint-action@v8
1616
with:
17-
version: v1.61
17+
version: v2.1
1818
env:
1919
VERBOSE: "true"
2020

@@ -25,7 +25,7 @@ jobs:
2525
- uses: actions/checkout@v4
2626
- uses: actions/setup-go@v5
2727
with:
28-
go-version: "1.23"
28+
go-version-file: go.mod
2929
- name: Check if mods are tidy
3030
run: make check-tidy
3131

@@ -36,14 +36,18 @@ jobs:
3636
- uses: actions/checkout@v4
3737
- uses: actions/setup-go@v5
3838
with:
39-
go-version: "1.23"
39+
go-version-file: go.mod
4040
- name: Run tests
4141
run: make test
4242
env:
4343
VERBOSE: "true"
4444

4545
release-please:
46+
name: Release Please
4647
runs-on: ubuntu-latest
47-
if: github.ref_name == 'main' || github.ref_name == 'master'
48+
if: ${{ github.ref_name == 'main' || github.ref_name == 'master' }}
49+
permissions:
50+
contents: read
51+
pull-requests: write
4852
steps:
49-
- uses: jimeh/release-please-manifest-action@v1
53+
- uses: jimeh/release-please-manifest-action@v2

.golangci.yml

Lines changed: 68 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
1-
linters-settings:
2-
funlen:
3-
lines: 100
4-
statements: 150
5-
goconst:
6-
min-occurrences: 5
7-
gocyclo:
8-
min-complexity: 20
9-
govet:
10-
enable-all: true
11-
disable:
12-
- fieldalignment
13-
lll:
14-
line-length: 80
15-
tab-width: 4
16-
maligned:
17-
suggest-new: true
18-
misspell:
19-
locale: US
20-
1+
version: "2"
2+
run:
3+
modules-download-mode: readonly
4+
allow-parallel-runners: true
215
linters:
22-
disable-all: true
6+
default: none
237
enable:
248
- bodyclose
259
- copyloopvar
@@ -30,12 +14,8 @@ linters:
3014
- goconst
3115
- gocritic
3216
- gocyclo
33-
- gofumpt
34-
- goimports
35-
- goprintffuncname
3617
- goprintffuncname
3718
- gosec
38-
- gosimple
3919
- govet
4020
- ineffassign
4121
- lll
@@ -47,36 +27,69 @@ linters:
4727
- revive
4828
- sqlclosecheck
4929
- staticcheck
50-
- typecheck
5130
- unconvert
5231
- unused
5332
- whitespace
54-
55-
issues:
56-
exclude:
57-
- Using the variable on range scope `tt` in function literal
58-
- Using the variable on range scope `tc` in function literal
59-
exclude-rules:
60-
- path: "_test\\.go"
61-
linters:
62-
- funlen
63-
- dupl
64-
- goconst
65-
- source: "^//go:generate "
66-
linters:
67-
- lll
68-
- source: "`json:"
69-
linters:
70-
- lll
71-
- source: "`yaml:"
72-
linters:
73-
- lll
74-
exclude-dirs:
75-
- builds
76-
- sources
77-
- tarballs
78-
79-
run:
80-
timeout: 2m
81-
allow-parallel-runners: true
82-
modules-download-mode: readonly
33+
settings:
34+
funlen:
35+
lines: 100
36+
statements: 150
37+
goconst:
38+
min-occurrences: 5
39+
gocyclo:
40+
min-complexity: 20
41+
govet:
42+
disable:
43+
- fieldalignment
44+
enable-all: true
45+
lll:
46+
line-length: 80
47+
tab-width: 4
48+
misspell:
49+
locale: US
50+
exclusions:
51+
generated: lax
52+
presets:
53+
- comments
54+
- common-false-positives
55+
- legacy
56+
- std-error-handling
57+
rules:
58+
- linters:
59+
- dupl
60+
- funlen
61+
- goconst
62+
path: _test\.go
63+
- linters:
64+
- lll
65+
source: "^//go:generate "
66+
- linters:
67+
- lll
68+
source: "`json:"
69+
- linters:
70+
- lll
71+
source: "`yaml:"
72+
- path: (.+)\.go$
73+
text: Using the variable on range scope `tt` in function literal
74+
- path: (.+)\.go$
75+
text: Using the variable on range scope `tc` in function literal
76+
paths:
77+
- builds
78+
- sources
79+
- tarballs
80+
- third_party$
81+
- builtin$
82+
- examples$
83+
formatters:
84+
enable:
85+
- gofumpt
86+
- goimports
87+
exclusions:
88+
generated: lax
89+
paths:
90+
- builds
91+
- sources
92+
- tarballs
93+
- third_party$
94+
- builtin$
95+
- examples$

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ $(TOOLDIR)/$(1): Makefile
7171
endef
7272

7373
$(eval $(call tool,gofumpt,mvdan.cc/gofumpt@latest))
74-
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61))
74+
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1))
7575
$(eval $(call tool,gomod,github.com/Helcaraxan/gomod@latest))
7676

7777
.PHONY: tools

pkg/cask/update.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func (s *Updater) createRepoFile(
287287
s.logger.Info(
288288
"new commit created",
289289
"commit", contResp.GetSHA(), "message", contResp.GetMessage(),
290-
"url", contResp.Commit.GetHTMLURL(),
290+
"url", contResp.GetHTMLURL(),
291291
)
292292

293293
return nil
@@ -354,7 +354,7 @@ func (s *Updater) updateRepoFile(
354354
s.logger.Info(
355355
"new commit created",
356356
"commit", contResp.GetSHA(), "message", contResp.GetMessage(),
357-
"url", contResp.Commit.GetHTMLURL(),
357+
"url", contResp.GetHTMLURL(),
358358
)
359359

360360
return true, nil

pkg/osinfo/osinfo.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ func (s *OSInfo) distinctVersion(version string) string {
6565
return parts[0]
6666
}
6767

68-
max := len(parts)
69-
if max > 2 {
70-
max = 2
71-
}
68+
end := min(len(parts), 2)
7269

73-
return strings.Join(parts[0:max], ".")
70+
return strings.Join(parts[0:end], ".")
7471
}

0 commit comments

Comments
 (0)