Skip to content

Commit

Permalink
fix errors reported by go vet (#2954)
Browse files Browse the repository at this point in the history
  • Loading branch information
onkarvhanumante authored Jul 20, 2023
1 parent 56de4d1 commit b0a9b2f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions adapters/bidder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ type mockConversions struct {
mock.Mock
}

func (m mockConversions) GetRate(from string, to string) (float64, error) {
func (m *mockConversions) GetRate(from string, to string) (float64, error) {
args := m.Called(from, to)
return args.Get(0).(float64), args.Error(1)
}

func (m mockConversions) GetRates() *map[string]map[string]float64 {
func (m *mockConversions) GetRates() *map[string]map[string]float64 {
args := m.Called()
return args.Get(0).(*map[string]map[string]float64)
}
4 changes: 2 additions & 2 deletions bidadjustment/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,12 @@ type mockConversions struct {
mock.Mock
}

func (m mockConversions) GetRate(from string, to string) (float64, error) {
func (m *mockConversions) GetRate(from string, to string) (float64, error) {
args := m.Called(from, to)
return args.Get(0).(float64), args.Error(1)
}

func (m mockConversions) GetRates() *map[string]map[string]float64 {
func (m *mockConversions) GetRates() *map[string]map[string]float64 {
args := m.Called()
return args.Get(0).(*map[string]map[string]float64)
}
Expand Down
6 changes: 3 additions & 3 deletions endpoints/openrtb2/amp_auction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestGoodAmpRequests(t *testing.T) {
continue
}

test.storedRequest = map[string]json.RawMessage{tagID: test.BidRequest}
test.StoredRequest = map[string]json.RawMessage{tagID: test.BidRequest}
test.endpointType = AMP_ENDPOINT

cfg := &config.Configuration{
Expand Down Expand Up @@ -165,7 +165,7 @@ func TestAccountErrors(t *testing.T) {
if !assert.NoError(t, json.Unmarshal(fileJsonData, &test), "Failed to unmarshal data from file: %s. Error: %v", tt.filename, err) {
continue
}
test.storedRequest = map[string]json.RawMessage{tt.storedReqID: test.BidRequest}
test.StoredRequest = map[string]json.RawMessage{tt.storedReqID: test.BidRequest}
test.endpointType = AMP_ENDPOINT

cfg := &config.Configuration{
Expand Down Expand Up @@ -2190,7 +2190,7 @@ func TestValidAmpResponseWhenRequestRejected(t *testing.T) {
query := request.URL.Query()
tagID := query.Get("tag_id")

test.storedRequest = map[string]json.RawMessage{tagID: test.BidRequest}
test.StoredRequest = map[string]json.RawMessage{tagID: test.BidRequest}
test.planBuilder = tc.planBuilder
test.endpointType = AMP_ENDPOINT

Expand Down
6 changes: 3 additions & 3 deletions endpoints/openrtb2/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type testCase struct {
ExpectedBidResponse json.RawMessage `json:"expectedBidResponse"`

// "/openrtb2/amp" endpoint JSON test info
storedRequest map[string]json.RawMessage `json:"mockAmpStoredRequest"`
StoredRequest map[string]json.RawMessage `json:"mockAmpStoredRequest"`
StoredResponse map[string]json.RawMessage `json:"mockAmpStoredResponse"`
ExpectedAmpResponse json.RawMessage `json:"expectedAmpResponse"`
}
Expand Down Expand Up @@ -1265,8 +1265,8 @@ func buildTestEndpoint(test testCase, cfg *config.Configuration) (httprouter.Han
testExchange, mockBidServersArray := buildTestExchange(test.Config, adapterMap, mockBidServersArray, mockCurrencyRatesServer, bidderInfos, cfg, met, mockFetcher)

var storedRequestFetcher stored_requests.Fetcher
if len(test.storedRequest) > 0 {
storedRequestFetcher = &mockAmpStoredReqFetcher{test.storedRequest}
if len(test.StoredRequest) > 0 {
storedRequestFetcher = &mockAmpStoredReqFetcher{test.StoredRequest}
} else {
storedRequestFetcher = &mockStoredReqFetcher{}
}
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

// Listen blocks forever, serving PBS requests on the given port. This will block forever, until the process is shut down.
func Listen(cfg *config.Configuration, handler http.Handler, adminHandler http.Handler, metrics *metricsconfig.DetailedMetricsEngine) (err error) {
stopSignals := make(chan os.Signal)
stopSignals := make(chan os.Signal, 1)
signal.Notify(stopSignals, syscall.SIGTERM, syscall.SIGINT)

// Run the servers. Fan any process-stopper signals out to each server for graceful shutdowns.
Expand Down

0 comments on commit b0a9b2f

Please sign in to comment.