Skip to content

Changes for Go version upgrade 1.24 #1123

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

Open
wants to merge 2 commits into
base: ci
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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.23",
"VARIANT": "1.24",
// Options
"INSTALL_NODE": "false",
"NODE_VERSION": "lts/*"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/adapter-code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.23.0
go-version: 1.24.0

- name: Checkout Code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.23.0
go-version: 1.24.0

- name: Checkout Merged Branch
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
validate:
strategy:
matrix:
go-version: [1.23.x]
go-version: [1.24.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ RUN apt-get update && \
apt-get -y upgrade && \
apt-get install -y wget
WORKDIR /tmp
RUN wget https://dl.google.com/go/go1.23.0.linux-amd64.tar.gz && \
tar -xf go1.23.0.linux-amd64.tar.gz && \
RUN wget https://dl.google.com/go/go1.24.0.linux-amd64.tar.gz && \
tar -xf go1.24.0.linux-amd64.tar.gz && \
mv go /usr/local
RUN mkdir -p /app/prebid-server/
WORKDIR /app/prebid-server/
Expand Down
6 changes: 3 additions & 3 deletions adapters/adapterstest/adapter_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ func SampleBid(width *int64, height *int64, impId string, index int) openrtb2.Bi
// VerifyStringValue Helper function to assert string equals.
func VerifyStringValue(value string, expected string, t *testing.T) {
if value != expected {
t.Fatalf(fmt.Sprintf("%s expected, got %s", expected, value))
t.Fatalf("%s expected, got %s", expected, value)
}
}

// VerifyIntValue Helper function to assert Int equals.
func VerifyIntValue(value int, expected int, t *testing.T) {
if value != expected {
t.Fatalf(fmt.Sprintf("%d expected, got %d", expected, value))
t.Fatalf("%d expected, got %d", expected, value)
}
}

// VerifyBoolValue Helper function to assert bool equals.
func VerifyBoolValue(value bool, expected bool, t *testing.T) {
if value != expected {
t.Fatalf(fmt.Sprintf("%v expected, got %v", expected, value))
t.Fatalf("%v expected, got %v", expected, value)
}
}

Expand Down
6 changes: 3 additions & 3 deletions adapters/ortbbidder/multi_request_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (rb *multiRequestBuilder) makeRequest() (requestData []*adapters.RequestDat
//step 1: clone request
if requestCloneRequired {
if newRequest, err = cloneRequest(rb.rawRequest); err != nil {
errs = append(errs, util.NewBadInputError(err.Error()))
errs = append(errs, util.NewBadInputError("%s", err.Error()))
continue
}
}
Expand All @@ -68,7 +68,7 @@ func (rb *multiRequestBuilder) makeRequest() (requestData []*adapters.RequestDat

//step 3: get endpoint
if endpoint, err = rb.getEndpoint(bidderParams); err != nil {
errs = append(errs, util.NewBadInputError(err.Error()))
errs = append(errs, util.NewBadInputError("%s", err.Error()))
continue
}

Expand All @@ -82,7 +82,7 @@ func (rb *multiRequestBuilder) makeRequest() (requestData []*adapters.RequestDat
}
//step 5: append new request data
if requestData, err = appendRequestData(requestData, newRequest, endpoint, []string{imp[idKey].(string)}); err != nil {
errs = append(errs, util.NewBadInputError(err.Error()))
errs = append(errs, util.NewBadInputError("%s", err.Error()))
}
}
return requestData, errs
Expand Down
4 changes: 2 additions & 2 deletions adapters/ortbbidder/ortbbidder.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co
// MakeRequests prepares oRTB bidder-specific request information using which prebid server make call(s) to bidder.
func (o *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
if o.bidderParamsConfig == nil {
return nil, []error{util.NewBadInputError(util.ErrNilBidderParamCfg.Error())}
return nil, []error{util.NewBadInputError("%s", util.ErrNilBidderParamCfg.Error())}
}

requestBuilder := newRequestBuilder(
Expand All @@ -73,7 +73,7 @@ func (o *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte
o.bidderParamsConfig.GetRequestParams(o.bidderName.String()))

if err := requestBuilder.parseRequest(request); err != nil {
return nil, []error{util.NewBadInputError(err.Error())}
return nil, []error{util.NewBadInputError("%s", err.Error())}
}

return requestBuilder.makeRequest()
Expand Down
2 changes: 1 addition & 1 deletion adapters/ortbbidder/ortbbidder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func TestMakeRequests(t *testing.T) {
bidderCfg: bidderparams.NewBidderConfig(),
},
want: want{
errors: []error{util.NewBadInputError(util.ErrImpMissing.Error())},
errors: []error{util.NewBadInputError("%s", util.ErrImpMissing.Error())},
},
},
{
Expand Down
8 changes: 4 additions & 4 deletions adapters/ortbbidder/response_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (rb *responseBuilder) setPrebidBidderResponse(bidderResponseBytes json.RawM

err := jsonutil.UnmarshalValid(bidderResponseBytes, &rb.bidderResponse)
if err != nil {
return []error{util.NewBadServerResponseError(err.Error())}
return []error{util.NewBadServerResponseError("%s", err.Error())}
}
// Create a new ParamResolver with the bidder response.
paramResolver := resolver.New(rb.request, rb.bidderResponse)
Expand Down Expand Up @@ -101,12 +101,12 @@ func (rb *responseBuilder) buildAdapterResponse() (resp *adapters.BidderResponse
var adapterResponeBytes json.RawMessage
adapterResponeBytes, err = jsonutil.Marshal(rb.adapterRespone)
if err != nil {
return nil, util.NewBadServerResponseError(err.Error())
return nil, util.NewBadServerResponseError("%s", err.Error())
}

err = jsonutil.UnmarshalValid(adapterResponeBytes, &resp)
if err != nil {
return nil, util.NewBadServerResponseError(err.Error())
return nil, util.NewBadServerResponseError("%s", err.Error())
}
return
}
Expand All @@ -120,7 +120,7 @@ func collectWarningMessages(errs, resolverErrors []error, parameter string, isDe
errs = append(errs, util.NewWarning("Potential issue encountered while setting the response parameter [%s]", parameter))
return errs
}
errs = append(errs, util.NewWarning(err.Error()))
errs = append(errs, util.NewWarning("%s", err.Error()))
}
}
return errs
Expand Down
6 changes: 3 additions & 3 deletions adapters/ortbbidder/single_request_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (rb *singleRequestBuilder) parseRequest(request *openrtb2.BidRequest) (err
// it create single RequestData object for all impressions.
func (rb *singleRequestBuilder) makeRequest() (requestData []*adapters.RequestData, errs []error) {
if len(rb.imps) == 0 {
errs = append(errs, util.NewBadInputError(util.ErrImpMissing.Error()))
errs = append(errs, util.NewBadInputError("%s", util.ErrImpMissing.Error()))
return
}

Expand All @@ -63,7 +63,7 @@ func (rb *singleRequestBuilder) makeRequest() (requestData []*adapters.RequestDa

//step 1: get endpoint
if endpoint, err = rb.getEndpoint(getImpExtBidderParams(rb.imps[0])); err != nil {
errs = append(errs, util.NewBadInputError(err.Error()))
errs = append(errs, util.NewBadInputError("%s", err.Error()))
return
}

Expand All @@ -76,7 +76,7 @@ func (rb *singleRequestBuilder) makeRequest() (requestData []*adapters.RequestDa

//step 3: append new request data
if requestData, err = appendRequestData(requestData, rb.newRequest, endpoint, rb.impIDs); err != nil {
errs = append(errs, util.NewBadInputError(err.Error()))
errs = append(errs, util.NewBadInputError("%s", err.Error()))
}
return
}
2 changes: 1 addition & 1 deletion adapters/ortbbidder/single_request_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TestSingleRequestBuilderMakeRequest(t *testing.T) {
},
want: want{
requestData: nil,
errs: []error{util.NewBadInputError(util.ErrImpMissing.Error())},
errs: []error{util.NewBadInputError("%s", util.ErrImpMissing.Error())},
},
},
{
Expand Down
24 changes: 21 additions & 3 deletions adapters/ortbbidder/util/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,37 @@ var (
)

func NewBadInputError(message string, args ...any) error {
var msg string
if len(args) > 0 {
msg = fmt.Sprintf(message, args...)
} else {
msg = message
}
return &errortypes.BadInput{
Message: fmt.Sprintf(message, args...),
Message: msg,
}
}

func NewBadServerResponseError(message string, args ...any) error {
var msg string
if len(args) > 0 {
msg = fmt.Sprintf(message, args...)
} else {
msg = message
}
return &errortypes.BadServerResponse{
Message: fmt.Sprintf(message, args...),
Message: msg,
}
}

func NewWarning(message string, args ...any) error {
var msg string
if len(args) > 0 {
msg = fmt.Sprintf(message, args...)
} else {
msg = message
}
return &errortypes.Warning{
Message: fmt.Sprintf(message, args...),
Message: msg,
}
}
2 changes: 1 addition & 1 deletion endpoints/openrtb2/amp_auction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3057,7 +3057,7 @@ func TestAmpAuctionDebugWarningsOnly(t *testing.T) {
)

for _, test := range testCases {
httpReq := httptest.NewRequest("GET", fmt.Sprintf("/openrtb2/auction/amp"+test.requestURLArguments), nil)
httpReq := httptest.NewRequest("GET", fmt.Sprintf("%s", "/openrtb2/auction/amp"+test.requestURLArguments), nil)
test.addRequestHeaders(httpReq)
recorder := httptest.NewRecorder()

Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/PubMatic-OpenWrap/prebid-server/v3

go 1.23
go 1.24

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

Expand Down Expand Up @@ -94,7 +94,6 @@ require (
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
github.com/yudai/pp v2.0.1+incompatible // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/sys v0.28.0 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func handleAuctionRequestHook(ctx hookstage.ModuleInvocationContext, deviceDetec

result, err := hydrateFields(deviceInfo, rawPayload)
if err != nil {
return rawPayload, hookexecution.NewFailure(fmt.Sprintf("error hydrating fields %s", err))
return rawPayload, hookexecution.NewFailure("%s", fmt.Sprintf("error hydrating fields %s", err))
}

return result, nil
Expand Down
8 changes: 4 additions & 4 deletions modules/pubmatic/openwrap/metrics/stats/tcp_stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,9 +722,9 @@ func TestRecordFunctions(t *testing.T) {
},
want: want{
expectedkeyVal: map[string]int{
fmt.Sprintf(statKeys[statsKeyAMPBadRequests]): 1,
fmt.Sprintf(statKeys[statsKeyVideoBadRequests]): 1,
fmt.Sprintf(statKeys[statsKey25BadRequests]): 1,
fmt.Sprintf("%s", statKeys[statsKeyAMPBadRequests]): 1,
fmt.Sprintf("%s", statKeys[statsKeyVideoBadRequests]): 1,
fmt.Sprintf("%s", statKeys[statsKey25BadRequests]): 1,
fmt.Sprintf(statKeys[statsKeyCTVBadRequests], "json", 100): 1,
fmt.Sprintf(statKeys[statsKeyCTVBadRequests], "openwrap", 200): 1,
fmt.Sprintf(statKeys[statsKeyCTVBadRequests], "ortb", 300): 1,
Expand Down Expand Up @@ -949,7 +949,7 @@ func TestRecordFunctions(t *testing.T) {
},
want: want{
expectedkeyVal: map[string]int{
fmt.Sprintf(statKeys[statsKeyPBSAuctionRequests]): 1,
fmt.Sprintf("%s", statKeys[statsKeyPBSAuctionRequests]): 1,
},
channelSize: 1,
},
Expand Down
Loading