Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ci: fix go version to that defined in go.mod#438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 6 commits intomainfromcj/fix-go-version
Sep 5, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions.github/workflows/release.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,15 +19,18 @@ jobs:
name: Run Integration Tests
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v5

- name: Check Go Versions
run: ./scripts/check_go_version.sh

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: "1.24.2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why do these need this to be in sync? IIRC Go will run as the version defined ingo.mod even if it's a lower version. Higher version of course takes precedence.

See:

~❯ go1.23.7 versiongo version go1.23.7 darwin/arm64
~/Code/coder main*❯ go1.23.7 versiongo version go1.24.6 darwin/arm64

Btw,go.mod says1.24.6.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Theactions/setup-go action has a breaking change:

Breaking ChangesImprove toolchain handling to ensure more reliable and consistent toolchain selection and management by [@​matthewhughes934](https://github.com/matthewhughes934) in [actions/setup-go#460](https://redirect.github.com/actions/setup-go/pull/460)

see#437

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ah, gotcha, so they're preventing that behavior now.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

#439 stacked the original PR on top and it's green ✅

mafredri reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ignore my comment about 1.24.6 btw, originally thought this was a PR to coder/coder repo 😄

id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v5

- name: Get dependencies
run: |
go mod download
Expand DownExpand Up@@ -74,13 +77,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v5

- name: Check Go Versions
run: ./scripts/check_go_version.sh

- name: Unshallow
run: git fetch --prune --unshallow

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version:'1.22'
go-version:"1.24.2"

- name: Import GPG key
id: import_gpg
Expand Down
33 changes: 21 additions & 12 deletions.github/workflows/test.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,15 +19,18 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v5

- name: Check Go Versions
run: ./scripts/check_go_version.sh

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: "1.24.2"
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v5

- name: Get dependencies
run: |
go mod download
Expand DownExpand Up@@ -92,20 +95,23 @@ jobs:
- "1.10.*"
- "1.11.*"
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v5

- name: Check Go Versions
run: ./scripts/check_go_version.sh

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: "1.24.2"
id: go

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false

- name: Check out code into the Go module directory
uses: actions/checkout@v5

- name: Get dependencies
run: |
go mod download
Expand All@@ -122,20 +128,23 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v5

- name: Check Go Versions
run: ./scripts/check_go_version.sh

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: "1.24.2"
id: go

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: "latest"
terraform_wrapper: false

- name: Check out code into the Go module directory
uses: actions/checkout@v5

- name: Get dependencies
run: |
go mod download
Expand Down
35 changes: 35 additions & 0 deletionsscripts/check_go_version.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail

MOD_VERSION=$(go mod edit -json | jq -r .Go)
echo "go.mod version: $MOD_VERSION"
STATUS=0

if [[ " $* " == *" --fix "* ]]; then
for wf in .github/workflows/*.{yml,yaml}; do
sed -i "s/go-version:.*/go-version: \"${MOD_VERSION}\"/g" "${wf}"
done
exit 0
fi

for wf in .github/workflows/*.{yml,yaml}; do
WF_VERSIONS=$(yq -r '.jobs[].steps[] | select(.with["go-version"]) | .with["go-version"]' -o=tsv "$wf" | grep -v '^---$' || true)
if [[ -z "$WF_VERSIONS" ]]; then
continue
fi

UNIQUE_WF_VERSIONS=$(sort -u <<<"$WF_VERSIONS")
for ver in $UNIQUE_WF_VERSIONS; do
if [[ $ver != "$MOD_VERSION" ]]; then
STATUS=1
echo "❌ $wf: go.mod=$MOD_VERSION but workflow uses $(tr '\n' ' ' <<<"$UNIQUE_WF_VERSIONS")"
continue
fi
done
done

if [[ $STATUS -eq 1 ]]; then
echo "Re-run this script with --fix to automatically update workflows to match go.mod"
fi

exit $STATUS

[8]ページ先頭

©2009-2025 Movatter.jp