Skip to content

Commit 4f2072f

Browse files
authored
build/linters: Bump Go to v1.26 and golangci-lint to v2.9.0 (thrasher-corp#2166)
* build/linters: Bump Go to v1.26 and golangci-lint to v2.9.0 * refactor: Update UUID generation in tests to handle errors and improve logging function names * refactor: Correct typo in assertion message for non-existent file check
1 parent 403868d commit 4f2072f

File tree

66 files changed

+320
-503
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+320
-503
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Dev Container base image
22
# See: https://github.com/devcontainers/images/tree/main/src/go
33
# Use the published "dev-" tagged image for the latest Go version.
4-
# See MCR tags: dev-1.25, dev-1.25-bookworm
5-
ARG VARIANT=dev-1.25-bookworm
4+
# See MCR tags: dev-1.26, dev-1.26-trixie
5+
ARG VARIANT=dev-1.26-trixie
66
FROM mcr.microsoft.com/devcontainers/go:${VARIANT}
77

88
USER root

.devcontainer/post_create.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,14 @@ install_go_tool github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gatewa
1919
install_go_tool github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest
2020

2121
# Linting
22-
install_go_tool github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.4.0
22+
install_go_tool github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.9.0
2323

2424
# Formatting
2525
install_go_tool mvdan.cc/gofumpt@latest
2626

27-
# Go modernise enforcer
28-
install_go_tool golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest
29-
3027
log "Installed tools:"
3128

32-
for t in protoc-gen-go protoc-gen-go-grpc buf protoc-gen-grpc-gateway protoc-gen-openapiv2 golangci-lint gofumpt modernize; do
29+
for t in protoc-gen-go protoc-gen-go-grpc buf protoc-gen-grpc-gateway protoc-gen-openapiv2 golangci-lint gofumpt; do
3330
command -v "$t" || true
3431
done
3532

.github/workflows/amd64.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.25
1+
FROM golang:1.26
22

33
# Install GCC with multi-architecture support (needed for SQLite library)
44
RUN apt-get update && apt-get install -y gcc-multilib && rm -rf /var/lib/apt/lists/*

.github/workflows/config-versions-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: configs-versions-lint
22
on: [push, pull_request]
33
env:
4-
GO_VERSION: 1.25.x
4+
GO_VERSION: 1.26.x
55
jobs:
66
lint:
77
name: config versions lint

.github/workflows/linter.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ jobs:
88
- uses: actions/checkout@v6
99
- uses: actions/setup-go@v6
1010
with:
11-
go-version: '1.25.x'
11+
go-version: '1.26.x'
1212
- name: golangci-lint
1313
uses: golangci/golangci-lint-action@v9
1414
with:
15-
version: v2.4.0
15+
version: v2.9.0

.github/workflows/misc.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- name: Setup Go
1010
uses: actions/setup-go@v6
1111
with:
12-
go-version: 1.25.x
12+
go-version: 1.26.x
1313

1414
- name: Check for currency.NewPair(BTC, USD) used instead of currency.NewBTCUSD
1515
run: |
@@ -83,9 +83,4 @@ jobs:
8383
fi
8484
done
8585
86-
- name: Check Go modernise tool issues
87-
run: |
88-
pkgs=$(go list ./... | grep -vE '/gctrpc$|/backtester/btrpc$|/database/models/')
89-
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -test $pkgs
90-
9186

.github/workflows/proto-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Setup Go
1515
uses: actions/setup-go@v6
1616
with:
17-
go-version: 1.25.x
17+
go-version: 1.26.x
1818

1919
- name: Setup build depends
2020
run: |

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
on: [push, pull_request]
22
name: CI
33
env:
4-
GO_VERSION: 1.25.x
4+
GO_VERSION: 1.26.x
55
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66
jobs:
77
backend:

.golangci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ linters:
5252
- goconst
5353
- gocritic
5454
# - gocyclo
55+
# - godoclint
5556
# - godot
5657
# - godox
5758
# - goheader
@@ -65,6 +66,7 @@ linters:
6566
# - importas
6667
# - inamedparam
6768
# - interfacebloat
69+
# - iotamixing
6870
- intrange
6971
# - ireturn
7072
# - lll
@@ -74,6 +76,7 @@ linters:
7476
- mirror
7577
- misspell
7678
# - mnd
79+
- modernize
7780
# - musttag
7881
# - nakedret
7982
# - nestif
@@ -104,6 +107,7 @@ linters:
104107
- testableexamples
105108
- testifylint
106109
# - testpackage
110+
# - unqueryvet
107111
- thelper
108112
- tparallel
109113
- unconvert
@@ -132,6 +136,9 @@ linters:
132136
desc: Please use the custom JSON package github.com/thrasher-corp/gocryptotrader/encoding/json instead of encoding/json to allow sonic/json switching.
133137
goconst:
134138
min-occurrences: 6
139+
gosec:
140+
excludes:
141+
- G602 # False positives, see https://github.com/golangci/golangci-lint/issues/6334
135142
gocritic:
136143
disabled-checks:
137144
- wrapperFunc
@@ -182,6 +189,9 @@ linters:
182189
- linters:
183190
- revive
184191
text: "var-naming: avoid meaningless package names"
192+
- linters:
193+
- revive
194+
text: "var-naming: avoid package names that conflict with Go standard library package names"
185195
paths:
186196
- vendor
187197
- web/

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.25 as build
1+
FROM golang:1.26 as build
22
WORKDIR /go/src/github.com/thrasher-corp/gocryptotrader
33
COPY . .
44
RUN GO111MODULE=on go mod vendor

0 commit comments

Comments
 (0)