Skip to content

Conversation

zerok
Copy link
Contributor

@zerok zerok commented Apr 22, 2025

This should prevent compatibility issues with tools that are on 1.23 but not on the latest patch release there.

This should prevent compatibility issues with tools that are on 1.23 but
not on the latest patch release there.
@zerok
Copy link
Contributor Author

zerok commented Apr 22, 2025

The Dagger CLI seems to be using 1.23.6 still. I wasn't sure if the language requirement of 1.23.8 was intentional or if 1.23.0 would also suffice in your scenario 🙂

Context: https://github.com/grafana/tanka/actions/runs/14571021118/job/40868199561?pr=1429 / grafana/tanka#1429

@coveralls
Copy link

Coverage Status

coverage: 73.012% (+0.02%) from 72.995%
when pulling c13fc33 on zerok:zerok/go-requirement-1.23
into eadb1db on 99designs:master.

@StevenACoffman StevenACoffman merged commit 413d823 into 99designs:master Apr 23, 2025
17 checks passed
@StevenACoffman
Copy link
Collaborator

I'm not really entirely sure I understand how this works. I thought that the minor version of the Go directive would not have caused an issue.

@zerok
Copy link
Contributor Author

zerok commented Apr 23, 2025

@StevenACoffman This also surprised me but perhaps it somehow different when explicitly setting a toolchain. Unfortunately, I didn't have time to set up a complete test-suite around this 🙁 Thanks for merging this! Hopefully this will get us unstuck soonish 😄

@StevenACoffman
Copy link
Collaborator

Can you circle back if you get more information? I worry I am downgrading people to Go 1.23.0 from later minor versions.
I have read over https://go.dev/doc/toolchain and am not sure why the problem you report would have happened.

@zerok
Copy link
Contributor Author

zerok commented Apr 23, 2025

Absolutely!

Just for the record, that's the setup that we have with Dagger right now:

  • dagger/dagger uses go 1.23.0 and toolchain go1.23.6
  • gqlgen used go 1.23.8

My interpretation of the spec is that setting go 1.23.0 forces users to have a toolchain >= 1.23.0 when compiling the code. Setting the toolchain to go1.23.6 enforce a minimum version of the compiler. Setting go ... should never downgrade a toolchain from what I've understood.

One thing that I've noticed which might explain the whole cascade-of-conflicts here:

When I add v0.17.72 as a dependency in a go.mod file and run go mod tidy, it will update the go ... line in my go.mod file to go 1.23.8 which would conflict with the toolchain defined by Dagger.

dagger/dagger#6706 (comment)

@StevenACoffman
Copy link
Collaborator

StevenACoffman commented Apr 23, 2025

I really need a test case that detects Go version directive changes and enforces the security policy with an actionable resolution to prevent this from just happening again and again.

Apparently this is what's necessary to fix the go.mod up:

go get go@1.23.0
go get toolchain@none
go mod tidy

So then a script that runs that and checks whether git is dirty or something and tells people to run that and commit the result.

Also, probably good to add export GOTOOLCHAIN=go1.23.0 in all my CI stuff.

@lionelfleury
Copy link

Go directive reference
https://go.dev/ref/mod#go-mod-file-go
It's really about minimal required version

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.

4 participants