Skip to content

Commit 45ae92c

Browse files
authored
build: use Go 1.25 (#1679)
1 parent e37097c commit 45ae92c

File tree

19 files changed

+164
-145
lines changed

19 files changed

+164
-145
lines changed

.github/workflows/ci-nightly.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
workflow_dispatch:
77

88
env:
9-
GO_VERSION: "1.23.3"
109
CI_E2E_FILENAME: "rel-nightly"
1110
CHANNEL: nightly
1211
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
@@ -37,9 +36,9 @@ jobs:
3736
with:
3837
fetch-depth: 0 # Fetch full history
3938
- name: Set up Go
40-
uses: actions/setup-go@v4
39+
uses: actions/setup-go@v6
4140
with:
42-
go-version: ${{ env.GO_VERSION }}
41+
go-version-file: 'go.mod'
4342
- name: Set up Python
4443
uses: actions/setup-python@v4
4544
with:
@@ -52,8 +51,6 @@ jobs:
5251
pip3 install e2e_tests/
5352
echo "$HOME/.local/bin" >> $GITHUB_PATH
5453
echo "/usr/local/go/bin" >> $GITHUB_PATH
55-
- name: Install golangci-lint
56-
run: go install github.com/golangci/golangci-lint/cmd/[email protected]
5754
- name: Check formatting
5855
run: test -z "$(go fmt ./...)"
5956
- name: Run linter
@@ -115,9 +112,9 @@ jobs:
115112
submodules: recursive
116113
fetch-depth: 0 # Fetch full history
117114
- name: Set up Go
118-
uses: actions/setup-go@v4
115+
uses: actions/setup-go@v6
119116
with:
120-
go-version: ${{ env.GO_VERSION }}
117+
go-version-file: 'go.mod'
121118
- name: Set up Python
122119
uses: actions/setup-python@v4
123120
with:

.github/workflows/ci-pr.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
branches: [ main ]
88

99
env:
10-
GO_VERSION: "1.23.3"
1110
# A stable environment for PRs.
1211
# Set CHANNEL to nightly and update CI_E2E_FILENAME when adding a new feature.
1312
# Change back to stable once the new feature is released.
@@ -39,9 +38,9 @@ jobs:
3938
with:
4039
fetch-depth: 0 # Fetch full history
4140
- name: Set up Go
42-
uses: actions/setup-go@v4
41+
uses: actions/setup-go@v6
4342
with:
44-
go-version: ${{ env.GO_VERSION }}
43+
go-version-file: 'go.mod'
4544
- name: Set up Python
4645
uses: actions/setup-python@v4
4746
with:
@@ -52,8 +51,6 @@ jobs:
5251
sudo NEEDRESTART_MODE=a apt-get -y install python3 python3-pip python3-setuptools python3-wheel libboost-math-dev libffi-dev docker-compose
5352
pip3 install -r misc/requirements.txt
5453
pip3 install e2e_tests/
55-
- name: Install golangci-lint
56-
run: go install github.com/golangci/golangci-lint/cmd/[email protected]
5754
- name: Check formatting
5855
run: test -z "$(go fmt ./...)"
5956
- name: Run linter

.github/workflows/goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- run: git fetch --force --tags
1919

2020
- name: go dependency
21-
uses: actions/setup-go@v5
21+
uses: actions/setup-go@v6
2222
with:
2323
go-version-file: 'go.mod'
2424

.github/workflows/reviewdog.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ jobs:
1111
with:
1212
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
1313
- name: Install specific golang
14-
uses: actions/setup-go@v5
14+
uses: actions/setup-go@v6
1515
with:
16-
go-version: '1.23.3'
16+
go-version-file: 'go.mod'
1717
- name: reviewdog-golangci-lint
18-
uses: reviewdog/action-golangci-lint@v2.6.2
18+
uses: reviewdog/action-golangci-lint@v2.8
1919
with:
2020
go_version_file: go.mod
21-
golangci_lint_version: "v1.62.0"
21+
golangci_lint_version: "v2.5.0"
2222
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
2323
reporter: "github-pr-check"
2424
tool_name: "Lint Errors"
@@ -34,14 +34,14 @@ jobs:
3434
with:
3535
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
3636
- name: Install specific golang
37-
uses: actions/setup-go@v5
37+
uses: actions/setup-go@v6
3838
with:
39-
go-version: '1.23.3'
39+
go-version-file: 'go.mod'
4040
- name: reviewdog-golangci-lint
41-
uses: reviewdog/action-golangci-lint@v2.6.2
41+
uses: reviewdog/action-golangci-lint@v2.8
4242
with:
4343
go_version_file: go.mod
44-
golangci_lint_version: "v1.62.0"
44+
golangci_lint_version: "v2.5.0"
4545
golangci_lint_flags: "-c .golangci-warnings.yml --allow-parallel-runners"
4646
reporter: "github-pr-check"
4747
tool_name: "Lint Warnings"

.golangci-warnings.yml

Lines changed: 51 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,62 @@
1+
version: "2"
12
run:
2-
timeout: 5m
33
tests: true
4-
54
linters:
6-
disable-all: true
5+
default: none
76
enable:
87
- staticcheck
9-
- typecheck
10-
- gosimple
118
- unused
12-
13-
severity:
14-
default-severity: warning
15-
9+
settings:
10+
staticcheck:
11+
checks:
12+
- all
13+
- '-ST1000' # don't require package comments
14+
- '-ST1003' # don't require currentDBRound vs currentDbRound
15+
- '-SA3001' # we assign to b.N in several benchmarks
16+
- '-QF1008' # ignore suggestions to remove embedded fields (e.g., txn.SignedTxn.Txn -> txn.Txn)
17+
exclusions:
18+
generated: lax
19+
rules:
20+
# be more lenient with test code
21+
- linters:
22+
- staticcheck
23+
- unused
24+
path: _test\.go
25+
- linters:
26+
- unused
27+
path: (.+)\.go$
28+
text: 'field _struct is unused'
29+
# ignore govet false positive fixed in https://github.com/golang/go/issues/45043
30+
- path: (.+)\.go$
31+
text: 'sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify'
32+
# ignore golint false positive fixed in https://github.com/golang/lint/pull/487
33+
- path: (.+)\.go$
34+
text: exported method (.*).Unwrap` should have comment or be unexported
35+
# ignore issues about the way we use _struct fields to define encoding settings
36+
# Enable some golangci-lint default exception rules:
37+
# "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok"
38+
- path: (.+)\.go$
39+
text: Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
40+
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
41+
- path: (.+)\.go$
42+
text: ineffective break statement. Did you mean to break out of the outer loop
43+
paths:
44+
- third_party$
45+
- builtin$
46+
- examples$
1647
issues:
17-
# use these new lint checks on code since #935
18-
new-from-rev: 99ab66fdadcd77fef4048bb2aa86cae1f06c6e08
19-
20-
# Disable default exclude rules listed in `golangci-lint run --help` (selectively re-enable some below)
21-
exclude-use-default: false
22-
2348
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
2449
max-issues-per-linter: 0
25-
2650
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
2751
max-same-issues: 0
28-
29-
exclude:
30-
# ignore govet false positive fixed in https://github.com/golang/go/issues/45043
31-
- "sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify"
32-
# ignore golint false positive fixed in https://github.com/golang/lint/pull/487
33-
- "exported method (.*).Unwrap` should have comment or be unexported"
34-
# ignore issues about the way we use _struct fields to define encoding settings
35-
- "`_struct` is unused"
36-
37-
# Enable some golangci-lint default exception rules:
38-
# "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok"
39-
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
40-
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
41-
- ineffective break statement. Did you mean to break out of the outer loop
42-
43-
exclude-rules:
44-
# be more lenient with test code
45-
- path: _test\.go
46-
linters:
47-
- staticcheck
48-
- typecheck
49-
- gosimple
50-
- unused
52+
# use these new lint checks on code since #935
53+
new-from-rev: 99ab66fdadcd77fef4048bb2aa86cae1f06c6e08
54+
severity:
55+
default: warning
56+
formatters:
57+
exclusions:
58+
generated: lax
59+
paths:
60+
- third_party$
61+
- builtin$
62+
- examples$

.golangci.yml

Lines changed: 61 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,80 @@
1+
version: "2"
12
run:
2-
timeout: 5m
33
tests: true
4-
54
linters:
6-
disable-all: true
5+
default: none
76
enable:
87
- errcheck
9-
- gofmt
108
- govet
119
- ineffassign
1210
- misspell
13-
- gci
1411
- revive
15-
16-
linters-settings:
17-
gci:
18-
sections:
19-
- standard
20-
- default
21-
- prefix(github.com/algorand)
22-
- prefix(github.com/algorand/go-algorand)
23-
24-
section-separators:
25-
- newLine
26-
12+
exclusions:
13+
generated: lax
14+
rules:
15+
# revive: types is an acceptable package name in this codebase
16+
- linters:
17+
- revive
18+
path: types/
19+
text: 'var-naming: avoid meaningless package names'
20+
# ignore govet false positive fixed in https://github.com/golang/go/issues/45043
21+
- path: (.+)\.go$
22+
text: 'sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify'
23+
# ignore golint false positive fixed in https://github.com/golang/lint/pull/487
24+
- path: (.+)\.go$
25+
text: exported method (.*).Unwrap` should have comment or be unexported
26+
# ignore issues about the way we use _struct fields to define encoding settings
27+
- path: (.+)\.go$
28+
text: '`_struct` is unused'
29+
# Enable some golangci-lint default exception rules:
30+
# "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok"
31+
- path: (.+)\.go$
32+
text: Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
33+
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
34+
- path: (.+)\.go$
35+
text: ineffective break statement. Did you mean to break out of the outer loop
36+
# revive: ignore some rules
37+
- path: (.+)\.go$
38+
text: '^unused-parameter: parameter'
39+
- path: (.+)\.go$
40+
text: '^package-comments: should have a package comment'
41+
paths:
42+
- third_party$
43+
- builtin$
44+
- examples$
45+
issues:
46+
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
47+
max-issues-per-linter: 0
48+
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
49+
max-same-issues: 0
50+
# use these new lint checks on code since #935
51+
new-from-rev: 99ab66fdadcd77fef4048bb2aa86cae1f06c6e08
2752
severity:
28-
default-severity: error
53+
default: error
2954
rules:
3055
- linters:
3156
- errcheck
57+
- gci
3258
- gofmt
3359
- govet
3460
- ineffassign
3561
- misspell
36-
- gci
3762
- revive
3863
severity: error
39-
40-
issues:
41-
# use these new lint checks on code since #935
42-
new-from-rev: 99ab66fdadcd77fef4048bb2aa86cae1f06c6e08
43-
44-
# Disable default exclude rules listed in `golangci-lint run --help` (selectively re-enable some below)
45-
exclude-use-default: false
46-
47-
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
48-
max-issues-per-linter: 0
49-
50-
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
51-
max-same-issues: 0
52-
53-
exclude:
54-
# ignore govet false positive fixed in https://github.com/golang/go/issues/45043
55-
- "sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify"
56-
# ignore golint false positive fixed in https://github.com/golang/lint/pull/487
57-
- "exported method (.*).Unwrap` should have comment or be unexported"
58-
# ignore issues about the way we use _struct fields to define encoding settings
59-
- "`_struct` is unused"
60-
61-
# Enable some golangci-lint default exception rules:
62-
# "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok"
63-
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
64-
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
65-
- ineffective break statement. Did you mean to break out of the outer loop
66-
67-
# revive: ignore some rules
68-
- "^unused-parameter: parameter"
69-
- "^package-comments: should have a package comment"
64+
formatters:
65+
enable:
66+
- gci
67+
- gofmt
68+
settings:
69+
gci:
70+
sections:
71+
- standard
72+
- default
73+
- prefix(github.com/algorand)
74+
- prefix(github.com/algorand/go-algorand)
75+
exclusions:
76+
generated: lax
77+
paths:
78+
- third_party$
79+
- builtin$
80+
- examples$

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ idb/postgres/internal/schema/setup_postgres_sql.go: idb/postgres/internal/schema
2020
cd idb/postgres/internal/schema && go generate
2121

2222
idb/mocks/IndexerDb.go: idb/idb.go
23-
go install github.com/vektra/mockery/v2@v2.47.0
23+
go install github.com/vektra/mockery/v2@v2.53.5
2424
cd idb && mockery --name=IndexerDb
2525

2626
# check that all packages (except tests) compile
@@ -31,7 +31,7 @@ test: idb/mocks/IndexerDb.go cmd/algorand-indexer/algorand-indexer
3131
go test -coverpkg=$(COVERPKG) ./... -coverprofile=coverage.txt -covermode=atomic ${TEST_FLAG}
3232

3333
lint:
34-
golangci-lint run -c .golangci.yml
34+
GOTOOLCHAIN=auto go run github.com/golangci/golangci-lint/v2/cmd/[email protected] run -c .golangci.yml
3535
go vet ./...
3636

3737
fmt:

api/converter_utils.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ func hdrRowToBlock(row idb.BlockRow) generated.Block {
327327
UpgradePropose: strPtr(string(row.BlockHeader.UpgradePropose)),
328328
}
329329

330-
var partUpdates *generated.ParticipationUpdates = &generated.ParticipationUpdates{}
330+
var partUpdates = &generated.ParticipationUpdates{}
331331
if len(row.BlockHeader.ExpiredParticipationAccounts) > 0 {
332332
addrs := make([]string, len(row.BlockHeader.ExpiredParticipationAccounts))
333333
for i := 0; i < len(addrs); i++ {
@@ -759,11 +759,12 @@ func signedTxnWithAdToTransaction(stxn *sdk.SignedTxnWithAD, extra rowData) (gen
759759
itxns := make([]generated.Transaction, 0, len(stxn.ApplyData.EvalDelta.InnerTxns))
760760
for _, t := range stxn.ApplyData.EvalDelta.InnerTxns {
761761
extra2 := extra
762-
if t.Txn.Type == sdk.ApplicationCallTx {
762+
switch t.Txn.Type {
763+
case sdk.ApplicationCallTx:
763764
extra2.AssetID = uint64(t.ApplyData.ApplicationID)
764-
} else if t.Txn.Type == sdk.AssetConfigTx {
765+
case sdk.AssetConfigTx:
765766
extra2.AssetID = uint64(t.ApplyData.ConfigAsset)
766-
} else {
767+
default:
767768
extra2.AssetID = 0
768769
}
769770
extra2.AssetCloseAmount = t.ApplyData.AssetClosingAmount

0 commit comments

Comments
 (0)