Skip to content

Commit 419ad70

Browse files
Use stable go version in gh actions (#6530)
Setup-go has some non-straitforward tricks: https://github.com/actions/setup-go?tab=readme-ov-file#getting-go-version-from-the-gomod-file > The go directive in go.mod can specify a patch version or omit it altogether (e.g., go 1.22.0 or go 1.22). If a patch version is specified, that specific patch version will be used. If no patch version is specified, it will search for the latest available patch version in the cache, [versions-manifest.json](https://github.com/actions/go-versions/blob/main/versions-manifest.json), and the [official Go language website](https://golang.org/dl/?mode=json&include=all), in that order. This is an invention of setup-go action authors. Go team [says](golang/go#68971 (comment)) that release version (e.g. 1.22.0) should be specified That means, e.g. when [this commit](8f46514#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6R3) updated go.mod from 1.22 to 1.22.0, the "Long JetStream tests" silently started to use 1.22.0, instead of 1.22.12. "If nothing magically works, nothing magically breaks". Since we update to the new toolchain version as soon as it is released, and we usually use the latest toolchain for the releases, we should run all tests using [go-version: stable](https://github.com/actions/setup-go?tab=readme-ov-file#using-stableoldstable-aliases) Signed-off-by: Alex Bozhenko <[email protected]>
2 parents b17ef2b + 1d654d7 commit 419ad70

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

Diff for: .github/actions/nightly-release/action.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ runs:
2222
run: docker login -u "${{ inputs.hub_username }}" -p "${{ inputs.hub_password }}"
2323

2424
- name: Set up Go
25-
uses: actions/setup-go@v4
25+
uses: actions/setup-go@v5
2626
with:
27-
go-version: "stable"
27+
go-version: stable
2828

2929
- name: Build and push Docker images
3030
# Use commit hash here to avoid a re-tagging attack, as this is a third-party action

Diff for: .github/workflows/cov.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Set up Go
2323
uses: actions/setup-go@v5
2424
with:
25-
go-version-file: src/github.com/nats-io/nats-server/go.mod
25+
go-version: stable
2626
cache-dependency-path: src/github.com/nats-io/nats-server/go.sum
2727

2828
- name: Run code coverage

Diff for: .github/workflows/long-tests.yaml

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ jobs:
2424
- name: Install Go
2525
uses: actions/setup-go@v5
2626
with:
27-
# Use go version from go.mod
28-
go-version-file: "go.mod"
29-
# Use latest stable go version
30-
# go-version: stable
27+
go-version: stable
3128

3229
- name: Run tests
3330
run: go test -race -v -run='^TestLong.*' ./server -tags=include_js_long_tests -count=1 -vet=off -timeout=60m -shuffle on -p 1 -failfast

Diff for: .github/workflows/mqtt-test.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup Go
1717
uses: actions/setup-go@v5
1818
with:
19-
go-version-file: src/github.com/nats-io/nats-server/go.mod
19+
go-version: stable
2020
cache-dependency-path: src/github.com/nats-io/nats-server/go.sum
2121

2222
- name: Set up testing tools and environment

0 commit comments

Comments
 (0)