Skip to content

Commit be25c17

Browse files
authored
chore(deps): bump go to 1.25 everywhere (#3572)
* chore(go): bump to Go1.25 * fix: deprecation comments * chore(ci): remove go version exclusions * fix: lint * fix(model-runner): lint * fix(lint): exclude modulegen internal packages * fix(lint): exclude more internal packages * fix: lint * fix: lint * fix: lint * fix: lint * fix: golang version in test Dockerfiles
1 parent bc5413d commit be25c17

144 files changed

Lines changed: 389 additions & 356 deletions

File tree

Some content is hidden

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

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// README at: https://github.com/devcontainers/templates/tree/main/src/go
33
{
44
"name": "Go",
5-
"image": "mcr.microsoft.com/devcontainers/go:1.24-trixie",
5+
"image": "mcr.microsoft.com/devcontainers/go:1.25-trixie",
66

77
// Features to add to the dev container. More info: https://containers.dev/features.
88
// "features": {},

.github/workflows/ci-lint-go.yml

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,35 +30,10 @@ jobs:
3030
cache-dependency-path: "${{ inputs.project-directory == '' && '.' || inputs.project-directory }}/go.sum"
3131
id: go
3232

33-
- name: Determine golangci-lint version
34-
id: linter-version
35-
working-directory: ./${{ inputs.project-directory == '' && '.' || inputs.project-directory }}
36-
shell: bash
37-
run: |
38-
# golangci-lint must be built with a Go version >= the module's go directive.
39-
MODULE_GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}')
40-
MODULE_MAJOR_MINOR=$(echo "${MODULE_GO_VERSION}" | grep -oE '^[0-9]+\.[0-9]+')
41-
42-
case "${MODULE_MAJOR_MINOR}" in
43-
1.24)
44-
LINTER_VERSION=v2.0.2
45-
;;
46-
1.25)
47-
LINTER_VERSION=v2.9.0
48-
;;
49-
*)
50-
echo "::error::No golangci-lint version mapped for Go ${MODULE_GO_VERSION}. Please update ci-lint-go.yml."
51-
exit 1
52-
;;
53-
esac
54-
55-
echo "version=${LINTER_VERSION}" >> "$GITHUB_OUTPUT"
56-
echo "Module requires Go ${MODULE_GO_VERSION}, using golangci-lint ${LINTER_VERSION}"
57-
5833
- name: golangci-lint
5934
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
6035
with:
61-
version: ${{ steps.linter-version.outputs.version }}
36+
version: v2.9.0
6237
# Optional: working directory, useful for monorepos
6338
working-directory: ${{ inputs.project-directory }}
6439

.github/workflows/ci-test-go.yml

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -72,34 +72,11 @@ jobs:
7272
cache-dependency-path: '${{ inputs.project-directory }}/go.sum'
7373
id: go
7474

75-
- name: Check Go version compatibility
76-
id: go-compat
77-
working-directory: ./${{ inputs.project-directory == '' && '.' || inputs.project-directory }}
78-
shell: bash
79-
run: |
80-
# Read the minimum Go version required by the module
81-
MODULE_GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}')
82-
RUNNER_GO_VERSION=$(go env GOVERSION | sed 's/^go//')
83-
echo "Module requires Go ${MODULE_GO_VERSION}, runner has Go ${RUNNER_GO_VERSION}"
84-
85-
# Extract major.minor for comparison
86-
MODULE_MAJOR_MINOR=$(echo "${MODULE_GO_VERSION}" | grep -oE '^[0-9]+\.[0-9]+')
87-
RUNNER_MAJOR_MINOR=$(echo "${RUNNER_GO_VERSION}" | grep -oE '^[0-9]+\.[0-9]+')
88-
89-
if [ "$(printf '%s\n' "${MODULE_MAJOR_MINOR}" "${RUNNER_MAJOR_MINOR}" | sort -V | head -n1)" = "${MODULE_MAJOR_MINOR}" ]; then
90-
echo "compatible=true" >> $GITHUB_OUTPUT
91-
else
92-
echo "compatible=false" >> $GITHUB_OUTPUT
93-
echo "::warning::Skipping tests: module requires Go ${MODULE_GO_VERSION} but runner has Go ${RUNNER_GO_VERSION}"
94-
fi
95-
9675
- name: ensure compilation
97-
if: steps.go-compat.outputs.compatible == 'true'
9876
working-directory: ./${{ inputs.project-directory }}
9977
run: go build ./...
10078

10179
- name: Install dependencies
102-
if: steps.go-compat.outputs.compatible == 'true'
10380
shell: bash
10481
run: |
10582
SCRIPT_PATH="./.github/scripts/${{ inputs.project-directory }}/install-dependencies.sh"
@@ -111,25 +88,23 @@ jobs:
11188
11289
# Setup Testcontainers Cloud Client right before your Testcontainers tests
11390
- name: Setup Testcontainers Cloud Client
114-
if: ${{ steps.go-compat.outputs.compatible == 'true' && inputs.testcontainers-cloud }}
91+
if: ${{ inputs.testcontainers-cloud }}
11592
uses: atomicjar/testcontainers-cloud-setup-action@c335bdbb570ec7c48f72c7d450c077f0a002293e # v1.3
11693
with:
11794
token: ${{ secrets.TCC_TOKEN }}
11895

11996
- name: go test
120-
if: steps.go-compat.outputs.compatible == 'true'
12197
working-directory: ./${{ inputs.project-directory }}
12298
timeout-minutes: 30
12399
run: make test-unit
124100

125101
- name: Run checker
126-
if: steps.go-compat.outputs.compatible == 'true'
127102
run: |
128103
./scripts/check_environment.sh
129104
130105
# (Optionally) When you don't need Testcontainers Cloud anymore, you could terminate sessions eagerly
131106
- name: Terminate Testcontainers Cloud Client active sessions
132-
if: ${{ steps.go-compat.outputs.compatible == 'true' && inputs.testcontainers-cloud }}
107+
if: ${{ inputs.testcontainers-cloud }}
133108
uses: atomicjar/testcontainers-cloud-setup-action@c335bdbb570ec7c48f72c7d450c077f0a002293e # v1.3
134109
with:
135110
action: terminate
@@ -138,12 +113,12 @@ jobs:
138113
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4
139114
with:
140115
paths: "**/${{ inputs.project-directory }}/TEST-unit*.xml"
141-
if: ${{ always() && steps.go-compat.outputs.compatible == 'true' }}
116+
if: always()
142117

143118
- name: Decide if Sonar must be run
144-
if: ${{ steps.go-compat.outputs.compatible == 'true' && matrix.platform == 'ubuntu-latest' }}
119+
if: ${{ matrix.platform == 'ubuntu-latest' }}
145120
run: |
146-
if [[ "1.24.x" == "${{ inputs.go-version }}" ]] && \
121+
if [[ "1.25.x" == "${{ inputs.go-version }}" ]] && \
147122
[[ "true" != "${{ inputs.rootless-docker }}" ]] && \
148123
[[ "true" != "${{ inputs.testcontainers-cloud }}" ]] && \
149124
[[ "true" != "${{ inputs.ryuk-disabled }}" ]] && \
@@ -153,7 +128,7 @@ jobs:
153128
fi
154129
155130
- name: Set Sonar Cloud environment variables
156-
if: ${{ steps.go-compat.outputs.compatible == 'true' && env.SHOULD_RUN_SONAR == 'true' }}
131+
if: ${{ env.SHOULD_RUN_SONAR == 'true' }}
157132
run: |
158133
echo "PROJECT_VERSION=$(grep 'latest_version' mkdocs.yml | cut -d':' -f2 | tr -d ' ')" >> $GITHUB_ENV
159134
if [ "${{ inputs.project-directory }}" == "" ]; then
@@ -169,7 +144,7 @@ jobs:
169144
fi
170145
171146
- name: SonarQube Scan
172-
if: ${{ steps.go-compat.outputs.compatible == 'true' && env.SHOULD_RUN_SONAR == 'true' }}
147+
if: ${{ env.SHOULD_RUN_SONAR == 'true' }}
173148
uses: SonarSource/sonarqube-scan-action@aa494459d7c39c106cc77b166de8b4250a32bb97 # v5.1.0
174149
env:
175150
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
# We don't want to fail the build the soonest but identify which modules passed and failed.
6262
fail-fast: false
6363
matrix:
64-
go-version: [1.24.x, 1.25.x]
64+
go-version: [1.25.x, 1.26.x]
6565
module: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
6666
permissions:
6767
contents: read # for actions/checkout to fetch code
@@ -88,7 +88,7 @@ jobs:
8888
# We don't want to fail the build the soonest but identify which modules passed and failed.
8989
fail-fast: false
9090
matrix:
91-
go-version: [1.24.x, 1.25.x]
91+
go-version: [1.25.x, 1.26.x]
9292
uses: ./.github/workflows/ci-test-go.yml
9393
with:
9494
go-version: ${{ matrix.go-version }}
@@ -109,7 +109,7 @@ jobs:
109109
name: "Test with reaper off"
110110
strategy:
111111
matrix:
112-
go-version: [1.24.x, 1.25.x]
112+
go-version: [1.25.x, 1.26.x]
113113
uses: ./.github/workflows/ci-test-go.yml
114114
with:
115115
go-version: ${{ matrix.go-version }}
@@ -130,7 +130,7 @@ jobs:
130130
name: "Test with Rootless Docker"
131131
strategy:
132132
matrix:
133-
go-version: [1.24.x, 1.25.x]
133+
go-version: [1.25.x, 1.26.x]
134134
uses: ./.github/workflows/ci-test-go.yml
135135
with:
136136
go-version: ${{ matrix.go-version }}

.golangci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,27 @@ linters:
2323
- thelper
2424
- usestdlibvars
2525
exclusions:
26+
rules:
27+
- linters:
28+
- revive
29+
path: "^exec/"
30+
text: "var-naming: avoid package names that conflict with Go standard library package names"
31+
- linters:
32+
- revive
33+
path: "^log/"
34+
text: "var-naming: avoid package names that conflict with Go standard library package names"
35+
- linters:
36+
- revive
37+
path: "modulegen/internal/(context|template)/"
38+
text: "var-naming: avoid package names that conflict with Go standard library package names"
39+
- linters:
40+
- revive
41+
path: "internal/sdk/types/"
42+
text: "var-naming: avoid meaningless package names"
43+
- linters:
44+
- revive
45+
path: "gcloud/internal/shared/"
46+
text: "var-naming: avoid meaningless package names"
2647
presets:
2748
- comments
2849
- common-false-positives

AI.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ This is a **Go monorepo** containing:
1414
## Environment Setup
1515

1616
### Go Version
17-
- **Required**: Go 1.24.7
17+
- **Required**: Go 1.25.7
1818
- **Tool**: Use [gvm](https://github.com/andrewkroh/gvm) for version management
1919
- **CRITICAL**: Always run this before ANY Go command:
2020
```bash
2121
# For Apple Silicon (M1/M2/M3)
22-
eval "$(gvm 1.24.7 --arch=arm64)"
22+
eval "$(gvm 1.25.7 --arch=arm64)"
2323

2424
# For Intel/AMD (x86_64)
25-
eval "$(gvm 1.24.7 --arch=amd64)"
25+
eval "$(gvm 1.25.7 --arch=amd64)"
2626
```
2727

2828
### Project Structure
@@ -171,14 +171,14 @@ func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustom
171171
### When Tests Fail
172172
1. **Read the error message carefully** - it usually tells you exactly what's wrong
173173
2. **Check if it's a lint issue** - run `make pre-commit` first
174-
3. **Verify Go version** - ensure using Go 1.24.7
174+
3. **Verify Go version** - ensure using Go 1.25.7
175175
4. **Check Docker** - some tests require Docker daemon running
176176

177177
## Common Pitfalls to Avoid
178178

179179
### Code Issues
180180
- ❌ Using interface types as return values
181-
- ❌ Forgetting to run `eval "$(gvm 1.24.7 --arch=arm64)"`
181+
- ❌ Forgetting to run `eval "$(gvm 1.25.7 --arch=arm64)"`
182182
- ❌ Not handling errors from built-in options
183183
- ❌ Using module-specific container names (`PostgresContainer`)
184184
- ❌ Calling `.Customize()` method instead of direct function call

commons-test.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ define go_install
66
endef
77

88
$(GOBIN)/golangci-lint:
9-
$(call go_install,github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2)
9+
$(call go_install,github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.9.0)
1010

1111
$(GOBIN)/gotestsum:
1212
$(call go_install,gotest.tools/gotestsum@latest)

container.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ import (
2828
"github.com/testcontainers/testcontainers-go/wait"
2929
)
3030

31+
// Deprecated: Use [Container]
32+
//
3133
// DeprecatedContainer shows methods that were supported before, but are now deprecated
32-
// Deprecated: Use Container
3334
type DeprecatedContainer interface {
3435
GetHostEndpoint(ctx context.Context, port string) (string, string, error)
3536
GetIPAddress(ctx context.Context) (string, error)

docs/system_requirements/ci/aws_codebuild.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version: 0.2
1111
phases:
1212
install:
1313
runtime-versions:
14-
golang: 1.24
14+
golang: 1.25
1515
build:
1616
commands:
1717
- go test ./...

docs/system_requirements/ci/circle_ci.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ workflows:
5757
- tests:
5858
matrix:
5959
parameters:
60-
go-version: ["1.24.7", "1.25.1"]
60+
go-version: ["1.25.7", "1.26.1"]
6161

6262
```
6363

0 commit comments

Comments
 (0)