From 7987f330fb6b30a539ab2531d494003a1c3e69cc Mon Sep 17 00:00:00 2001 From: Sean Lin Date: Thu, 2 Jun 2022 20:01:43 -0700 Subject: [PATCH] Go 1.16 -> Go 1.18 (#266) Signed-off-by: Sean Lin --- flyteplugins/.github/workflows/master.yml | 14 +-- .../.github/workflows/pull_request.yml | 18 ++- flyteplugins/go.mod | 108 ++++++++++++++++-- flyteplugins/go.sum | 1 - .../flytek8s/k8s_resource_adds_test.go | 3 +- .../plugins/array/k8s/subtask_exec_context.go | 12 +- 6 files changed, 114 insertions(+), 42 deletions(-) diff --git a/flyteplugins/.github/workflows/master.yml b/flyteplugins/.github/workflows/master.yml index bf25533eb..c3483d010 100644 --- a/flyteplugins/.github/workflows/master.yml +++ b/flyteplugins/.github/workflows/master.yml @@ -34,7 +34,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.14 + go-version: '1.18' - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: @@ -50,11 +50,7 @@ jobs: with: fetch-depth: "0" - name: Unit Tests - uses: cedrickring/golang-action@1.7.0 - env: - GO111MODULE: "on" - with: - args: make install && make test_unit_codecov + run: make install && make test_unit_codecov - name: Push CodeCov uses: codecov/codecov-action@v1 with: @@ -62,8 +58,4 @@ jobs: flags: unittests fail_ci_if_error: true - name: Lint - uses: cedrickring/golang-action@1.7.0 - env: - GO111MODULE: "on" - with: - args: make install && make lint + run: make install && make lint diff --git a/flyteplugins/.github/workflows/pull_request.yml b/flyteplugins/.github/workflows/pull_request.yml index 35bf213f0..c6c000639 100644 --- a/flyteplugins/.github/workflows/pull_request.yml +++ b/flyteplugins/.github/workflows/pull_request.yml @@ -9,12 +9,12 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Unit Tests - uses: cedrickring/golang-action@1.7.0 - env: - GO111MODULE: "on" + - name: Set up Go + uses: actions/setup-go@v2 with: - args: make install && make test_unit_codecov + go-version: '1.18' + - name: Unit Tests + run: make install && make test_unit_codecov - name: Push CodeCov uses: codecov/codecov-action@v1 with: @@ -22,11 +22,7 @@ jobs: flags: unittests fail_ci_if_error: true - name: Lint - uses: cedrickring/golang-action@1.7.0 - env: - GO111MODULE: "on" - with: - args: make install && make lint + run: make install && make lint generate: runs-on: ubuntu-latest @@ -34,6 +30,6 @@ jobs: - uses: actions/checkout@v1 - uses: actions/setup-go@v2 with: - go-version: '1.16' + go-version: '1.18' - name: Go generate and diff run: DELTA_CHECK=true make generate diff --git a/flyteplugins/go.mod b/flyteplugins/go.mod index 400ced060..6b0e51cb4 100644 --- a/flyteplugins/go.mod +++ b/flyteplugins/go.mod @@ -1,12 +1,10 @@ module github.com/flyteorg/flyteplugins -go 1.16 +go 1.18 require ( - cloud.google.com/go v0.78.0 // indirect github.com/GoogleCloudPlatform/spark-on-k8s-operator v0.0.0-20200723154620-6f35a1152625 github.com/Masterminds/semver v1.5.0 - github.com/adammck/venv v0.0.0-20200610172036-e77789703e7c // indirect github.com/aws/amazon-sagemaker-operator-for-k8s v1.0.1-0.20210303003444-0fb33b1fd49d github.com/aws/aws-sdk-go v1.37.3 github.com/aws/aws-sdk-go-v2 v1.2.0 @@ -15,11 +13,8 @@ require ( github.com/coocood/freecache v1.1.1 github.com/flyteorg/flyteidl v1.0.0 github.com/flyteorg/flytestdlib v1.0.0 - github.com/go-logr/zapr v0.4.0 // indirect github.com/go-test/deep v1.0.7 github.com/golang/protobuf v1.4.3 - github.com/google/gofuzz v1.2.0 // indirect - github.com/google/uuid v1.2.0 // indirect github.com/hashicorp/golang-lru v0.5.4 github.com/imdario/mergo v0.3.11 github.com/kubeflow/common v0.4.0 @@ -32,12 +27,8 @@ require ( github.com/prometheus/client_golang v1.10.0 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.7.0 - go.uber.org/multierr v1.6.0 // indirect - go.uber.org/zap v1.16.0 // indirect golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93 - golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect - golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect google.golang.org/api v0.40.0 google.golang.org/grpc v1.35.0 google.golang.org/protobuf v1.25.0 @@ -49,4 +40,101 @@ require ( sigs.k8s.io/controller-runtime v0.8.2 ) +require ( + cloud.google.com/go v0.78.0 // indirect + cloud.google.com/go/storage v1.12.0 // indirect + github.com/Azure/azure-sdk-for-go v62.3.0+incompatible // indirect + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 // indirect + github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0 // indirect + github.com/Azure/go-autorest v14.2.0+incompatible // indirect + github.com/Azure/go-autorest/autorest v0.11.17 // indirect + github.com/Azure/go-autorest/autorest/adal v0.9.10 // indirect + github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect + github.com/Azure/go-autorest/logger v0.2.0 // indirect + github.com/Azure/go-autorest/tracing v0.6.0 // indirect + github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect + github.com/adammck/venv v0.0.0-20200610172036-e77789703e7c // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.0.0 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.0 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.0 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.0.0 // indirect + github.com/aws/smithy-go v1.1.0 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash v1.1.0 // indirect + github.com/cespare/xxhash/v2 v2.1.1 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/emicklei/go-restful v2.9.6+incompatible // indirect + github.com/evanphx/json-patch v4.9.0+incompatible // indirect + github.com/fatih/color v1.10.0 // indirect + github.com/flyteorg/stow v0.3.3 // indirect + github.com/form3tech-oss/jwt-go v3.2.2+incompatible // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/ghodss/yaml v1.0.0 // indirect + github.com/go-logr/logr v0.4.0 // indirect + github.com/go-logr/zapr v0.4.0 // indirect + github.com/go-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/jsonreference v0.19.5 // indirect + github.com/go-openapi/spec v0.20.3 // indirect + github.com/go-openapi/swag v0.19.14 // indirect + github.com/gofrs/uuid v4.2.0+incompatible // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect + github.com/google/go-cmp v0.5.6 // indirect + github.com/google/gofuzz v1.2.0 // indirect + github.com/google/uuid v1.2.0 // indirect + github.com/googleapis/gax-go/v2 v2.0.5 // indirect + github.com/googleapis/gnostic v0.5.1 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.10 // indirect + github.com/jstemmer/go-junit-report v0.9.1 // indirect + github.com/mailru/easyjson v0.7.6 // indirect + github.com/mattn/go-colorable v0.1.8 // indirect + github.com/mattn/go-isatty v0.0.12 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/ncw/swift v1.0.53 // indirect + github.com/pelletier/go-toml v1.8.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.18.0 // indirect + github.com/prometheus/procfs v0.6.0 // indirect + github.com/sirupsen/logrus v1.7.0 // indirect + github.com/spf13/afero v1.5.1 // indirect + github.com/spf13/cast v1.3.1 // indirect + github.com/spf13/cobra v1.1.1 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/viper v1.7.1 // indirect + github.com/stretchr/objx v0.3.0 // indirect + github.com/subosito/gotenv v1.2.0 // indirect + go.opencensus.io v0.22.6 // indirect + go.uber.org/atomic v1.7.0 // indirect + go.uber.org/multierr v1.6.0 // indirect + go.uber.org/zap v1.16.0 // indirect + golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect + golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect + golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect + golang.org/x/text v0.3.7 // indirect + golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect + golang.org/x/tools v0.1.10 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/ini.v1 v1.62.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + k8s.io/klog/v2 v2.5.0 // indirect + k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.0.3 // indirect + sigs.k8s.io/yaml v1.2.0 // indirect +) + replace github.com/aws/amazon-sagemaker-operator-for-k8s => github.com/aws/amazon-sagemaker-operator-for-k8s v1.0.1-0.20210303003444-0fb33b1fd49d diff --git a/flyteplugins/go.sum b/flyteplugins/go.sum index d95f05373..35baa7271 100644 --- a/flyteplugins/go.sum +++ b/flyteplugins/go.sum @@ -1331,7 +1331,6 @@ k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8 k8s.io/gengo v0.0.0-20201113003025-83324d819ded/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= diff --git a/flyteplugins/go/tasks/pluginmachinery/flytek8s/k8s_resource_adds_test.go b/flyteplugins/go/tasks/pluginmachinery/flytek8s/k8s_resource_adds_test.go index 781cdbf41..e560c2b43 100755 --- a/flyteplugins/go/tasks/pluginmachinery/flytek8s/k8s_resource_adds_test.go +++ b/flyteplugins/go/tasks/pluginmachinery/flytek8s/k8s_resource_adds_test.go @@ -2,7 +2,6 @@ package flytek8s import ( "context" - "fmt" "os" "reflect" "testing" @@ -250,7 +249,7 @@ func TestDecorateEnvVars(t *testing.T) { originalEnvVal := os.Getenv("value") err := os.Setenv("value", "v") if err != nil { - t.Fatal(fmt.Sprintf("failed to set env var 'value'; %v", err)) + t.Fatalf("failed to set env var 'value'; %v", err) } defer os.Setenv("value", originalEnvVal) diff --git a/flyteplugins/go/tasks/plugins/array/k8s/subtask_exec_context.go b/flyteplugins/go/tasks/plugins/array/k8s/subtask_exec_context.go index 37e2f3460..0eb0a92e8 100644 --- a/flyteplugins/go/tasks/plugins/array/k8s/subtask_exec_context.go +++ b/flyteplugins/go/tasks/plugins/array/k8s/subtask_exec_context.go @@ -63,13 +63,11 @@ func NewSubTaskExecutionContext(ctx context.Context, tCtx pluginsCore.TaskExecut subtaskTemplate := &core.TaskTemplate{} *subtaskTemplate = *taskTemplate - if subtaskTemplate != nil { - subtaskTemplate.TaskTypeVersion = 2 - if subtaskTemplate.GetContainer() != nil { - subtaskTemplate.Type = podPlugin.ContainerTaskType - } else if taskTemplate.GetK8SPod() != nil { - subtaskTemplate.Type = podPlugin.SidecarTaskType - } + subtaskTemplate.TaskTypeVersion = 2 + if subtaskTemplate.GetContainer() != nil { + subtaskTemplate.Type = podPlugin.ContainerTaskType + } else if taskTemplate.GetK8SPod() != nil { + subtaskTemplate.Type = podPlugin.SidecarTaskType } arrayInputReader := array.GetInputReader(tCtx, taskTemplate)