-
Notifications
You must be signed in to change notification settings - Fork 57
Fix compatibility with go 1.24 and require go >= 1.23 #282
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I have tested those changes in our own project: hetznercloud/packer-plugin-hcloud@dcc7f00 For those who can upgrade to go>=1.24, I think its worth using |
@lbajolet-hashicorp May I have your attention for this fix 🙏 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jooola,
Thanks for the PR, I left a couple of comments on the version/toolchain bumps, but other than that, this LGTM!
I'll let you address my comments, and we can probably merge this one soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @jooola,
Thanks for the responses and apologies it took me a bit of time to go back to this PR.
I agree with the bump to 1.23.0, but as I mentioned regarding the toolchain directive, I'm not convinced we need it per-se, so I opted to remove it in a commit I pushed to your branch as to speed-up this change being merged.
With that, I'm approving this PR, thanks for the change!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you Lucas and @jooola!
Just an FYI that this can be simplified with a reusable workflow to remove repetition. For example, with name: go-test
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
TEST_RESULTS_PATH: /tmp/test-results
permissions:
contents: read
jobs:
linux-tests:
uses: ./.github/workflows/go-test-template.yml
with:
os: ubuntu-latest
windows-tests:
uses: ./.github/workflows/go-test-template.yml
with:
os: windows-latest
darwin-tests:
uses: ./.github/workflows/go-test-template.yml
with:
os: macos-latest And then the name: Go Test Template
on:
workflow_call:
inputs:
os:
required: true
type: string
env:
TEST_RESULTS_PATH: /tmp/test-results
permissions:
id-token: write
contents: read
jobs:
go-test:
runs-on: ${{ inputs.os }}
strategy:
matrix:
go-version:
- '1.23.x'
- '1.24.x'
steps:
- name: Run git config #Windows-only
if: runner.os == 'Windows'
run: git config --global core.autocrlf false
- name: Setup Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Check that go.mod does not contain a replace
run: |
if grep -Eq "^\s*replace" <go.mod; then
echo "go.mod contains a replace but should not." >&2
false
fi
- name: Create test directory
run: |
mkdir -p ${{ env.TEST_RESULTS_PATH }}/packer-plugin-sdk
- name: Install buf
if: runner.os == 'Linux'
uses: bufbuild/[email protected]
- name: Run gofmt
if: runner.os == 'Linux'
run: |
make fmt-check
- name: Run Go Generate Check
if: runner.os == 'Linux'
run: |
make generate-check
- name: Install gotestsum
shell: bash
run: go install gotest.tools/[email protected]
- name: Fix gocty
run: |
make install-gen-deps
packer-sdc fix .
go mod tidy
- name: Run Go tests
shell: bash
run: |
PACKAGE_NAMES="$(go list ./...)"
echo "Running $(echo "$PACKAGE_NAMES" | wc -w) packages"
echo "$PACKAGE_NAMES"
echo "$PACKAGE_NAMES" | xargs -I {} gotestsum --format=short-verbose --junitfile "$TEST_RESULTS_PATH"/packer-plugin-sdk/gotestsum-report.xml -- -count 1 -p 2 {}; |
No rush, thanks for looking at it :)
Fine by me! Are you folks planning to cut a release with this, or is are there not enough changes yet? |
Hey @jooola, Yes we do plan to cut a SDK release soon, we're working over some vulnerability reports for now, so I just want to make sure we address them in the SDK before that, but the plan is to cut a release this week, as early as possible. Thanks! |
Related to #279