Skip to content

Commit fa7dd82

Browse files
authored
Set Actions Go version from go.mod (#389)
The `.palantir/go-version` file is no longer supported, so always build with the latest patch release of the version specified in `go.mod.` This mostly matches the behavior we're adopting internally, with the main difference being that we'll never build with a newer major version of Go than what is specified in our `go.mod` file. We can't rely on the default behavior of the `setup-go` action because it always downloads the exact version in `go.mod` when a patch version is specified.
1 parent d216caa commit fa7dd82

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Set Go version
2525
id: go_version
2626
run: |
27-
GO_VERSION=$(cat .palantir/go-version | sed 's/^go//' )
27+
GO_VERSION=$(sed -E -n '/^go / s/^go ([0-9]+\.[0-9]+)(\.[0-9]+)?$/\1/p' < go.mod)
2828
echo "version=${GO_VERSION}" >> $GITHUB_OUTPUT
2929
3030
- name: Set up Go

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Set Go version
3434
id: go_version
3535
run: |
36-
GO_VERSION=$(cat .palantir/go-version | sed 's/^go//' )
36+
GO_VERSION=$(sed -E -n '/^go / s/^go ([0-9]+\.[0-9]+)(\.[0-9]+)?$/\1/p' < go.mod)
3737
echo "version=${GO_VERSION}" >> $GITHUB_OUTPUT
3838
3939
- name: Set up Go

0 commit comments

Comments
 (0)