Skip to content

Commit 2d7da2a

Browse files
ernadoclaude
andcommitted
ci: fix pipelines after dependency bumps
The Go 1.25 toolchain (required by gotd/td) broke the Lint workflow: golangci-lint v1 maxes out at a Go 1.24 build and refuses a 1.25 target. - Migrate to golangci-lint v2: bump golangci-lint-action v3.7.0 => v8.0.0 pinned to golangci-lint v2.12.1, and migrate .golangci.yml to the v2 schema (drops removed linters: deadcode/structcheck/varcheck/golint/ gosimple/stylecheck; gofmt/goimports moved to formatters). - Drop unconfigured depguard linter: v2's default denies all third-party imports, and the repo never configured it (was a historical no-op). - Annotate user-driven filepath.Walk open with #nosec G122 (new gosec check). - Bump actions/cache v3.3.2 => v4.2.3 (GitHub auto-fails the old version). - Bump actions/upload-artifact v3 => v4 (v3 is disabled by GitHub). - Migrate .goreleaser.yaml to version 2 (required by goreleaser-action v7) and snapshot.name_template => version_template. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c48708d commit 2d7da2a

5 files changed

Lines changed: 90 additions & 96 deletions

File tree

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
go-version: "1.25"
2222

2323
- name: Lint
24-
uses: golangci/golangci-lint-action@v3.7.0
24+
uses: golangci/golangci-lint-action@v8.0.0
2525
with:
26-
version: latest
26+
version: v2.12.1
2727
args: --timeout 5m
2828

2929
# Check if there are any dirty changes after go mod tidy
@@ -44,7 +44,7 @@ jobs:
4444
echo "::set-output name=cache::$(go env GOCACHE)"
4545
echo "::set-output name=modcache::$(go env GOMODCACHE)"
4646
- name: Set up cache
47-
uses: actions/cache@v3.3.2
47+
uses: actions/cache@v4.2.3
4848
with:
4949
path: |
5050
${{ steps.go-env.outputs.cache }}

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
echo "::set-output name=modcache::$(go env GOMODCACHE)"
2626
2727
- name: Set up cache
28-
uses: actions/cache@v3.3.2
28+
uses: actions/cache@v4.2.3
2929
with:
3030
path: |
3131
${{ steps.go-env.outputs.cache }}
@@ -43,7 +43,7 @@ jobs:
4343
env:
4444
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4545
- name: Upload assets
46-
uses: actions/upload-artifact@v3
46+
uses: actions/upload-artifact@v4
4747
with:
4848
name: cli
4949
path: dist/*

.golangci.yml

Lines changed: 82 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,101 @@
1-
linters-settings:
2-
govet:
3-
check-shadowing: true
4-
gocyclo:
5-
min-complexity: 15
6-
maligned:
7-
suggest-new: true
8-
dupl:
9-
threshold: 120
10-
goconst:
11-
min-len: 2
12-
min-occurrences: 3
13-
misspell:
14-
locale: US
15-
lll:
16-
line-length: 140
17-
goimports:
18-
local-prefixes: github.com/gotd/
19-
gocritic:
20-
enabled-tags:
21-
- diagnostic
22-
- experimental
23-
- opinionated
24-
- performance
25-
- style
26-
disabled-checks:
27-
- hugeParam
28-
- rangeValCopy
29-
- exitAfterDefer
30-
- whyNoLint
31-
- singleCaseSwitch
32-
- commentedOutCode
33-
1+
version: "2"
342
linters:
35-
disable-all: true
3+
default: none
364
enable:
37-
- deadcode
38-
- depguard
395
- dogsled
406
- dupl
417
- errcheck
8+
- gochecknoglobals
429
- gochecknoinits
10+
- gocognit
4311
- goconst
4412
- gocritic
45-
- gofmt
46-
- goimports
47-
- golint
4813
- gosec
49-
- gosimple
5014
- govet
5115
- ineffassign
5216
- lll
5317
- misspell
5418
- nakedret
5519
- staticcheck
56-
- structcheck
57-
- stylecheck
58-
- typecheck
5920
- unconvert
6021
- unparam
6122
- unused
62-
- varcheck
6323
- whitespace
64-
- gochecknoglobals
65-
- gocognit
66-
67-
# Do not enable:
68-
# - wsl (too opinionated about newlines)
69-
# - godox (todos are OK)
70-
# - bodyclose (false positives on helper functions)
71-
# - prealloc (not worth it in scope of this project)
72-
# - maligned (same as prealloc)
73-
# - funlen (gocyclo is enough)
74-
75-
issues:
76-
exclude-use-default: false
77-
exclude-rules:
78-
- linters: [gocritic]
79-
text: "commentedOutCode"
80-
source: "SHA1"
81-
82-
# Allow embed globals
83-
- source: "embed\\.FS"
84-
linters: [gochecknoglobals]
85-
86-
# Exclude go:generate from lll
87-
- source: "//go:generate"
88-
linters: [lll]
89-
90-
# Disable linters that are annoying in tests.
91-
- path: _test\.go
92-
linters:
93-
- gocyclo
94-
- errcheck
95-
- dupl
96-
- gosec
97-
- funlen
98-
- goconst
99-
- gocognit
100-
- scopelint
101-
- lll
102-
- gochecknoglobals
103-
# Ignore shadowing of err.
104-
- linters: [govet]
105-
text: 'declaration of "(err|ctx|log)"'
106-
107-
- text: "should have.+comment"
108-
linters: [golint]
24+
settings:
25+
dupl:
26+
threshold: 120
27+
goconst:
28+
min-len: 2
29+
min-occurrences: 3
30+
gocritic:
31+
disabled-checks:
32+
- hugeParam
33+
- rangeValCopy
34+
- exitAfterDefer
35+
- whyNoLint
36+
- singleCaseSwitch
37+
- commentedOutCode
38+
enabled-tags:
39+
- diagnostic
40+
- experimental
41+
- opinionated
42+
- performance
43+
- style
44+
gocyclo:
45+
min-complexity: 15
46+
govet:
47+
enable:
48+
- shadow
49+
lll:
50+
line-length: 140
51+
misspell:
52+
locale: US
53+
exclusions:
54+
generated: lax
55+
rules:
56+
- linters:
57+
- gocritic
58+
text: commentedOutCode
59+
source: SHA1
60+
- linters:
61+
- gochecknoglobals
62+
source: embed\.FS
63+
- linters:
64+
- lll
65+
source: //go:generate
66+
- linters:
67+
- dupl
68+
- errcheck
69+
- funlen
70+
- gochecknoglobals
71+
- gocognit
72+
- goconst
73+
- gocyclo
74+
- gosec
75+
- lll
76+
- scopelint
77+
path: _test\.go
78+
- linters:
79+
- govet
80+
text: declaration of "(err|ctx|log)"
81+
- linters:
82+
- golint
83+
text: should have.+comment
84+
paths:
85+
- third_party$
86+
- builtin$
87+
- examples$
88+
formatters:
89+
enable:
90+
- gofmt
91+
- goimports
92+
settings:
93+
goimports:
94+
local-prefixes:
95+
- github.com/gotd/
96+
exclusions:
97+
generated: lax
98+
paths:
99+
- third_party$
100+
- builtin$
101+
- examples$

.goreleaser.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This is an example .goreleaser.yml file with some sensible defaults.
22
# Make sure to check the documentation at https://goreleaser.com
3+
version: 2
34
project_name: tg
45
before:
56
hooks:
@@ -21,7 +22,7 @@ builds:
2122
checksum:
2223
name_template: 'checksums.txt'
2324
snapshot:
24-
name_template: "{{ incpatch .Version }}-next"
25+
version_template: "{{ incpatch .Version }}-next"
2526
changelog:
2627
sort: asc
2728
filters:

cmd/tg/upload.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (p *app) uploadCmd(c *cli.Context) error {
175175
return err
176176
}
177177

178-
f, err := os.Open(filepath.Clean(path))
178+
f, err := os.Open(filepath.Clean(path)) // #nosec G122 // path comes from user-provided upload target
179179
if err != nil {
180180
return xerrors.Errorf("open %q: %w", path, err)
181181
}

0 commit comments

Comments
 (0)