Skip to content

Commit

Permalink
chore: upgrade go to 1.23.0 (#5052)
Browse files Browse the repository at this point in the history
  • Loading branch information
cisse21 committed Sep 3, 2024
1 parent 66edcfb commit 8da3748
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.57.1
version: v1.60.3
args: -v
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# syntax=docker/dockerfile:1

# GO_VERSION is updated automatically to match go.mod, see Makefile
ARG GO_VERSION=1.22.5
ARG GO_VERSION=1.23.0
ARG ALPINE_VERSION=3.20
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder
ARG VERSION
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ TESTFILE=_testok
MOUNT_PATH=/local

# go tools versions
GOLANGCI=github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.1
GOLANGCI=github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3
gofumpt=mvdan.cc/gofumpt@latest
govulncheck=golang.org/x/vuln/cmd/govulncheck@latest
goimports=golang.org/x/tools/cmd/goimports@latest
Expand Down
12 changes: 6 additions & 6 deletions cmd/rudder-cli/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ func GetArgs(request string) error {
if request == "Jobs between JobID's of a User" {
fmt.Printf("Enter DS Type:")
var table string
fmt.Scanf("%s", &table)
_, _ = fmt.Scanf("%s", &table)
fmt.Print("Enter JobID 1: ")
var input string
fmt.Scanf("%s", &input)
_, _ = fmt.Scanf("%s", &input)
fmt.Print("Enter JobID 2: ")
var input2 string
fmt.Scanf("%s", &input2)
_, _ = fmt.Scanf("%s", &input2)
fmt.Printf("Enter UserID:")
var input3 string
fmt.Scanf("%s", &input3)
_, _ = fmt.Scanf("%s", &input3)
argString := table + ":" + request + ":" + input + ":" + input2 + ":" + input3
var reply string
err := client.GetUDSClient().Call("JobsdbUtilsHandler.RunSQLQuery", argString, &reply)
Expand All @@ -120,10 +120,10 @@ func GetArgs(request string) error {
} else if request == "Error Code Count By Destination" {
fmt.Printf("Enter DS Type:")
var table string
fmt.Scanf("%s", &table)
_, _ = fmt.Scanf("%s", &table)
fmt.Print("Enter DS Number: ")
var dsNum string
fmt.Scanf("%s", &dsNum)
_, _ = fmt.Scanf("%s", &dsNum)
argString := table + ":" + request + ":" + dsNum
var reply string
err := client.GetUDSClient().Call("JobsdbUtilsHandler.RunSQLQuery", argString, &reply)
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/rudderlabs/rudder-server

go 1.22.5
go 1.23.0

// Addressing snyk vulnerabilities in indirect dependencies
// When upgrading a dependency, please make sure that
Expand Down
2 changes: 1 addition & 1 deletion regulation-worker/internal/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func TestGet(t *testing.T) {
path := r.URL.Path
require.Equal(t, tt.expectedPath, path)
time.Sleep(time.Duration(tt.serverDelay) * time.Millisecond)
fmt.Fprintf(w, tt.respBody)
_, _ = w.Write([]byte(tt.respBody))
}))
defer svr.Close()
httpClient := &http.Client{}
Expand Down
6 changes: 3 additions & 3 deletions regulation-worker/internal/delete/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func (m *APIManager) inactivateAuthStatus(destination *model.Destination, job mo
AuthStatus: oauth.AuthStatusInactive,
})
jobStatus.Status = model.JobStatusAborted
jobStatus.Error = fmt.Errorf(resp)
jobStatus.Error = errors.New(resp)
return jobStatus
}

Expand All @@ -289,7 +289,7 @@ func (m *APIManager) refreshOAuthToken(destination *model.Destination, job model
if refreshResponse.Err == oauth.REF_TOKEN_INVALID_GRANT {
// authStatus should be made inactive
m.inactivateAuthStatus(destination, job, oAuthDetail)
return fmt.Errorf(refreshResponse.ErrorMessage)
return errors.New(refreshResponse.ErrorMessage)
}

var refreshRespErr string
Expand Down Expand Up @@ -350,7 +350,7 @@ func (m *APIManager) PostResponse(ctx context.Context, params PostResponseParams
}
if authErrorCategory == common.CategoryAuthStatusInactive {
// Abort the regulation request
return model.JobStatus{Status: model.JobStatusAborted, Error: fmt.Errorf(string(params.responseBodyBytes))}
return model.JobStatus{Status: model.JobStatusAborted, Error: errors.New(string(params.responseBodyBytes))}
}
}
return jobStatus
Expand Down
5 changes: 3 additions & 2 deletions regulation-worker/internal/delete/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -711,8 +712,8 @@ var oauthTests = []oauthTestCases{
Response: `{"message": "AuthStatus toggle skipped as already request in-progress: (1234, 1001)"}`,
},
},
expectedDeleteStatus: model.JobStatus{Status: model.JobStatusAborted, Error: fmt.Errorf("problem with user permission or access/refresh token have been revoked")},
expectedDeleteStatus_OAuthV2: model.JobStatus{Status: model.JobStatusAborted, Error: fmt.Errorf(fmt.Sprintf(`[{"status":"failed","authErrorCategory": "%v", "error": "User does not have sufficient permissions"}]`, common.CategoryAuthStatusInactive))},
expectedDeleteStatus: model.JobStatus{Status: model.JobStatusAborted, Error: errors.New("problem with user permission or access/refresh token have been revoked")},
expectedDeleteStatus_OAuthV2: model.JobStatus{Status: model.JobStatusAborted, Error: fmt.Errorf(`[{"status":"failed","authErrorCategory": "%v", "error": "User does not have sufficient permissions"}]`, common.CategoryAuthStatusInactive)},
expectedPayload: `[{"jobId":"16","destType":"ga","config":{"authStatus":"active","rudderDeleteAccountId":"xyz"},"userAttributes":[{"email":"greymore@gmail.com","phone":"8463633841","userId":"203984798476"}]}]`,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package offline_conversions
import (
"archive/zip"
stdjson "encoding/json"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -137,9 +138,9 @@ var _ = Describe("Bing ads Offline Conversions", func() {
clientI := Client{}
bulkUploader := NewBingAdsBulkUploader("BING_ADS", bingAdsService, &clientI)
errorMsg := "Error in getting bulk upload url"
bingAdsService.EXPECT().GetBulkUploadUrl().Return(nil, fmt.Errorf(errorMsg))
bingAdsService.EXPECT().GetBulkUploadUrl().Return(nil, fmt.Errorf(errorMsg))
bingAdsService.EXPECT().GetBulkUploadUrl().Return(nil, fmt.Errorf(errorMsg))
bingAdsService.EXPECT().GetBulkUploadUrl().Return(nil, errors.New(errorMsg))
bingAdsService.EXPECT().GetBulkUploadUrl().Return(nil, errors.New(errorMsg))
bingAdsService.EXPECT().GetBulkUploadUrl().Return(nil, errors.New(errorMsg))

asyncDestination := common.AsyncDestinationStruct{
ImportingJobIDs: []int64{1, 2, 3, 4, 5, 6},
Expand Down Expand Up @@ -180,11 +181,11 @@ var _ = Describe("Bing ads Offline Conversions", func() {
ClientI := Client{}
bulkUploader := NewBingAdsBulkUploader("BING_ADS", bingAdsService, &ClientI)
errMsg := "unable to get bulk upload url, check your credentials"
bingAdsService.EXPECT().GetBulkUploadUrl().Return(nil, fmt.Errorf(errMsg))
bingAdsService.EXPECT().GetBulkUploadUrl().Return(nil, errors.New(errMsg))

bingAdsService.EXPECT().GetBulkUploadUrl().Return(nil, fmt.Errorf(errMsg))
bingAdsService.EXPECT().GetBulkUploadUrl().Return(nil, errors.New(errMsg))

bingAdsService.EXPECT().GetBulkUploadUrl().Return(nil, fmt.Errorf(errMsg))
bingAdsService.EXPECT().GetBulkUploadUrl().Return(nil, errors.New(errMsg))

asyncDestination := common.AsyncDestinationStruct{
ImportingJobIDs: []int64{1, 2, 3, 4, 5, 6},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package klaviyobulkupload
import (
"bufio"
"bytes"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -375,7 +376,7 @@ func (kbu *KlaviyoBulkUploader) Upload(asyncDestStruct *common.AsyncDestinationS

if resp.StatusCode != 202 {
failedJobs = append(failedJobs, importingJobIDs[idx])
kbu.logger.Error("Got non 202 as statusCode.", fmt.Errorf(string(bodyBytes)))
kbu.logger.Error("Got non 202 as statusCode.", errors.New(string(bodyBytes)))
}
var uploadresp UploadResp
uploadRespErr := json.Unmarshal((bodyBytes), &uploadresp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package yandexmetrica
import (
"bytes"
"encoding/csv"
"errors"
"fmt"
"io"
"mime/multipart"
Expand Down Expand Up @@ -361,7 +362,7 @@ func (ym *YandexMetricaBulkUploader) Upload(asyncDestStruct *common.AsyncDestina
uploadTimeStat.Since(startTime)

if resp.StatusCode != http.StatusOK { // error scenario
return ym.generateErrorOutput("got non 200 response from the destination", fmt.Errorf(string(bodyBytes)), importingJobIDs)
return ym.generateErrorOutput("got non 200 response from the destination", errors.New(string(bodyBytes)), importingJobIDs)
}
eventsSuccessStat.Count(len(asyncDestStruct.ImportingJobIDs))
return common.AsyncUploadOutput{
Expand Down
3 changes: 2 additions & 1 deletion router/transformer/transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -597,7 +598,7 @@ func (trans *handle) doProxyRequest(ctx context.Context, proxyUrl string, proxyR
return httpProxyResponse{
respData: []byte{},
statusCode: http.StatusInternalServerError,
err: fmt.Errorf(errStr),
err: errors.New(errStr),
}
}

Expand Down
2 changes: 1 addition & 1 deletion services/streammanager/bqstream/bqstreammanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,5 @@ func (producer *BQStreamProducer) Close() error {
func createErr(err error, msg string) error {
fmtMsg := fmt.Errorf("[BQStream] error :: %v:: %w", msg, err).Error()
pkgLogger.Errorf(fmtMsg)
return fmt.Errorf(fmtMsg)
return errors.New(fmtMsg)
}
2 changes: 1 addition & 1 deletion suppression-backup-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1

# GO_VERSION is updated automatically to match go.mod, see Makefile
ARG GO_VERSION=1.22.5
ARG GO_VERSION=1.23.0
ARG ALPINE_VERSION=3.20
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder
RUN mkdir /app
Expand Down
2 changes: 1 addition & 1 deletion warehouse/integrations/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ func (pg *Postgres) Connect(_ context.Context, warehouse model.Warehouse) (clien
if warehouse.Destination.Config["sslMode"] == "verify-ca" {
if err := warehouseutils.WriteSSLKeys(warehouse.Destination); err.IsError() {
pg.logger.Error(err.Error())
return client.Client{}, fmt.Errorf(err.Error())
return client.Client{}, errors.New(err.Error())
}
}
pg.Warehouse = warehouse
Expand Down
3 changes: 2 additions & 1 deletion warehouse/internal/loadfiles/loadfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package loadfiles
import (
"context"
stdjson "encoding/json"
"errors"
"fmt"
"slices"
"strings"
Expand Down Expand Up @@ -291,7 +292,7 @@ func (lf *LoadFileGenerator) createFromStaging(ctx context.Context, job *model.U

if resp.Status == notifier.Aborted && resp.Error != nil {
lf.Logger.Errorf("[WH]: Error in generating load files: %v", resp.Error)
sampleError = fmt.Errorf(resp.Error.Error())
sampleError = errors.New(resp.Error.Error())
err = lf.StageRepo.SetErrorStatus(ctx, jobResponse.StagingFileID, sampleError)
if err != nil {
return fmt.Errorf("set staging file error status: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion warehouse/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ func TestObjectStorageType(t *testing.T) {
}

func TestGetTablePathInObjectStorage(t *testing.T) {
require.NoError(t, os.Setenv("WAREHOUSE_DATALAKE_FOLDER_NAME", "rudder-test-payload"))
t.Setenv("WAREHOUSE_DATALAKE_FOLDER_NAME", "rudder-test-payload")
inputs := []struct {
namespace string
tableName string
Expand Down
6 changes: 4 additions & 2 deletions warehouse/validations/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,10 @@ type dummyUploader struct {
dest *backendconfig.DestinationT
}

func (*dummyUploader) IsWarehouseSchemaEmpty() bool { return true }
func (*dummyUploader) GetLocalSchema(context.Context) (model.Schema, error) { return nil, nil }
func (*dummyUploader) IsWarehouseSchemaEmpty() bool { return true }
func (*dummyUploader) GetLocalSchema(context.Context) (model.Schema, error) {
return model.Schema{}, nil
}
func (*dummyUploader) UpdateLocalSchema(context.Context, model.Schema) error { return nil }
func (*dummyUploader) ShouldOnDedupUseNewRecord() bool { return false }
func (*dummyUploader) GetFirstLastEvent() (time.Time, time.Time) { return time.Time{}, time.Time{} }
Expand Down

0 comments on commit 8da3748

Please sign in to comment.