gkampitakis / go-snaps

Jest-like snapshot testing in Go 📸
https://pkg.go.dev/github.com/gkampitakis/go-snaps
MIT License
164 stars 6 forks source link

Why specify the exact go version (`1.21.0`) #93

Closed lolleko closed 8 months ago

lolleko commented 8 months ago

Issue

Hey just wondering why you specify the patch for go in go.mod go 1.21.0 https://github.com/gkampitakis/go-snaps/blob/main/go.mod#L3

AFAIK this will force all dependents to use your module that exact version. By "forcing" I mean the fact go mod tidy will bump my version from go 1.21 to go 1.21.0 after installing your package. Is there any reason why you need that specific patch?

gkampitakis commented 8 months ago

Hey 👋 , thanks for opening this issue. I don't recall any specific reason for using 1.21.0 patch. I didn't know for this interaction so this was probably an oversight on my side when I hanged the version to 1.21.0 instead of 1.21.

I will have a look if there is a reason I did that 😅 . I will also check if I can simlpiy put 1.21 and release a new version of go-snaps, that will fix it and not affect others.

lolleko commented 8 months ago

Hey, thank you for the quick reply.

It's not a big issue, It's just a bit annoying if the exact version is forced. For us, this caused some minor issues with our CI build.

For reference:

https://go.dev/ref/mod

At go 1.21 or higher:
- The go line declares a required minimum version of Go to use with this module.
- The go line must be greater than or equal to the go line of all dependencies.
- The go command no longer attempts to maintain compatibility with the previous older version of Go.
- The go command is more careful about keeping checksums of go.mod files in the go.sum file.
gkampitakis commented 8 months ago

💡 haaa this is what I missed. Thanks for posting this. So if I understand correct just putting 1.21 shouldn't affect anything just allow people to use whatever patch they want. Is that correct?