Skip to content

deps: Go update to 1.24, updated golang.org/x/net and golang.org/x/crypto to the latest versions#4651

Open
shepilov wants to merge 1 commit intomasterfrom
deps_go_and_dependencies_update
Open

deps: Go update to 1.24, updated golang.org/x/net and golang.org/x/crypto to the latest versions#4651
shepilov wants to merge 1 commit intomasterfrom
deps_go_and_dependencies_update

Conversation

@shepilov
Copy link
Contributor

@shepilov shepilov commented Jan 27, 2026

To avoid such kind of lib warning, interface wrapper was added

 pkg/i18n/i18n.go:54:24: non-constant format string in call to (*github.com/leonelquinteros/gotext.Po).Get

rand.Seed() is deprecated now

removes deprecated configuration from golint config

relevant breaking changes:

  • shared loop variables now have per-iteration scope(No Loop Variable Capture in Closure)

@shepilov shepilov requested a review from a team as a code owner January 27, 2026 14:11
@shepilov shepilov force-pushed the deps_go_and_dependencies_update branch 4 times, most recently from ad97692 to dce4b17 Compare January 27, 2026 14:40
@shepilov shepilov changed the title deps: Go update to 1.25, updated golang.org/x/net and golang.org/x/crypto to the latest versions deps: Go update to 1.24, updated golang.org/x/net and golang.org/x/crypto to the latest versions Jan 27, 2026
@shepilov shepilov force-pushed the deps_go_and_dependencies_update branch from dce4b17 to 01b9468 Compare January 27, 2026 14:44
Copy link
Member

@taratatach taratatach left a comment

Choose a reason for hiding this comment

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

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"
Copy link
Member

Choose a reason for hiding this comment

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

Why are we moving back to go 1.24 here while we were using 1.25?

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've experimented with compatibility between different go-lint and golangci-lint-action versions, and golangci-lint 1.64 doesn't support go 1.25

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will be back when we go to golangci-lint v2

}

func getTranslation(t translator, key string) string {
return t.Get(key)
Copy link
Member

Choose a reason for hiding this comment

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

I didn't known we could use currying in go!

Comment on lines 13 to 33
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)
Copy link
Member

Choose a reason for hiding this comment

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

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()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the init function is not needed; the global random generator is automatically seeded at startup since go 1.20

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

@shepilov shepilov force-pushed the deps_go_and_dependencies_update branch from 01b9468 to 71ef2e8 Compare February 4, 2026 11:29
@shepilov shepilov force-pushed the deps_go_and_dependencies_update branch from 71ef2e8 to 9502382 Compare February 4, 2026 13:11
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.

2 participants