-
Notifications
You must be signed in to change notification settings - Fork 749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to go v1.22 #4102
base: master
Are you sure you want to change the base?
Upgrade to go v1.22 #4102
Conversation
scr-oath
commented
Dec 13, 2024
•
edited
Loading
edited
- One step towards Upgrade to go version 1.23 to bring in iter.Seq and other language improvements #4101
- Is blocker for New Metrics: Open Telemetry #4065
- Fixes prebid#4101
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are also references to the Go version in:
- \Dockerfile
- .github\workflows\adapter-code-coverage.yaml
- .github\workflows\validate-merge.yaml
- .github\workflows\validate.yaml
go.mod
Outdated
@@ -1,6 +1,6 @@ | |||
module github.com/prebid/prebid-server/v3 | |||
|
|||
go 1.21 | |||
go 1.23 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We target to support the previous two Go releases. Therefore, please bump this up to only version 1.22.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the "supporting two releases" done by choosing an older version? Do you mean, instead, that you always stay on the "previous release"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not setting to 1.23 means that we can't start using the iter package yet, which can make some utilities that improve walking, say… []Bid (by walking the pointers to the Bid rather than making a copy of them for each iteration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an example file we can add to an iterators module in util
package iterators
import "iter"
// SlicePointers returns an iterator that yields indices and pointers to the elements of a slice.
func SlicePointers[Slice ~[]T, T any](s Slice) iter.Seq2[int, *T] {
return func(yield func(int, *T) bool) {
for i := range s {
if !yield(i, &s[i]) {
break
}
}
}
}
// SlicePointerValues returns an iterator that yields pointers to the elements of a slice.
func SlicePointerValues[Slice ~[]T, T any](s Slice) iter.Seq[*T] {
return func(yield func(*T) bool) {
for i := range s {
if !yield(&s[i]) {
break
}
}
}
}
And then use a la
for seatBid := range iterators.SlicePointerValues(payload.BidResponse.SeatBid) {
for bid := range iterators.SlicePointerValues(seatBid.Bid) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the "supporting two releases" done by choosing an older version? Do you mean, instead, that you always stay on the "previous release"?
We build the Docker image using the latest version to take advantage of compiler / runtime improvements and restrict language features to the previous version.
Not setting to 1.23 means that we can't start using the iter package yet, which can make some utilities that improve walking, say… []Bid (by walking the pointers to the Bid rather than making a copy of them for each iteration.
Correct. We'll wait a little bit for those new features.