argo-events icon indicating copy to clipboard operation
argo-events copied to clipboard

Chore: golang 1.21

Open shyukri opened this issue 1 year ago • 8 comments

Checklist:

  • [ ] My organization is added to USERS.md.
  • Fixes https://github.com/argoproj/argo-events/issues/2742
  • Bumps alpine base to 3.19 and ArgoWF client

This has also gone bigger than anticipated:

  • bump golangci-lint; drop abandoned linters && add recommendations
  • move k3d to 1.27 and fix CI
  • update github action setup-go to v5
  • ...

shyukri avatar Jan 28 '24 09:01 shyukri

Thanks @shyukri ! could you figure out why the lint is failing?

whynowy avatar Jan 30 '24 06:01 whynowy

Issues even after upgrading the linter:

``` # make lint

INFO [runner] linters took 26.82040325s with stages: goanalysis_metalinter: 26.7034705s test/util/util.go:21:19: string metadata.name= has 3 occurrences, make it a constant (goconst) fieldSelector := "metadata.name=" + eventBusName ^ controllers/eventbus/installer/jetstream_test.go:74:18: string eventbus- has 6 occurrences, make it a constant (goconst) assert.Equal(t, "eventbus-"+testJetStreamEventBus.Name+"-js", n) ^ common/string_keyed_map.go:7:2: items is unused (structcheck) items map[string]T ^ common/string_keyed_map.go:8:2: lock is unused (structcheck) lock *sync.RWMutex ^ controllers/config.go:7:2: import 'github.com/fsnotify/fsnotify' is not allowed from list 'Main' (depguard) "github.com/fsnotify/fsnotify" ^ controllers/config.go:8:2: import 'github.com/spf13/viper' is not allowed from list 'Main' (depguard) "github.com/spf13/viper" ^ eventbus/jetstream/base/jetstream.go:8:2: import 'github.com/argoproj/argo-events/common' is not allowed from list 'Main' (depguard) "github.com/argoproj/argo-events/common" ^ eventbus/jetstream/base/jetstream.go:9:2: import 'github.com/argoproj/argo-events/eventbus/common' is not allowed from list 'Main' (depguard) eventbuscommon "github.com/argoproj/argo-events/eventbus/common" ^ eventbus/jetstream/base/jetstream.go:10:2: import 'github.com/argoproj/argo-events/pkg/apis/eventbus/v1alpha1' is not allowed from list 'Main' (depguard) eventbusv1alpha1 "github.com/argoproj/argo-events/pkg/apis/eventbus/v1alpha1" ^ eventbus/jetstream/base/jetstream.go:11:2: import 'github.com/nats-io/nats.go' is not allowed from list 'Main' (depguard) nats "github.com/nats-io/nats.go" ^ eventbus/jetstream/base/jetstream.go:12:2: import 'github.com/spf13/viper' is not allowed from list 'Main' (depguard) "github.com/spf13/viper" ^ eventbus/jetstream/base/jetstream_conn.go:6:2: import 'github.com/nats-io/nats.go' is not allowed from list 'Main' (depguard) nats "github.com/nats-io/nats.go" ^ eventbus/jetstream/sensor/sensor_jetstream.go:9:2: import 'github.com/argoproj/argo-events/eventbus/common' is not allowed from list 'Main' (depguard) eventbuscommon "github.com/argoproj/argo-events/eventbus/common" ^ eventbus/jetstream/sensor/sensor_jetstream.go:10:2: import 'github.com/argoproj/argo-events/eventbus/jetstream/base' is not allowed from list 'Main' (depguard) eventbusjetstreambase "github.com/argoproj/argo-events/eventbus/jetstream/base" ^ eventbus/jetstream/sensor/sensor_jetstream.go:11:2: import 'github.com/argoproj/argo-events/pkg/apis/sensor/v1alpha1' is not allowed from list 'Main' (depguard) "github.com/argoproj/argo-events/pkg/apis/sensor/v1alpha1" ^ eventbus/jetstream/sensor/sensor_jetstream.go:12:2: import 'github.com/nats-io/nats.go' is not allowed from list 'Main' (depguard) nats "github.com/nats-io/nats.go" ^ eventbus/jetstream/sensor/sensor_jetstream.go:17:2: import 'github.com/argoproj/argo-events/common' is not allowed from list 'Main' (depguard) "github.com/argoproj/argo-events/common" ^ eventbus/jetstream/sensor/sensor_jetstream.go:18:2: import 'github.com/cloudevents/sdk-go/v2' is not allowed from list 'Main' (depguard) cloudevents "github.com/cloudevents/sdk-go/v2" ^ eventbus/jetstream/sensor/sensor_jetstream.go:19:2: import 'github.com/mitchellh/hashstructure/v2' is not allowed from list 'Main' (depguard) hashstructure "github.com/mitchellh/hashstructure/v2" ^ eventbus/jetstream/sensor/trigger_conn.go:12:2: import 'github.com/Knetic/govaluate' is not allowed from list 'Main' (depguard) "github.com/Knetic/govaluate" ^ eventbus/jetstream/sensor/trigger_conn.go:13:2: import 'github.com/cloudevents/sdk-go/v2' is not allowed from list 'Main' (depguard) cloudevents "github.com/cloudevents/sdk-go/v2" ^ eventbus/jetstream/sensor/trigger_conn.go:16:2: import 'github.com/argoproj/argo-events/eventbus/common' is not allowed from list 'Main' (depguard) eventbuscommon "github.com/argoproj/argo-events/eventbus/common" ^ eventbus/jetstream/sensor/trigger_conn.go:17:2: import 'github.com/argoproj/argo-events/eventbus/jetstream/base' is not allowed from list 'Main' (depguard) jetstreambase "github.com/argoproj/argo-events/eventbus/jetstream/base" ^ eventbus/kafka/eventsource/source_conn.go:6:2: import 'github.com/IBM/sarama' is not allowed from list 'Main' (depguard) "github.com/IBM/sarama" ^ eventbus/kafka/eventsource/source_conn.go:8:2: import 'github.com/argoproj/argo-events/eventbus/kafka/base' is not allowed from list 'Main' (depguard) "github.com/argoproj/argo-events/eventbus/kafka/base" ^ eventbus/kafka/eventsource/source_kafka.go:4:2: import 'github.com/IBM/sarama' is not allowed from list 'Main' (depguard) "github.com/IBM/sarama" ^ eventbus/kafka/eventsource/source_kafka.go:6:2: import 'github.com/argoproj/argo-events/eventbus/kafka/base' is not allowed from list 'Main' (depguard) "github.com/argoproj/argo-events/eventbus/kafka/base" ^ eventbus/kafka/eventsource/source_kafka.go:7:2: import 'github.com/argoproj/argo-events/pkg/apis/eventbus/v1alpha1' is not allowed from list 'Main' (depguard) eventbusv1alpha1 "github.com/argoproj/argo-events/pkg/apis/eventbus/v1alpha1" ^ eventbus/kafka/sensor/kafka_handler.go:9:2: import 'github.com/IBM/sarama' is not allowed from list 'Main' (depguard) "github.com/IBM/sarama" ^ eventbus/kafka/sensor/kafka_handler.go:10:2: import 'github.com/argoproj/argo-events/eventbus/kafka/base' is not allowed from list 'Main' (depguard) "github.com/argoproj/argo-events/eventbus/kafka/base" ^ eventbus/kafka/sensor/kafka_sensor.go:12:2: import 'github.com/Knetic/govaluate' is not allowed from list 'Main' (depguard) "github.com/Knetic/govaluate" ^ eventbus/kafka/sensor/kafka_sensor.go:15:2: import 'github.com/argoproj/argo-events/pkg/apis/eventbus/v1alpha1' is not allowed from list 'Main' (depguard) eventbusv1alpha1 "github.com/argoproj/argo-events/pkg/apis/eventbus/v1alpha1" ^ eventbus/kafka/sensor/kafka_sensor.go:16:2: import 'github.com/argoproj/argo-events/pkg/apis/sensor/v1alpha1' is not allowed from list 'Main' (depguard) sensorv1alpha1 "github.com/argoproj/argo-events/pkg/apis/sensor/v1alpha1" ^ eventbus/kafka/sensor/kafka_sensor.go:17:2: import 'github.com/cloudevents/sdk-go/v2' is not allowed from list 'Main' (depguard) cloudevents "github.com/cloudevents/sdk-go/v2" ^ eventbus/kafka/sensor/trigger_conn.go:8:2: import 'github.com/Knetic/govaluate' is not allowed from list 'Main' (depguard) "github.com/Knetic/govaluate" ^ eventbus/stan/base/stan.go:9:2: import 'github.com/nats-io/stan.go' is not allowed from list 'Main' (depguard) "github.com/nats-io/stan.go" ^ eventbus/stan/base/stan_conn.go:7:2: import 'github.com/nats-io/stan.go' is not allowed from list 'Main' (depguard) "github.com/nats-io/stan.go" ^ eventbus/stan/eventsource/source_conn.go:8:2: import 'github.com/argoproj/argo-events/eventbus/stan/base' is not allowed from list 'Main' (depguard) stanbase "github.com/argoproj/argo-events/eventbus/stan/base" ^ eventbus/stan/eventsource/source_stan.go:5:2: import 'github.com/argoproj/argo-events/eventbus/stan/base' is not allowed from list 'Main' (depguard) stanbase "github.com/argoproj/argo-events/eventbus/stan/base" ^ eventbus/stan/sensor/sensor_stan.go:9:2: import 'github.com/argoproj/argo-events/common' is not allowed from list 'Main' (depguard) "github.com/argoproj/argo-events/common" ^ eventbus/stan/sensor/sensor_stan.go:11:2: import 'github.com/argoproj/argo-events/eventbus/stan/base' is not allowed from list 'Main' (depguard) stanbase "github.com/argoproj/argo-events/eventbus/stan/base" ^ eventbus/stan/sensor/trigger_conn.go:13:2: import 'github.com/gobwas/glob' is not allowed from list 'Main' (depguard) "github.com/gobwas/glob" ^ eventbus/stan/sensor/trigger_conn.go:14:2: import 'github.com/nats-io/stan.go' is not allowed from list 'Main' (depguard) "github.com/nats-io/stan.go" ^ eventbus/stan/sensor/trigger_conn.go:15:2: import 'github.com/nats-io/stan.go/pb' is not allowed from list 'Main' (depguard) "github.com/nats-io/stan.go/pb" ^ eventsources/common/common.go:3:8: import 'github.com/cloudevents/sdk-go/v2/event' is not allowed from list 'Main' (depguard) import "github.com/cloudevents/sdk-go/v2/event" ^ pkg/apis/events/event-data.go:23:2: import 'github.com/minio/minio-go/v7/pkg/notification' is not allowed from list 'Main' (depguard) "github.com/minio/minio-go/v7/pkg/notification" ^ pkg/apis/events/event-data.go:24:2: import 'github.com/stripe/stripe-go' is not allowed from list 'Main' (depguard) "github.com/stripe/stripe-go" ^ pkg/apis/events/event-data.go:26:2: import 'github.com/aws/aws-sdk-go/service/sqs' is not allowed from list 'Main' (depguard) sqslib "github.com/aws/aws-sdk-go/service/sqs" ^ eventsources/eventing.go:14:2: import 'github.com/google/uuid' is not allowed from list 'Main' (depguard) "github.com/google/uuid" ^ eventsources/eventing.go:18:2: import 'github.com/argoproj/argo-events/common/expr' is not allowed from list 'Main' (depguard) "github.com/argoproj/argo-events/common/expr" ^ eventsources/eventing.go:19:2: import 'github.com/argoproj/argo-events/common/leaderelection' is not allowed from list 'Main' (depguard) "github.com/argoproj/argo-events/common/leaderelection" ^ eventsources/eventing.go:20:2: import 'github.com/argoproj/argo-events/common/logging' is not allowed from list 'Main' (depguard) "github.com/argoproj/argo-events/common/logging" ^ eventsources/eventing.go:21:2: import 'github.com/argoproj/argo-events/eventbus' is not allowed from list 'Main' (depguard) "github.com/argoproj/argo-events/eventbus" ^ eventsources/eventing.go:23:2: import 'github.com/argoproj/argo-events/eventsources/common' is not allowed from list 'Main' (depguard) eventsourcecommon "github.com/argoproj/argo-events/eventsources/common"


</details>

shyukri avatar Jan 30 '24 15:01 shyukri

I think you should remove depguard from the enabled linters. We do not seem be using it, how I can tell is there is no list of allowed linters. Then you can resolve the rest of the lints easily.

ryancurrah avatar Feb 02 '24 20:02 ryancurrah

@ryancurrah @whynowy can you please re-check ?

shyukri avatar Feb 07 '24 07:02 shyukri

@ryancurrah do you need any assistance? I was considering opening a separate lint fix pr

blkperl avatar Mar 29 '24 04:03 blkperl

Hello! Is there any updates on this PR? We are blocked on our end pending the resolution of a few CVEs that are present in the older Go version used in the latest release.

yucombinator avatar May 04 '24 00:05 yucombinator

@whynowy any chance to take another look ? Or should we jump to golang 1.22 :) ?

shyukri avatar May 20 '24 17:05 shyukri

@whynowy re

shyukri avatar Jul 16 '24 18:07 shyukri

This Pull Request is stale because it has been open for 60 days with no activity. It will be closed in 7 days if no further activity.

github-actions[bot] avatar Sep 15 '24 02:09 github-actions[bot]