Skip to content
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

chore: upgrade golang to 1.19 #2219

Merged
merged 7 commits into from
Oct 4, 2022
Merged
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 .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
- uses: actions/checkout@v2
- name: Setup k3s
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
- name: build
run: |
pip install mkdocs mkdocs_material
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- "master"
env:
# Golang version to use across CI steps
GOLANG_VERSION: '1.18'
GOLANG_VERSION: '1.19'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.47.2
version: v1.49.0
args: --timeout 5m
build:
name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
- name: Setup Golang
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19

- name: Generate release artifacts
run: |
Expand Down
4 changes: 1 addition & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ linters:
- vet
- gofmt
- goimports
- deadcode
- varcheck
- structcheck
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you confirm why removing varcheck, structcheck and deadcode? Is this all covered by unused I'm assuming?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are deprecated and have moved into unused.

- unused
- ineffassign
- unconvert
- misspell
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Initial stage which pulls prepares build dependencies and CLI tooling we need for our final image
# Also used as the image in CI jobs so needs all dependencies
####################################################################################################
FROM --platform=$BUILDPLATFORM golang:1.18 as builder
FROM --platform=$BUILDPLATFORM golang:1.19 as builder

RUN apt-get update && apt-get install -y \
wget \
Expand All @@ -12,7 +12,7 @@ RUN apt-get update && apt-get install -y \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install golangci-lint
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.47.2 && \
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0 && \
golangci-lint linters

COPY .golangci.yml ${GOPATH}/src/dummy/.golangci.yml
Expand Down Expand Up @@ -40,7 +40,7 @@ RUN NODE_ENV='production' yarn build
####################################################################################################
# Rollout Controller Build stage which performs the actual build of argo-rollouts binaries
####################################################################################################
FROM --platform=$BUILDPLATFORM golang:1.18 as argo-rollouts-build
FROM --platform=$BUILDPLATFORM golang:1.19 as argo-rollouts-build

WORKDIR /go/src/github.com/argoproj/argo-rollouts

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
####################################################################################################
# argo-rollouts-dev
####################################################################################################
FROM golang:1.17 as builder
FROM golang:1.19 as builder

RUN apt-get update && apt-get install -y \
ca-certificates && \
Expand Down
2 changes: 1 addition & 1 deletion analysis/analysis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ func TestSecretContentReferenceProviderError(t *testing.T) {
assert.True(t, strings.Contains(logMessage, "*****"))
}

//TestSecretContentReferenceAndMultipleArgResolutionSuccess verifies that both secret and non-secret arguments are resolved properly
// TestSecretContentReferenceAndMultipleArgResolutionSuccess verifies that both secret and non-secret arguments are resolved properly
func TestSecretContentReferenceAndMultipleArgResolutionSuccess(t *testing.T) {
f := newFixture(t)
secretName, secretKey, secretValue := "web-metric-secret", "apikey", "12345"
Expand Down
10 changes: 5 additions & 5 deletions analysis/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (f *fixture) run(analysisRunName string) {
f.runController(analysisRunName, true, false, c, i, k8sI)
}

func (f *fixture) runExpectError(analysisRunName string, startInformers bool) {
func (f *fixture) runExpectError(analysisRunName string, startInformers bool) { //nolint:unused
c, i, k8sI := f.newController(noResyncPeriodFunc)
f.runController(analysisRunName, startInformers, true, c, i, k8sI)
}
Expand Down Expand Up @@ -238,14 +238,14 @@ func filterInformerActions(actions []core.Action) []core.Action {
return ret
}

func (f *fixture) expectUpdateAnalysisRunAction(analysisRun *v1alpha1.AnalysisRun) int {
func (f *fixture) expectUpdateAnalysisRunAction(analysisRun *v1alpha1.AnalysisRun) int { //nolint:unused
action := core.NewUpdateAction(schema.GroupVersionResource{Resource: "analysisrun"}, analysisRun.Namespace, analysisRun)
len := len(f.actions)
f.actions = append(f.actions, action)
return len
}

func (f *fixture) getUpdatedAnalysisRun(index int) *v1alpha1.AnalysisRun {
func (f *fixture) getUpdatedAnalysisRun(index int) *v1alpha1.AnalysisRun { //nolint:unused
action := filterInformerActions(f.client.Actions())[index]
updateAction, ok := action.(core.UpdateAction)
if !ok {
Expand All @@ -259,7 +259,7 @@ func (f *fixture) getUpdatedAnalysisRun(index int) *v1alpha1.AnalysisRun {
return ar
}

func (f *fixture) expectPatchAnalysisRunAction(analysisRun *v1alpha1.AnalysisRun) int {
func (f *fixture) expectPatchAnalysisRunAction(analysisRun *v1alpha1.AnalysisRun) int { //nolint:unused
analysisRunSchema := schema.GroupVersionResource{
Resource: "analysisruns",
Version: "v1alpha1",
Expand All @@ -269,7 +269,7 @@ func (f *fixture) expectPatchAnalysisRunAction(analysisRun *v1alpha1.AnalysisRun
return len
}

func (f *fixture) getPatchedAnalysisRun(index int) v1alpha1.AnalysisRun {
func (f *fixture) getPatchedAnalysisRun(index int) v1alpha1.AnalysisRun { //nolint:unused
action := filterInformerActions(f.client.Actions())[index]
patchAction, ok := action.(core.PatchAction)
if !ok {
Expand Down
8 changes: 4 additions & 4 deletions experiments/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ func filterInformerActions(actions []core.Action) []core.Action {
return ret
}

func (f *fixture) expectCreateServiceAction(service *corev1.Service) int {
func (f *fixture) expectCreateServiceAction(service *corev1.Service) int { //nolint:unused
len := len(f.kubeactions)
f.kubeactions = append(f.kubeactions, core.NewCreateAction(schema.GroupVersionResource{Resource: "services"}, service.Namespace, service))
return len
Expand All @@ -559,13 +559,13 @@ func (f *fixture) expectUpdateReplicaSetAction(r *appsv1.ReplicaSet) int {
return len
}

func (f *fixture) expectGetExperimentAction(experiment *v1alpha1.Experiment) int {
func (f *fixture) expectGetExperimentAction(experiment *v1alpha1.Experiment) int { //nolint:unused
len := len(f.actions)
f.actions = append(f.actions, core.NewGetAction(schema.GroupVersionResource{Resource: "experiments"}, experiment.Namespace, experiment.Name))
return len
}

func (f *fixture) expectUpdateExperimentAction(experiment *v1alpha1.Experiment) int {
func (f *fixture) expectUpdateExperimentAction(experiment *v1alpha1.Experiment) int { //nolint:unused
action := core.NewUpdateAction(schema.GroupVersionResource{Resource: "experiments"}, experiment.Namespace, experiment)
len := len(f.actions)
f.actions = append(f.actions, action)
Expand Down Expand Up @@ -675,7 +675,7 @@ func (f *fixture) getUpdatedReplicaSet(index int) *appsv1.ReplicaSet {
return rs
}

func (f *fixture) getUpdatedExperiment(index int) *v1alpha1.Experiment {
func (f *fixture) getUpdatedExperiment(index int) *v1alpha1.Experiment { //nolint:unused
action := filterInformerActions(f.client.Actions())[index]
updateAction, ok := action.(core.UpdateAction)
if !ok {
Expand Down
3 changes: 2 additions & 1 deletion experiments/replicaset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ func TestNameCollision(t *testing.T) {
}

// TestNameCollisionWithEquivalentPodTemplateAndControllerUID verifies we consider the annotations
// of the replicaset when encountering name collisions
//
// of the replicaset when encountering name collisions
func TestNameCollisionWithEquivalentPodTemplateAndControllerUID(t *testing.T) {
templates := generateTemplates("bar")
e := newExperiment("foo", templates, "")
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/argoproj/argo-rollouts

go 1.18
go 1.19

require (
github.com/antonmedv/expr v1.9.0
Expand Down
2 changes: 1 addition & 1 deletion metricproviders/cloudwatch/cloudwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (p *Provider) GarbageCollect(run *v1alpha1.AnalysisRun, metric v1alpha1.Met
return nil
}

//NewCloudWatchProvider creates a new CloudWatch provider
// NewCloudWatchProvider creates a new CloudWatch provider
func NewCloudWatchProvider(api CloudWatchClientAPI, logCtx log.Entry) *Provider {
return &Provider{
api: api,
Expand Down
61 changes: 31 additions & 30 deletions metricproviders/kayenta/kayenta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,36 @@ func newAnalysisRun() *v1alpha1.AnalysisRun {

/*
spec:
inputs:
- name: start-time #2019-03-29T01:08:34Z
- name: end-time #2019-03-29T01:38:34Z
- name: stable-hash #xxxx
- name: canary-hash #yyyy
metrics:
- name: mann-whitney
kayenta:
address: https://kayenta.example.com
application: guestbook
canaryConfigName: my-test
metricsAccountName: wavefront-prod
configurationAccountName: intuit-kayenta
storageAccountName: intuit-kayenta
thresholds:
pass: 90
marginal: 75
scopes:
- name: default
controlScope:
scope: app=guestbook and rollouts-pod-template-hash={{inputs.stable-hash}}
step: 60
start: "{{inputs.start-time}}"
end: "{{inputs.end-time}}"
experimentScope:
scope: app=guestbook and rollouts-pod-template-hash={{inputs.canary-hash}}
step: 60
start: "{{inputs.start-time}}"
end: "{{inputs.end-time}}"
inputs:
- name: start-time #2019-03-29T01:08:34Z
- name: end-time #2019-03-29T01:38:34Z
- name: stable-hash #xxxx
- name: canary-hash #yyyy
metrics:
- name: mann-whitney
kayenta:
address: https://kayenta.example.com
application: guestbook
canaryConfigName: my-test
metricsAccountName: wavefront-prod
configurationAccountName: intuit-kayenta
storageAccountName: intuit-kayenta
thresholds:
pass: 90
marginal: 75
scopes:
- name: default
controlScope:
scope: app=guestbook and rollouts-pod-template-hash={{inputs.stable-hash}}
step: 60
start: "{{inputs.start-time}}"
end: "{{inputs.end-time}}"
experimentScope:
scope: app=guestbook and rollouts-pod-template-hash={{inputs.canary-hash}}
step: 60
start: "{{inputs.start-time}}"
end: "{{inputs.end-time}}"
*/
func buildMetric() v1alpha1.Metric {
return v1alpha1.Metric{
Expand Down Expand Up @@ -731,7 +732,7 @@ func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) {
return f(req), nil
}

//NewTestClient returns *http.Client with Transport replaced to avoid making real calls
// NewTestClient returns *http.Client with Transport replaced to avoid making real calls
func NewTestClient(fn RoundTripFunc) http.Client {
return http.Client{
Transport: fn,
Expand Down
6 changes: 3 additions & 3 deletions metricproviders/newrelic/newrelic.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type NewRelicClient struct {
AccountID int
}

//Query executes a NRQL query against the given New Relic account
// Query executes a NRQL query against the given New Relic account
func (n *NewRelicClient) Query(query string) ([]nrdb.NRDBResult, error) {
results, err := n.Nrdb.Query(n.AccountID, nrdb.NRQL(query))
if err != nil {
Expand Down Expand Up @@ -136,15 +136,15 @@ func (p *Provider) GetMetadata(metric v1alpha1.Metric) map[string]string {
return nil
}

//NewNewRelicProvider creates a new NewRelic provider
// NewNewRelicProvider creates a new NewRelic provider
func NewNewRelicProvider(api NewRelicClientAPI, logCtx log.Entry) *Provider {
return &Provider{
logCtx: logCtx,
api: api,
}
}

//NewNewRelicAPIClient creates a new NewRelic API client from metric configuration
// NewNewRelicAPIClient creates a new NewRelic API client from metric configuration
func NewNewRelicAPIClient(metric v1alpha1.Metric, kubeclientset kubernetes.Interface) (NewRelicClientAPI, error) {
ns := defaults.Namespace()
profileSecret := DefaultNewRelicProfileSecretName
Expand Down
14 changes: 7 additions & 7 deletions pkg/client/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions pkg/client/clientset/versioned/scheme/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions rollout/analysis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1650,8 +1650,8 @@ func TestCreatePrePromotionAnalysisRun(t *testing.T) {
assert.Equal(t, calculatePatch(r2, expectedPatch), patch)
}

//TestDoNotCreatePrePromotionAnalysisProgressedRollout ensures a pre-promotion analysis is not created after a Rollout
//points the active service at the new ReplicaSet
// TestDoNotCreatePrePromotionAnalysisProgressedRollout ensures a pre-promotion analysis is not created after a Rollout
// points the active service at the new ReplicaSet
func TestDoNotCreatePrePromotionAnalysisAfterPromotionRollout(t *testing.T) {
f := newFixture(t)
defer f.Close()
Expand Down Expand Up @@ -1700,8 +1700,8 @@ func TestDoNotCreatePrePromotionAnalysisAfterPromotionRollout(t *testing.T) {

}

//TestDoNotCreatePrePromotionAnalysisRunOnNewRollout ensures that a pre-promotion analysis is not created
//if the Rollout does not have a stable ReplicaSet
// TestDoNotCreatePrePromotionAnalysisRunOnNewRollout ensures that a pre-promotion analysis is not created
// if the Rollout does not have a stable ReplicaSet
func TestDoNotCreatePrePromotionAnalysisRunOnNewRollout(t *testing.T) {
f := newFixture(t)
defer f.Close()
Expand Down Expand Up @@ -1731,8 +1731,8 @@ func TestDoNotCreatePrePromotionAnalysisRunOnNewRollout(t *testing.T) {
f.run(getKey(r, t))
}

//TestDoNotCreatePrePromotionAnalysisRunOnNotReadyReplicaSet ensures that a pre-promotion analysis is not created until
//the new ReplicaSet is saturated
// TestDoNotCreatePrePromotionAnalysisRunOnNotReadyReplicaSet ensures that a pre-promotion analysis is not created until
// the new ReplicaSet is saturated
func TestDoNotCreatePrePromotionAnalysisRunOnNotReadyReplicaSet(t *testing.T) {
f := newFixture(t)
defer f.Close()
Expand Down
Loading