Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a version of Go
"VARIANT": "1.22",
"VARIANT": "1.23",
// Options
"INSTALL_NODE": "false",
"NODE_VERSION": "lts/*"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/prebid/prebid-server/v3

go 1.21
go 1.23
Copy link
Contributor

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.

Copy link
Contributor Author

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"?

Copy link
Contributor Author

@scr-oath scr-oath Dec 13, 2024

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.

Copy link
Contributor Author

@scr-oath scr-oath Dec 13, 2024

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) {

Copy link
Contributor

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.


retract v3.0.0 // Forgot to update major version in import path and module name

Expand Down
Loading