deps: Go update to 1.24, updated golang.org/x/net and golang.org/x/crypto to the latest versions#4651
deps: Go update to 1.24, updated golang.org/x/net and golang.org/x/crypto to the latest versions#4651
Conversation
ad97692 to
dce4b17
Compare
dce4b17 to
01b9468
Compare
taratatach
left a comment
There was a problem hiding this comment.
I believe we should update the go-tests workflow as well to use go 1.24 rather than 1.21?!
Or maybe 1.21 was kept around for a good reason which could also explain why go.mod was still using 1.21 as well?!
| with: | ||
| go-version: "1.25.x" | ||
| - uses: actions/checkout@v4 | ||
| go-version: "1.24.x" |
There was a problem hiding this comment.
Why are we moving back to go 1.24 here while we were using 1.25?
There was a problem hiding this comment.
I've experimented with compatibility between different go-lint and golangci-lint-action versions, and golangci-lint 1.64 doesn't support go 1.25
There was a problem hiding this comment.
It will be back when we go to golangci-lint v2
| } | ||
|
|
||
| func getTranslation(t translator, key string) string { | ||
| return t.Get(key) |
There was a problem hiding this comment.
I didn't known we could use currying in go!
pkg/utils/utils_test.go
Outdated
| rand.Seed(42) | ||
| // Test that RandomString returns strings of the correct length | ||
| s1 := RandomString(10) | ||
| s2 := RandomString(20) | ||
|
|
||
| rand.Seed(42) | ||
| s3 := RandomString(10) | ||
| s4 := RandomString(20) | ||
|
|
||
| assert.Len(t, s1, 10) | ||
| assert.Len(t, s2, 20) | ||
| assert.NotEqual(t, s1, s2) | ||
|
|
||
| // Test that RandomStringFast with same seed produces reproducible results | ||
| rng1 := rand.New(rand.NewSource(42)) | ||
| rng2 := rand.New(rand.NewSource(42)) | ||
|
|
||
| s3 := RandomStringFast(rng1, 10) | ||
| s4 := RandomStringFast(rng1, 20) | ||
| s5 := RandomStringFast(rng2, 10) | ||
| s6 := RandomStringFast(rng2, 20) | ||
|
|
||
| assert.Len(t, s3, 10) | ||
| assert.Len(t, s4, 20) | ||
|
|
||
| assert.NotEqual(t, s1, s2) | ||
| assert.Equal(t, s1, s3) | ||
| assert.Equal(t, s2, s4) | ||
| assert.Equal(t, s3, s5) | ||
| assert.Equal(t, s4, s6) |
There was a problem hiding this comment.
Are we really testing the same thing here? Because we're testing RandomStringFast with a seed rather than RandomString.
Besides, I see that rand.Seed() is still called in the package's init() method. Shouldn't it be replaced with a call to NewSource()?
There was a problem hiding this comment.
Yes, the init function is not needed; the global random generator is automatically seeded at startup since go 1.20
There was a problem hiding this comment.
And yes, the things are mixed here. I'll split them into two different tests:
- TestRandomString: strings have the correct length, different values
- TestRandomStringFast: correct length, same seed produces identical output
01b9468 to
71ef2e8
Compare
…ypto to the latest versions
71ef2e8 to
9502382
Compare
To avoid such kind of lib warning, interface wrapper was added
rand.Seed() is deprecated now
removes deprecated configuration from golint config
relevant breaking changes: