Skip to content

Conversation

@thevilledev
Copy link
Contributor

@thevilledev thevilledev commented Aug 18, 2025

Why the changes in this PR are needed?

Go 1.23 is no longer supported as per Go release policy.

What are the changes in this PR?

This PR bumps the Go version requirement to the latest 1.24.6, also matching the toolchain version.

Notes to assist PR review:

  • Version changes in the first commit
  • Lint changes implied by the version upgrade in the second commit
  • Build errors regarding error strings in the third commit
  • Plugin related race condition fix, surfaced by Go 1.21 on Ubuntu 24.04 for some odd reason in the fourth commit

Further comments:

I also looked into bumping the toolchain version to 1.25.0 and using the latest golangci-lint. As it implies a linter config migration to v1 and v2 with a ton of changes, I decided to just keep the PR at 1.24.

@thevilledev thevilledev changed the title Chore/go 1.24 chore(deps): bump Go version requirement to 1.24 Aug 18, 2025
@netlify
Copy link

netlify bot commented Aug 18, 2025

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit 983fe27
🔍 Latest deploy log https://app.netlify.com/projects/openpolicyagent/deploys/68aa9363c842f000084c6dcf
😎 Deploy Preview https://deploy-preview-7839--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@thevilledev thevilledev force-pushed the chore/go-1.24 branch 2 times, most recently from ec1444e to ea1558a Compare August 18, 2025 10:37
@thevilledev thevilledev changed the title chore(deps): bump Go version requirement to 1.24 build: bump Go version requirement to 1.24 Aug 18, 2025
Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

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

This is great. Thanks for another fine contribution to OPA, Ville! Just a question about the nolint directive, but not a blocker as far as I'm concerned.

data := parseJSON(eval.NewData)
if err := instance.SetPolicyData(ctx, policy, data); err != nil {
t.Errorf(err.Error())
t.Errorf("%s", err.Error()) //nolint:govet
Copy link
Member

Choose a reason for hiding this comment

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

What's the linter complaining about here? Isn't that fixed by the change?
Same question goes for all lines with //nolint:govet directives.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you're right! I re-ran the linter and it worked just fine without them. Likely caused by a false positive/cache issue. Pushed a fix now.

if err != nil {
t.Fatal(err)
}
t.Chdir(rootDir)
Copy link
Member

Choose a reason for hiding this comment

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

Neat 👍

Go 1.23 is no longer supported as per Go release policy.

Changes:

- Use Go v1.24.6 as the project SDK requirement

Signed-off-by: Ville Vesilehto <[email protected]>
Fix "non-constant format string in call" issues as seen in CI.

Signed-off-by: Ville Vesilehto <[email protected]>
Replace t.Error() call from goroutine with error channel
communication to prevent "Fail in goroutine after test
completion" panic on Go 1.21 with ubuntu-24.04 by the
"Go compat build/test" Github Actions workflow. The race
occurred when oneShot() errors were reported after the
main test goroutine completed.

Signed-off-by: Ville Vesilehto <[email protected]>
@thevilledev thevilledev force-pushed the chore/go-1.24 branch 2 times, most recently from e8d24aa to 6f49636 Compare August 24, 2025 04:06
Inadvertently added due to false positives.

Signed-off-by: Ville Vesilehto <[email protected]>
@anderseknert
Copy link
Member

Excellent! There's likely a few more things we can benefit from with 1.24, but this is a very reasonable limit for the scope of this change. Thank you for this!

@anderseknert anderseknert merged commit f77322b into open-policy-agent:main Aug 24, 2025
31 checks passed
@Hayden-IO
Copy link

For libraries, it's a best practice to specify the lowest version of Go you depend on and let consumers build with the latest version of Go. It doesn't matter that 1.23 is no longer supported, it's up to dependents to build with a supported version. By specifying go 1.24.6, dependents will be forced to also specify this version in their go.mod file even if they don't need features from Go 1.24.

If you're aren't using any language features of Go 1.24, you could downgrade back to 1.23 or maybe even an older version. If you are using language features, can you specify go 1.24.0 as the version rather than a specific patch version? Dependents can then build using any Go 1.24.x version rather than 1.24.6 or greater.

@anderseknert
Copy link
Member

OPA isn't a "library" per se, and the decision about which Go version to use tries to account for both API consumers and the needs of the application itself. Using go 1.24.0 sounds like a reasonable choice if someone is helped by that. Feel free to push that change if you have the bandwidth, @haydentherapper

@Hayden-IO
Copy link

I've filed #7879, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants