fluxcd / pkg

Toolkit common packages
https://pkg.go.dev/github.com/fluxcd/pkg
Apache License 2.0
45 stars 84 forks source link

Is go 1.22 mandatory for gittestserver? #773

Closed squaremo closed 2 months ago

squaremo commented 2 months ago

I'd like to be able to use github.com/fluxcd/pkg/gittestserver, but I don't have access to go 1.22. The go directive used to be advisory, but in go 1.21 it became mandatory. Is go 1.22 mandatory for this module? https://github.com/fluxcd/pkg/blob/235bfbb67d45b96942f03402b0c33dd5a74b2047/gittestserver/go.mod#L3

The rationale given if you follow git blame is https://github.com/fluxcd/notification-controller/pull/779, but I don't see anything there that mandates go 1.22. Am I missing something?

stefanprodan commented 2 months ago

Kubernetes client-go and controller-runtime have forced us to bump Go to 1.22.0. Some packages may not need it, but for consistency we have moved them all to Go 1.22. You can use an older version of gittestserver if you can't upgrade your toolchain to 1.22.

squaremo commented 2 months ago

You can use an older version of gittestserver if you can't upgrade your toolchain to 1.22.

Yes, that's a good point! Thanks Stefan.

(I am interested to see how the mandatory toolchain version plays out. I think people previously took it to mean something like "you have to use this version", without that being the case practically. So it probably lines up better with people's assumptions. On the other hand, the situation you've run into, and the situation I have now -- what a pain!)

stefanprodan commented 2 months ago

The new toolchain directive introduced by the Go 1.21 compiler in go.mod messes up things really bad. Basically we are now forced into bumping the minor.patch version every time Kubernetes or any of our deps does it, otherwise go.mod becomes dirty at build time.