From 6021e195bc27829c10c22f82859ceef3658b2d14 Mon Sep 17 00:00:00 2001 From: Ash McKenzie <amckenzie@gitlab.com> Date: Thu, 15 Jun 2023 05:29:41 +0000 Subject: [PATCH] Update honnef.co/go/tools to 0.4.3 It's done to make it compatible with 1.20 Golang --- .gitlab-ci.yml | 2 +- .gitlab/ci/workhorse.gitlab-ci.yml | 4 ++-- workhorse/.tool-versions | 2 +- workhorse/go.mod | 4 ++-- workhorse/go.sum | 8 ++++---- workhorse/internal/httprs/httprs_test.go | 8 ++++---- .../upload/destination/objectstore/s3_session.go | 3 ++- .../upload/destination/objectstore/s3_session_test.go | 9 +++++---- 8 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a5c57b35f0897..63068cfee1b9f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -144,7 +144,7 @@ variables: DOCKER_VERSION: "23.0.1" RUBY_VERSION: "2.7" RUBYGEMS_VERSION: "3.4" - GO_VERSION: "1.19" + GO_VERSION: "1.20" RUST_VERSION: "1.65" FLAKY_RSPEC_SUITE_REPORT_PATH: rspec/flaky/report-suite.json diff --git a/.gitlab/ci/workhorse.gitlab-ci.yml b/.gitlab/ci/workhorse.gitlab-ci.yml index ae0b15bbdb8aa..603f67079c2a8 100644 --- a/.gitlab/ci/workhorse.gitlab-ci.yml +++ b/.gitlab/ci/workhorse.gitlab-ci.yml @@ -26,7 +26,7 @@ workhorse:test go: extends: .workhorse:test parallel: matrix: - - GO_VERSION: ["1.18", "1.19"] + - GO_VERSION: ["1.18", "1.19", "1.20"] script: - make -C workhorse test-coverage coverage: '/\d+.\d+%/' @@ -38,7 +38,7 @@ workhorse:test fips: extends: .workhorse:test parallel: matrix: - - GO_VERSION: ["1.18", "1.19"] + - GO_VERSION: ["1.18", "1.19", "1.20"] image: ${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images/ubi-${UBI_VERSION}-ruby-${RUBY_VERSION}-golang-${GO_VERSION}-rust-${RUST_VERSION}:rubygems-${RUBYGEMS_VERSION}-git-2.36-exiftool-12.60 variables: FIPS_MODE: 1 diff --git a/workhorse/.tool-versions b/workhorse/.tool-versions index 32603da96a7f8..e8249f49e4f9e 100644 --- a/workhorse/.tool-versions +++ b/workhorse/.tool-versions @@ -1 +1 @@ -golang 1.19.9 +golang 1.20.5 diff --git a/workhorse/go.mod b/workhorse/go.mod index 0b08b06d0ccab..7af290ad2668c 100644 --- a/workhorse/go.mod +++ b/workhorse/go.mod @@ -36,7 +36,7 @@ require ( golang.org/x/tools v0.8.0 google.golang.org/grpc v1.54.0 google.golang.org/protobuf v1.30.0 - honnef.co/go/tools v0.3.3 + honnef.co/go/tools v0.4.3 ) require ( @@ -110,7 +110,7 @@ require ( go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.10.0 // indirect golang.org/x/crypto v0.7.0 // indirect - golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e // indirect + golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a // indirect golang.org/x/mod v0.10.0 // indirect golang.org/x/sync v0.2.0 // indirect golang.org/x/sys v0.8.0 // indirect diff --git a/workhorse/go.sum b/workhorse/go.sum index 1cd4d274eef71..91dcc356e5696 100644 --- a/workhorse/go.sum +++ b/workhorse/go.sum @@ -2102,8 +2102,8 @@ golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMk golang.org/x/exp v0.0.0-20230108222341-4b8118a2686a/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/exp v0.0.0-20230124195608-d38c7dcee874/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o= -golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e h1:qyrTQ++p1afMkO4DPEeLGq/3oTsdlvdH4vqZUBWzUKM= -golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a h1:Jw5wfR+h9mnIYH+OtGT2im5wV1YGGDora5vTv/aa5bE= +golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -2929,8 +2929,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.3.3 h1:oDx7VAwstgpYpb3wv0oxiZlxY+foCpRAwY7Vk6XpAgA= -honnef.co/go/tools v0.3.3/go.mod h1:jzwdWgg7Jdq75wlfblQxO4neNaFFSvgc1tD5Wv8U0Yw= +honnef.co/go/tools v0.4.3 h1:o/n5/K5gXqk8Gozvs2cnL0F2S1/g1vcGCAx2vETjITw= +honnef.co/go/tools v0.4.3/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA= k8s.io/api v0.20.1/go.mod h1:KqwcCVogGxQY3nBlRpwt+wpAMF/KjaCc7RpywacvqUo= k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8= diff --git a/workhorse/internal/httprs/httprs_test.go b/workhorse/internal/httprs/httprs_test.go index 9dcfe75219bf0..8def6de09d92c 100644 --- a/workhorse/internal/httprs/httprs_test.go +++ b/workhorse/internal/httprs/httprs_test.go @@ -197,7 +197,7 @@ func testHttpReaderSeeker(t *testing.T, newRS RSFactory) { defer r.Close() buf := make([]byte, 4) io.ReadFull(r, buf) - s, err := r.Seek(4*64, os.SEEK_CUR) + s, err := r.Seek(4*64, io.SeekCurrent) So(s, ShouldEqual, 4*64+4) So(err, ShouldBeNil) n, err := io.ReadFull(r, buf) @@ -212,7 +212,7 @@ func testHttpReaderSeeker(t *testing.T, newRS RSFactory) { defer r.Close() buf := make([]byte, 4) io.ReadFull(r, buf) - s, err := r.Seek(4, os.SEEK_END) + s, err := r.Seek(4, io.SeekEnd) So(s, ShouldEqual, SZ*4-4) So(err, ShouldBeNil) n, err := io.ReadFull(r, buf) @@ -229,7 +229,7 @@ func testHttpReaderSeeker(t *testing.T, newRS RSFactory) { So(r.Requests, ShouldEqual, 0) io.ReadFull(r, buf) So(r.Requests, ShouldEqual, 1) - s, err := r.Seek(shortSeekBytes, os.SEEK_CUR) + s, err := r.Seek(shortSeekBytes, io.SeekCurrent) So(r.Requests, ShouldEqual, 1) So(s, ShouldEqual, shortSeekBytes+4) So(err, ShouldBeNil) @@ -248,7 +248,7 @@ func testHttpReaderSeeker(t *testing.T, newRS RSFactory) { So(r.Requests, ShouldEqual, 0) io.ReadFull(r, buf) So(r.Requests, ShouldEqual, 1) - s, err := r.Seek(shortSeekBytes+1, os.SEEK_CUR) + s, err := r.Seek(shortSeekBytes+1, io.SeekCurrent) So(r.Requests, ShouldEqual, 1) So(s, ShouldEqual, shortSeekBytes+4+1) So(err, ShouldBeNil) diff --git a/workhorse/internal/upload/destination/objectstore/s3_session.go b/workhorse/internal/upload/destination/objectstore/s3_session.go index e1fe6fbbdc963..168a80845bb57 100644 --- a/workhorse/internal/upload/destination/objectstore/s3_session.go +++ b/workhorse/internal/upload/destination/objectstore/s3_session.go @@ -8,6 +8,7 @@ import ( "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/endpoints" "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/s3" "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" @@ -76,7 +77,7 @@ func setupS3Session(s3Credentials config.S3Credentials, s3Config config.S3Config // the custom endpoint is only used for S3 API calls, and not // for STS API calls. s3CustomResolver := func(service, region string, optFns ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) { - if service == endpoints.S3ServiceID { + if service == s3.EndpointsID { return endpoints.ResolvedEndpoint{ URL: s3Config.Endpoint, SigningRegion: region, diff --git a/workhorse/internal/upload/destination/objectstore/s3_session_test.go b/workhorse/internal/upload/destination/objectstore/s3_session_test.go index b7bbee0ef6906..2329569b774c0 100644 --- a/workhorse/internal/upload/destination/objectstore/s3_session_test.go +++ b/workhorse/internal/upload/destination/objectstore/s3_session_test.go @@ -5,7 +5,8 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/endpoints" + "github.com/aws/aws-sdk-go/service/s3" + "github.com/aws/aws-sdk-go/service/sts" "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" @@ -20,7 +21,7 @@ func TestS3SessionSetup(t *testing.T) { sess, err := setupS3Session(credentials, cfg) require.NoError(t, err) - s3Config := sess.ClientConfig(endpoints.S3ServiceID) + s3Config := sess.ClientConfig(s3.EndpointsID) require.Equal(t, "https://s3.us-west-1.amazonaws.com", s3Config.Endpoint) require.Equal(t, "us-west-1", s3Config.SigningRegion) require.True(t, aws.BoolValue(sess.Config.S3ForcePathStyle)) @@ -44,11 +45,11 @@ func TestS3SessionEndpointSetup(t *testing.T) { require.NoError(t, err) // ClientConfig is what is ultimately used by an S3 client - s3Config := sess.ClientConfig(endpoints.S3ServiceID) + s3Config := sess.ClientConfig(s3.EndpointsID) require.Equal(t, customS3Endpoint, s3Config.Endpoint) require.Equal(t, region, s3Config.SigningRegion) - stsConfig := sess.ClientConfig(endpoints.StsServiceID) + stsConfig := sess.ClientConfig(sts.EndpointsID) require.Equal(t, "https://sts.amazonaws.com", stsConfig.Endpoint, "STS should use default endpoint") } -- GitLab