diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8e62f6ca81..6f38f2bef1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,7 +21,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" - name: Restore go build cache uses: actions/cache@v4 with: @@ -48,7 +48,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" - name: Restore go build cache uses: actions/cache@v4 with: @@ -75,7 +75,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" - name: Restore go build cache uses: actions/cache@v4 with: @@ -108,7 +108,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" - name: Restore go build cache uses: actions/cache@v4 with: diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yaml index 3557293af1..a42148d66d 100644 --- a/.github/workflows/gh-pages.yaml +++ b/.github/workflows/gh-pages.yaml @@ -23,7 +23,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' - name: build run: make docs - name: deploy diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68fc2fd910..93daadf95c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" - name: Build binaries run: | @@ -95,7 +95,7 @@ jobs: fi - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" - uses: actions/checkout@v4 - run: go install sigs.k8s.io/bom/cmd/bom@v0.2.0 - run: go install github.com/spdx/spdx-sbom-generator/cmd/generator@v0.0.13 diff --git a/.golangci.yml b/.golangci.yml index b299d14b83..840d203ced 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,14 +1,14 @@ run: timeout: 5m - skip-dirs: +issues: + exclude-dirs: - pkg/client - vendor - "eventsources/common/naivewatcher" - skip-files: + exclude-files: - ".*generated.*" linters: enable: - - deadcode # - depguard - dogsled - goconst @@ -23,9 +23,7 @@ linters: - nakedret - rowserrcheck - staticcheck - # - structcheck - typecheck - unconvert - unused - - varcheck - whitespace diff --git a/Makefile b/Makefile index 96e1a94c1e..e443219cf7 100644 --- a/Makefile +++ b/Makefile @@ -178,7 +178,7 @@ start: image kubectl -n argo-events wait --for=condition=Ready --timeout 60s pod --all $(GOPATH)/bin/golangci-lint: - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b `go env GOPATH`/bin v1.54.1 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b `go env GOPATH`/bin v1.61.0 .PHONY: lint lint: $(GOPATH)/bin/golangci-lint diff --git a/go.mod b/go.mod index 9f07eb47ad..205fa07997 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,13 @@ module github.com/argoproj/argo-events -go 1.22 +go 1.23.3 retract v1.15.1 // Contains retractions only. retract v1.15.0 // Published accidentally. require ( - cloud.google.com/go/compute/metadata v0.3.0 + cloud.google.com/go/compute/metadata v0.6.0 cloud.google.com/go/pubsub v1.38.0 github.com/AdaLogics/go-fuzz-headers v0.0.0-20221103172237-443f56ff4ba8 github.com/Azure/azure-event-hubs-go/v3 v3.6.2 @@ -54,7 +54,7 @@ require ( github.com/itchyny/gojq v0.12.17 github.com/joncalhoun/qson v0.0.0-20200422171543-84433dcd3da0 github.com/ktrysmt/go-bitbucket v0.9.81 - github.com/minio/minio-go/v7 v7.0.81 + github.com/minio/minio-go/v7 v7.0.82 github.com/mitchellh/hashstructure/v2 v2.0.2 github.com/mitchellh/mapstructure v1.5.0 github.com/nats-io/graft v0.0.0-20220215174245-93d18541496f @@ -75,15 +75,15 @@ require ( github.com/stripe/stripe-go v70.15.0+incompatible github.com/tidwall/gjson v1.18.0 github.com/tidwall/sjson v1.2.4 - github.com/xanzy/go-gitlab v0.114.0 github.com/xdg-go/scram v1.1.2 github.com/yuin/gopher-lua v1.1.1 + gitlab.com/gitlab-org/api/client-go v0.116.0 go.uber.org/ratelimit v0.3.1 go.uber.org/zap v1.27.0 golang.org/x/crypto v0.31.0 golang.org/x/tools v0.24.0 google.golang.org/api v0.181.0 - google.golang.org/grpc v1.63.2 + google.golang.org/grpc v1.69.0 gopkg.in/jcmturner/gokrb5.v5 v5.3.0 k8s.io/api v0.29.2 k8s.io/apimachinery v0.29.2 @@ -160,7 +160,7 @@ require ( github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.5.0 // indirect github.com/go-ini/ini v1.67.0 // indirect - github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/analysis v0.23.0 // indirect github.com/go-openapi/errors v0.22.0 // indirect @@ -179,7 +179,7 @@ require ( github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/golang-jwt/jwt/v4 v4.5.1 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect - github.com/golang/glog v1.2.0 // indirect + github.com/golang/glog v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/gnostic-models v0.6.8 // indirect @@ -297,15 +297,15 @@ require ( go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect - go.opentelemetry.io/otel v1.24.0 // indirect - go.opentelemetry.io/otel/metric v1.24.0 // indirect - go.opentelemetry.io/otel/trace v1.24.0 // indirect + go.opentelemetry.io/otel v1.31.0 // indirect + go.opentelemetry.io/otel/metric v1.31.0 // indirect + go.opentelemetry.io/otel/trace v1.31.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect golang.org/x/mod v0.20.0 // indirect golang.org/x/net v0.30.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sync v0.10.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/term v0.27.0 // indirect @@ -315,9 +315,9 @@ require ( gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect gomodules.xyz/notify v0.1.1 // indirect google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240506185236-b8a5c65736ae // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect + google.golang.org/protobuf v1.35.1 // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index 5814d11bce..ca0cb06516 100644 --- a/go.sum +++ b/go.sum @@ -7,8 +7,9 @@ cloud.google.com/go/auth v0.4.1 h1:Z7YNIhlWRtrnKlZke7z3GMqzvuYzdc2z98F9D1NV5Hg= cloud.google.com/go/auth v0.4.1/go.mod h1:QVBuVEKpCn4Zp58hzRGvL0tjRGU0YqdRTdCHM1IHnro= cloud.google.com/go/auth/oauth2adapt v0.2.2 h1:+TTV8aXpjeChS9M+aTtN/TjdQnzJvmzKFt//oWu7HX4= cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q= -cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= +cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= cloud.google.com/go/iam v1.1.7 h1:z4VHOhwKLF/+UYXAJDFwGtNF0b6gjsW1Pk9Ml0U/IoM= cloud.google.com/go/iam v1.1.7/go.mod h1:J4PMPg8TtyurAUvSmPj8FF3EDgY1SPRZxcUGrn7WXGA= cloud.google.com/go/kms v1.15.8 h1:szIeDCowID8th2i8XE4uRev5PMxQFqW+JjwYxL9h6xs= @@ -294,8 +295,8 @@ github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTg github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= @@ -362,8 +363,8 @@ github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= -github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY= +github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -636,8 +637,8 @@ github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77Z github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= github.com/minio/minio-go/v7 v7.0.29/go.mod h1:x81+AX5gHSfCSqw7jxRKHvxUXMlE5uKX0Vb75Xk5yYg= -github.com/minio/minio-go/v7 v7.0.81 h1:SzhMN0TQ6T/xSBu6Nvw3M5M8voM+Ht8RH3hE8S7zxaA= -github.com/minio/minio-go/v7 v7.0.81/go.mod h1:84gmIilaX4zcvAWWzJ5Z1WI5axN+hAbM5w25xf8xvC0= +github.com/minio/minio-go/v7 v7.0.82 h1:tWfICLhmp2aFPXL8Tli0XDTHj2VB/fNf0PC1f/i1gRo= +github.com/minio/minio-go/v7 v7.0.82/go.mod h1:84gmIilaX4zcvAWWzJ5Z1WI5axN+hAbM5w25xf8xvC0= github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= @@ -904,8 +905,6 @@ github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4/go.mod h1:50w github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= github.com/whilp/git-urls v0.0.0-20191001220047-6db9661140c0 h1:qqllXPzXh+So+mmANlX/gCJrgo+1kQyshMoQ+NASzm0= github.com/whilp/git-urls v0.0.0-20191001220047-6db9661140c0/go.mod h1:2rx5KE5FLD0HRfkkpyn8JwbVLBdhgeiOb2D2D9LLKM4= -github.com/xanzy/go-gitlab v0.114.0 h1:0wQr/KBckwrZPfEMjRqpUz0HmsKKON9UhCYv9KDy19M= -github.com/xanzy/go-gitlab v0.114.0/go.mod h1:wKNKh3GkYDMOsGmnfuX+ITCmDuSDWFO0G+C4AygL9RY= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= @@ -934,6 +933,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= +gitlab.com/gitlab-org/api/client-go v0.116.0 h1:Dy534gtZPMrnm3fAcmQRMadrcoUyFO4FQ4rXlSAdHAw= +gitlab.com/gitlab-org/api/client-go v0.116.0/go.mod h1:B29OfnZklmaoiR7uHANh9jTyfWEgmXvZLVEnosw2Dx0= go.einride.tech/aip v0.67.1 h1:d/4TW92OxXBngkSOwWS2CH5rez869KpKMaN44mdxkFI= go.einride.tech/aip v0.67.1/go.mod h1:ZGX4/zKw8dcgzdLsrvpOOGxfxI2QSk12SlP7d6c0/XI= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= @@ -948,14 +949,16 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.4 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= -go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= -go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= -go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= -go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= -go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= -go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= -go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= -go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= +go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= +go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= +go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= +go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -1060,8 +1063,8 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1210,18 +1213,18 @@ google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda h1:wu/KJm9KJwpfHWhkkZGohVC6KRrc1oJNr4jwtQMOQXw= google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda/go.mod h1:g2LLCvCeCSir/JJSWosk19BR4NVxGqHUC6rxIRsd7Aw= -google.golang.org/genproto/googleapis/api v0.0.0-20240506185236-b8a5c65736ae h1:AH34z6WAGVNkllnKs5raNq3yRq93VnjBG6rpfub/jYk= -google.golang.org/genproto/googleapis/api v0.0.0-20240506185236-b8a5c65736ae/go.mod h1:FfiGhwUm6CJviekPrc0oJ+7h29e+DmWU6UtjX0ZvI7Y= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 h1:mxSlqyb8ZAHsYDCfiXN1EDdNTdvjUJSLY+OnAUtYNYA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8/go.mod h1:I7Y+G38R2bu5j1aLzfFmQfTcU/WnFuqDwLZAbvKTKpM= +google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 h1:fVoAXEKA4+yufmbdVYv+SE73+cPZbbbe8paLsHfkK+U= +google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53/go.mod h1:riSXTwQ4+nqmPGtobMFyW5FqVAmIs0St6VPp4Ug7CE4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= -google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/grpc v1.69.0 h1:quSiOM1GJPmPH5XtU+BCoVXcDVJJAzNcoyfC2cCjGkI= +google.golang.org/grpc v1.69.0/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1232,8 +1235,8 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk= gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkg/eventbus/jetstream/base/jetstream.go b/pkg/eventbus/jetstream/base/jetstream.go index 7bc755aaf7..b46a6c2f0d 100644 --- a/pkg/eventbus/jetstream/base/jetstream.go +++ b/pkg/eventbus/jetstream/base/jetstream.go @@ -40,9 +40,7 @@ func NewJetstream(url string, streamSettings string, auth *eventbuscommon.Auth, func (stream *Jetstream) Init() error { mgmtConnection, err := stream.MakeConnection() if err != nil { - errStr := fmt.Sprintf("error creating Management Connection for Jetstream stream %+v: %v", stream, err) - stream.Logger.Error(errStr) - return fmt.Errorf(errStr) + return fmt.Errorf("error creating Management Connection for Jetstream stream %+v: %w", stream, err) } err = stream.CreateStream(mgmtConnection) if err != nil { @@ -170,9 +168,7 @@ func (stream *Jetstream) CreateStream(conn *JetstreamConnection) error { connectErr := sharedutil.DoWithRetry(nil, func() error { // exponential backoff if it fails the first time _, err = conn.JSContext.AddStream(&streamConfig) if err != nil { - errStr := fmt.Sprintf(`Failed to add Jetstream stream '%s'for connection %+v: err=%v`, - v1alpha1.JetStreamStreamName, conn, err) - return fmt.Errorf(errStr) + return fmt.Errorf("failed to add Jetstream stream %q for connection %+v: %w", v1alpha1.JetStreamStreamName, conn, err) } else { return nil } diff --git a/pkg/eventbus/jetstream/sensor/sensor_jetstream.go b/pkg/eventbus/jetstream/sensor/sensor_jetstream.go index 2d751bca80..3733babac1 100644 --- a/pkg/eventbus/jetstream/sensor/sensor_jetstream.go +++ b/pkg/eventbus/jetstream/sensor/sensor_jetstream.go @@ -32,9 +32,7 @@ type SensorJetstream struct { func NewSensorJetstream(url string, sensorSpec *v1alpha1.Sensor, streamConfig string, auth *eventbuscommon.Auth, logger *zap.SugaredLogger, tls *v1alpha1.TLSConfig) (*SensorJetstream, error) { if sensorSpec == nil { - errStr := SensorNilError - logger.Errorf(errStr) - return nil, fmt.Errorf(errStr) + return nil, fmt.Errorf("nil sensorSpec") } baseJetstream, err := eventbusjetstreambase.NewJetstream(url, streamConfig, auth, logger, tls) @@ -60,9 +58,7 @@ func (stream *SensorJetstream) Initialize() error { // create Key/Value store for this Sensor (seems to be okay to call this if it already exists) stream.keyValueStore, err = stream.MgmtConnection.JSContext.CreateKeyValue(&nats.KeyValueConfig{Bucket: stream.sensorName}) if err != nil { - errStr := fmt.Sprintf("failed to Create Key/Value Store for sensor %s, err: %v", stream.sensorName, err) - stream.Logger.Error(errStr) - return err + return fmt.Errorf("failed to Create Key/Value Store for sensor %s, err: %w", stream.sensorName, err) } } else { stream.Logger.Infof("found existing K/V store for sensor %s, using that", stream.sensorName) @@ -92,9 +88,7 @@ func (stream *SensorJetstream) Connect(ctx context.Context, triggerName string, func (stream *SensorJetstream) setStateToSpec(sensorSpec *v1alpha1.Sensor) error { log := stream.Logger if sensorSpec == nil { - errStr := SensorNilError - log.Error(errStr) - return fmt.Errorf(errStr) + return fmt.Errorf("nil sensorSpec") } log.Infof("Comparing previous Spec stored in k/v store for sensor %s to new Spec", sensorSpec.Name) @@ -163,9 +157,7 @@ func (stream *SensorJetstream) saveSpec(sensorSpec *v1alpha1.Sensor, removedTrig key := getTriggerExpressionKey(trigger) err := stream.keyValueStore.Delete(key) if err != nil { - errStr := fmt.Sprintf("error deleting key %s: %v", key, err) - stream.Logger.Error(errStr) - return fmt.Errorf(errStr) + return fmt.Errorf("error deleting key %s: %w", key, err) } stream.Logger.Debugf("successfully removed Trigger expression at key %s", key) } @@ -175,10 +167,7 @@ func (stream *SensorJetstream) saveSpec(sensorSpec *v1alpha1.Sensor, removedTrig for _, dep := range sensorSpec.Spec.Dependencies { hash, err := hashstructure.Hash(dep, hashstructure.FormatV2, nil) if err != nil { - errStr := fmt.Sprintf("failed to hash dependency %+v", dep) - stream.Logger.Errorf(errStr) - err = fmt.Errorf(errStr) - return err + return fmt.Errorf("failed to hash dependency %+v: %w", dep, err) } depMap[dep.Name] = hash } @@ -210,10 +199,7 @@ func (stream *SensorJetstream) saveSpec(sensorSpec *v1alpha1.Sensor, removedTrig func (stream *SensorJetstream) getChangedTriggers(sensorSpec *v1alpha1.Sensor) (changedTriggers []string, removedTriggers []string, validTriggers []string, err error) { if sensorSpec == nil { - errStr := SensorNilError - stream.Logger.Errorf(errStr) - err = fmt.Errorf(errStr) - return nil, nil, nil, err + return nil, nil, nil, fmt.Errorf("nil sensor spec") } mappedSpecTriggers := make(map[string]v1alpha1.Trigger, len(sensorSpec.Spec.Triggers)) @@ -246,10 +232,7 @@ func (stream *SensorJetstream) getChangedTriggers(sensorSpec *v1alpha1.Sensor) ( func (stream *SensorJetstream) getChangedDeps(sensorSpec *v1alpha1.Sensor) (changedDeps []string, removedDeps []string, validDeps []string, err error) { if sensorSpec == nil { - errStr := SensorNilError - stream.Logger.Errorf(errStr) - err = fmt.Errorf(errStr) - return nil, nil, nil, err + return nil, nil, nil, fmt.Errorf("nil sensor spec") } specDependencies := sensorSpec.Spec.Dependencies @@ -269,10 +252,7 @@ func (stream *SensorJetstream) getChangedDeps(sensorSpec *v1alpha1.Sensor) (chan // is the dependency definition the same or different? hash, err := hashstructure.Hash(currDep, hashstructure.FormatV2, nil) if err != nil { - errStr := fmt.Sprintf("failed to hash dependency %+v", currDep) - stream.Logger.Errorf(errStr) - err = fmt.Errorf(errStr) - return nil, nil, nil, err + return nil, nil, nil, fmt.Errorf("failed to hash dependency %+v: %w", currDep, err) } if hash == hashedDep { validDeps = append(validDeps, depName) @@ -291,18 +271,14 @@ func (stream *SensorJetstream) getDependencyDefinitions() (DependencyDefinitionV if err == nats.ErrKeyNotFound { return make(DependencyDefinitionValue), nil } - errStr := fmt.Sprintf("error getting key %s: %v", DependencyDefsKey, err) - stream.Logger.Error(errStr) - return nil, fmt.Errorf(errStr) + return nil, fmt.Errorf("error getting key %s: %w", DependencyDefsKey, err) } stream.Logger.Debugf("Value of key %s: %s", DependencyDefsKey, string(depDefs.Value())) depDefMap := DependencyDefinitionValue{} err = json.Unmarshal(depDefs.Value(), &depDefMap) if err != nil { - errStr := fmt.Sprintf("error unmarshalling value %s of key %s: %v", string(depDefs.Value()), DependencyDefsKey, err) - stream.Logger.Error(errStr) - return nil, fmt.Errorf(errStr) + return nil, fmt.Errorf("error unmarshalling value %s of key %s: %w", string(depDefs.Value()), DependencyDefsKey, err) } return depDefMap, nil @@ -311,15 +287,11 @@ func (stream *SensorJetstream) getDependencyDefinitions() (DependencyDefinitionV func (stream *SensorJetstream) storeDependencyDefinitions(depDef DependencyDefinitionValue) error { bytes, err := json.Marshal(depDef) if err != nil { - errStr := fmt.Sprintf("error marshalling %+v: %v", depDef, err) - stream.Logger.Error(errStr) - return fmt.Errorf(errStr) + return fmt.Errorf("error marshalling %+v: %w", depDef, err) } _, err = stream.keyValueStore.Put(DependencyDefsKey, bytes) if err != nil { - errStr := fmt.Sprintf("error storing %s under key %s: %v", string(bytes), DependencyDefsKey, err) - stream.Logger.Error(errStr) - return fmt.Errorf(errStr) + return fmt.Errorf("error storing %s under key %s: %w", string(bytes), DependencyDefsKey, err) } stream.Logger.Debugf("successfully stored dependency definition under key %s: %s", DependencyDefsKey, string(bytes)) return nil @@ -331,18 +303,14 @@ func (stream *SensorJetstream) getTriggerList() (TriggerValue, error) { if err == nats.ErrKeyNotFound { return make(TriggerValue, 0), nil } - errStr := fmt.Sprintf("error getting key %s: %v", TriggersKey, err) - stream.Logger.Error(errStr) - return nil, fmt.Errorf(errStr) + return nil, fmt.Errorf("error getting key %s: %w", TriggersKey, err) } stream.Logger.Debugf("Value of key %s: %s", TriggersKey, string(triggerListJson.Value())) triggerList := TriggerValue{} err = json.Unmarshal(triggerListJson.Value(), &triggerList) if err != nil { - errStr := fmt.Sprintf("error unmarshalling value %s of key %s: %v", string(triggerListJson.Value()), TriggersKey, err) - stream.Logger.Error(errStr) - return nil, fmt.Errorf(errStr) + return nil, fmt.Errorf("errror unmarshalling value %s of key %s: %w", string(triggerListJson.Value()), TriggersKey, err) } return triggerList, nil @@ -351,15 +319,11 @@ func (stream *SensorJetstream) getTriggerList() (TriggerValue, error) { func (stream *SensorJetstream) storeTriggerList(triggerList TriggerValue) error { bytes, err := json.Marshal(triggerList) if err != nil { - errStr := fmt.Sprintf("error marshalling %+v: %v", triggerList, err) - stream.Logger.Error(errStr) - return fmt.Errorf(errStr) + return fmt.Errorf("error marshalling %+v: %w", triggerList, err) } _, err = stream.keyValueStore.Put(TriggersKey, bytes) if err != nil { - errStr := fmt.Sprintf("error storing %s under key %s: %v", string(bytes), TriggersKey, err) - stream.Logger.Error(errStr) - return fmt.Errorf(errStr) + return fmt.Errorf("error storing %s under key %s: %w", string(bytes), TriggersKey, err) } stream.Logger.Debugf("successfully stored trigger list under key %s: %s", TriggersKey, string(bytes)) return nil @@ -372,9 +336,7 @@ func (stream *SensorJetstream) getTriggerExpression(triggerName string) (string, if err == nats.ErrKeyNotFound { return "", nil } - errStr := fmt.Sprintf("error getting key %s: %v", key, err) - stream.Logger.Error(errStr) - return "", fmt.Errorf(errStr) + return "", fmt.Errorf("error getting key %s: %w", key, err) } stream.Logger.Debugf("Value of key %s: %s", key, string(expr.Value())) @@ -385,9 +347,7 @@ func (stream *SensorJetstream) storeTriggerExpression(triggerName string, condit key := getTriggerExpressionKey(triggerName) _, err := stream.keyValueStore.PutString(key, conditionExpression) if err != nil { - errStr := fmt.Sprintf("error storing %s under key %s: %v", conditionExpression, key, err) - stream.Logger.Error(errStr) - return fmt.Errorf(errStr) + return fmt.Errorf("errror storing %s under key %s: %w", conditionExpression, key, err) } stream.Logger.Debugf("successfully stored trigger expression under key %s: %s", key, conditionExpression) return nil diff --git a/pkg/eventbus/jetstream/sensor/trigger_conn.go b/pkg/eventbus/jetstream/sensor/trigger_conn.go index 018fe471b2..d38ed5123f 100644 --- a/pkg/eventbus/jetstream/sensor/trigger_conn.go +++ b/pkg/eventbus/jetstream/sensor/trigger_conn.go @@ -67,16 +67,12 @@ func NewJetstreamTriggerConn(conn *jetstreambase.JetstreamConnection, connection.evaluableExpression, err = govaluate.NewEvaluableExpression(strings.ReplaceAll(dependencyExpression, "-", "\\-")) if err != nil { - errStr := fmt.Sprintf("failed to evaluate expression %s: %v", dependencyExpression, err) - connection.Logger.Error(errStr) - return nil, fmt.Errorf(errStr) + return nil, fmt.Errorf("failed to evaluate expression %s: %w", dependencyExpression, err) } connection.keyValueStore, err = conn.JSContext.KeyValue(sensorName) if err != nil { - errStr := fmt.Sprintf("failed to get K/V store for sensor %s: %v", sensorName, err) - connection.Logger.Error(errStr) - return nil, fmt.Errorf(errStr) + return nil, fmt.Errorf("failed to get K/V store for sensor %s: %v", sensorName, err) } connection.Logger.Infof("Successfully located K/V store for sensor %s", sensorName) @@ -146,9 +142,7 @@ func (conn *JetstreamTriggerConn) Subscribe(ctx context.Context, log.Infof("Subscribing to subject %s with durable name %s", subject, durableName) subscriptions[subscriptionIndex], err = conn.JSContext.PullSubscribe(subject, durableName, nats.AckExplicit(), nats.DeliverNew()) if err != nil { - errorStr := fmt.Sprintf("Failed to subscribe to subject %s using group %s: %v", subject, durableName, err) - log.Error(errorStr) - return fmt.Errorf(errorStr) + return fmt.Errorf("failed to subscribe to subject %s using group %s: %w", subject, durableName, err) } else { log.Debugf("successfully subscribed to subject %s with durable name %s", subject, durableName) } @@ -445,9 +439,7 @@ func (conn *JetstreamTriggerConn) getSavedDependency(depName string) (msg MsgInf var msgInfo MsgInfo err := json.Unmarshal(entry.Value(), &msgInfo) if err != nil { - errStr := fmt.Sprintf("error unmarshalling value %s for key %s: %v", string(entry.Value()), key, err) - conn.Logger.Error(errStr) - return MsgInfo{}, true, fmt.Errorf(errStr) + return MsgInfo{}, true, fmt.Errorf("error unmarshalling value %s for key %s: %w", string(entry.Value()), key, err) } return msgInfo, true, nil } @@ -459,20 +451,15 @@ func (conn *JetstreamTriggerConn) getSavedDependency(depName string) (msg MsgInf } func (conn *JetstreamTriggerConn) saveDependency(depName string, msgInfo MsgInfo) error { - log := conn.Logger jsonEncodedMsg, err := json.Marshal(msgInfo) if err != nil { - errorStr := fmt.Sprintf("failed to convert msgInfo struct into JSON: %+v", msgInfo) - log.Error(errorStr) - return fmt.Errorf(errorStr) + return fmt.Errorf("failed to convert msgInfo struct into JSON: %w", err) } key := getDependencyKey(conn.triggerName, depName) _, err = conn.keyValueStore.Put(key, jsonEncodedMsg) if err != nil { - errorStr := fmt.Sprintf("failed to store dependency under key %s, value:%s: %+v", key, jsonEncodedMsg, err) - log.Error(errorStr) - return fmt.Errorf(errorStr) + return fmt.Errorf("failed to store dependency under key %s, value:%s: %w", key, jsonEncodedMsg, err) } return nil @@ -533,12 +520,8 @@ func (conn *JetstreamTriggerConn) clearDependencyIfExists(depName string) error func (conn *JetstreamTriggerConn) getDependencyNames(eventSourceName, eventName string) ([]string, error) { deps, found := conn.sourceDepMap[eventSourceName+"__"+eventName] if !found { - errStr := fmt.Sprintf("incoming event source and event not associated with any dependencies, event source=%s, event=%s", - eventSourceName, eventName) - conn.Logger.Error(errStr) - return nil, fmt.Errorf(errStr) + return nil, fmt.Errorf("incoming event source and event not associated with any dependencies, event source=%s, event=%s", eventSourceName, eventName) } - return deps, nil } diff --git a/pkg/eventbus/stan/base/stan.go b/pkg/eventbus/stan/base/stan.go index 98d2872243..2bb7040f93 100644 --- a/pkg/eventbus/stan/base/stan.go +++ b/pkg/eventbus/stan/base/stan.go @@ -4,7 +4,7 @@ import ( "fmt" nats "github.com/nats-io/nats.go" - "github.com/nats-io/stan.go" + stan "github.com/nats-io/stan.go" "go.uber.org/zap" eventbusv1alpha1 "github.com/argoproj/argo-events/pkg/apis/events/v1alpha1" diff --git a/pkg/eventbus/stan/base/stan_conn.go b/pkg/eventbus/stan/base/stan_conn.go index 0a434413fb..5893aee110 100644 --- a/pkg/eventbus/stan/base/stan_conn.go +++ b/pkg/eventbus/stan/base/stan_conn.go @@ -4,7 +4,7 @@ import ( "fmt" nats "github.com/nats-io/nats.go" - "github.com/nats-io/stan.go" + stan "github.com/nats-io/stan.go" "go.uber.org/zap" ) diff --git a/pkg/eventbus/stan/sensor/trigger_conn.go b/pkg/eventbus/stan/sensor/trigger_conn.go index b62f34231c..5865627c0e 100644 --- a/pkg/eventbus/stan/sensor/trigger_conn.go +++ b/pkg/eventbus/stan/sensor/trigger_conn.go @@ -11,7 +11,7 @@ import ( "github.com/Knetic/govaluate" cloudevents "github.com/cloudevents/sdk-go/v2" "github.com/gobwas/glob" - "github.com/nats-io/stan.go" + stan "github.com/nats-io/stan.go" "github.com/nats-io/stan.go/pb" "go.uber.org/zap" diff --git a/pkg/eventsources/events/event-data.go b/pkg/eventsources/events/event-data.go index cf98502ff9..7ec4573c7b 100644 --- a/pkg/eventsources/events/event-data.go +++ b/pkg/eventsources/events/event-data.go @@ -21,7 +21,7 @@ import ( "time" "github.com/minio/minio-go/v7/pkg/notification" - "github.com/stripe/stripe-go" + stripe "github.com/stripe/stripe-go" sqslib "github.com/aws/aws-sdk-go/service/sqs" ) diff --git a/pkg/eventsources/sources/gcppubsub/start.go b/pkg/eventsources/sources/gcppubsub/start.go index b875479b72..db7003775c 100644 --- a/pkg/eventsources/sources/gcppubsub/start.go +++ b/pkg/eventsources/sources/gcppubsub/start.go @@ -78,7 +78,7 @@ func (el *EventListener) StartListening(ctx context.Context, dispatch func([]byt logger.Info("started processing the GCP Pub Sub event source...") defer sources.Recover(el.GetEventName()) - err := el.fillDefault(logger) + err := el.fillDefault(ctx, logger) if err != nil { return fmt.Errorf("failed to fill default values for %s, %w", el.GetEventName(), err) } @@ -158,7 +158,7 @@ func (el *EventListener) StartListening(ctx context.Context, dispatch func([]byt return nil } -func (el *EventListener) fillDefault(logger *zap.SugaredLogger) error { +func (el *EventListener) fillDefault(ctx context.Context, logger *zap.SugaredLogger) error { // Default value for each field // - ProjectID: determine from GCP metadata server (only valid in GCP) // - TopicProjectID: same as ProjectID (filled only if topic is specified) @@ -167,7 +167,7 @@ func (el *EventListener) fillDefault(logger *zap.SugaredLogger) error { if el.PubSubEventSource.ProjectID == "" { logger.Debug("determine project ID from GCP metadata server") - proj, err := metadata.ProjectID() + proj, err := metadata.ProjectIDWithContext(ctx) if err != nil { return fmt.Errorf("project ID is not given and couldn't determine from GCP metadata server, %w", err) } diff --git a/pkg/eventsources/sources/generic/start.go b/pkg/eventsources/sources/generic/start.go index 6f0e6d784f..4f672c7f42 100644 --- a/pkg/eventsources/sources/generic/start.go +++ b/pkg/eventsources/sources/generic/start.go @@ -120,11 +120,10 @@ func (el *EventListener) handleOne(event *Event, dispatch func([]byte, ...events func (el *EventListener) connect() (Eventing_StartEventSourceClient, error) { var opt []grpc.DialOption - opt = append(opt, grpc.WithBlock()) if el.GenericEventSource.Insecure { opt = append(opt, grpc.WithTransportCredentials(insecure.NewCredentials())) } - conn, err := grpc.DialContext(context.Background(), el.GenericEventSource.URL, opt...) + conn, err := grpc.NewClient(el.GenericEventSource.URL, opt...) if err != nil { return nil, err } diff --git a/pkg/eventsources/sources/gerrit/hook_util.go b/pkg/eventsources/sources/gerrit/hook_util.go index 4cc661b03a..faea290fb1 100644 --- a/pkg/eventsources/sources/gerrit/hook_util.go +++ b/pkg/eventsources/sources/gerrit/hook_util.go @@ -4,7 +4,7 @@ import ( "fmt" "net/url" - "github.com/andygrunwald/go-gerrit" + gerrit "github.com/andygrunwald/go-gerrit" ) func newGerritWebhookService(client *gerrit.Client) *gerritWebhookService { diff --git a/pkg/eventsources/sources/gerrit/start.go b/pkg/eventsources/sources/gerrit/start.go index b32c5c4f0a..912deb01e9 100644 --- a/pkg/eventsources/sources/gerrit/start.go +++ b/pkg/eventsources/sources/gerrit/start.go @@ -26,7 +26,7 @@ import ( "net/http" "time" - "github.com/andygrunwald/go-gerrit" + gerrit "github.com/andygrunwald/go-gerrit" "go.uber.org/zap" eventsourcecommon "github.com/argoproj/argo-events/pkg/eventsources/common" diff --git a/pkg/eventsources/sources/gerrit/types.go b/pkg/eventsources/sources/gerrit/types.go index a1446c1f84..51e11c9ad0 100644 --- a/pkg/eventsources/sources/gerrit/types.go +++ b/pkg/eventsources/sources/gerrit/types.go @@ -17,7 +17,7 @@ limitations under the License. package gerrit import ( - "github.com/andygrunwald/go-gerrit" + gerrit "github.com/andygrunwald/go-gerrit" "github.com/argoproj/argo-events/pkg/apis/events/v1alpha1" "github.com/argoproj/argo-events/pkg/eventsources/common/webhook" diff --git a/pkg/eventsources/sources/github/appauth.go b/pkg/eventsources/sources/github/appauth.go index 66c7e5b1e0..832ff1f4dc 100644 --- a/pkg/eventsources/sources/github/appauth.go +++ b/pkg/eventsources/sources/github/appauth.go @@ -16,7 +16,7 @@ package github import ( "net/http" - "github.com/bradleyfalzon/ghinstallation/v2" + ghinstallation "github.com/bradleyfalzon/ghinstallation/v2" ) type AppsAuthStrategy struct { diff --git a/pkg/eventsources/sources/gitlab/hook_util.go b/pkg/eventsources/sources/gitlab/hook_util.go index 4e0a260c0a..c7ddbc4b09 100644 --- a/pkg/eventsources/sources/gitlab/hook_util.go +++ b/pkg/eventsources/sources/gitlab/hook_util.go @@ -1,7 +1,7 @@ package gitlab import ( - "github.com/xanzy/go-gitlab" + gitlab "gitlab.com/gitlab-org/api/client-go" ) func getProjectHook(hooks []*gitlab.ProjectHook, url string) *gitlab.ProjectHook { diff --git a/pkg/eventsources/sources/gitlab/hook_util_test.go b/pkg/eventsources/sources/gitlab/hook_util_test.go index 0d8bdf280a..b3154deb26 100644 --- a/pkg/eventsources/sources/gitlab/hook_util_test.go +++ b/pkg/eventsources/sources/gitlab/hook_util_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - "github.com/xanzy/go-gitlab" + gitlab "gitlab.com/gitlab-org/api/client-go" ) func TestGetGroupHook(t *testing.T) { diff --git a/pkg/eventsources/sources/gitlab/start.go b/pkg/eventsources/sources/gitlab/start.go index f74193ebf4..86a60742ce 100644 --- a/pkg/eventsources/sources/gitlab/start.go +++ b/pkg/eventsources/sources/gitlab/start.go @@ -33,7 +33,7 @@ import ( "github.com/argoproj/argo-events/pkg/eventsources/sources" "github.com/argoproj/argo-events/pkg/shared/logging" sharedutil "github.com/argoproj/argo-events/pkg/shared/util" - "github.com/xanzy/go-gitlab" + gitlab "gitlab.com/gitlab-org/api/client-go" "go.uber.org/zap" ) diff --git a/pkg/eventsources/sources/gitlab/types.go b/pkg/eventsources/sources/gitlab/types.go index 0b4e36ca51..38e79c37f2 100644 --- a/pkg/eventsources/sources/gitlab/types.go +++ b/pkg/eventsources/sources/gitlab/types.go @@ -17,7 +17,7 @@ limitations under the License. package gitlab import ( - "github.com/xanzy/go-gitlab" + gitlab "gitlab.com/gitlab-org/api/client-go" "github.com/argoproj/argo-events/pkg/apis/events/v1alpha1" "github.com/argoproj/argo-events/pkg/eventsources/common/webhook" diff --git a/pkg/eventsources/sources/minio/start.go b/pkg/eventsources/sources/minio/start.go index 3073680d19..4e6123042b 100644 --- a/pkg/eventsources/sources/minio/start.go +++ b/pkg/eventsources/sources/minio/start.go @@ -25,7 +25,7 @@ import ( "net/http" "time" - "github.com/minio/minio-go/v7" + minio "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/minio/minio-go/v7/pkg/notification" "go.uber.org/zap" diff --git a/pkg/eventsources/sources/nsq/start.go b/pkg/eventsources/sources/nsq/start.go index 423f615f50..bf3ff35f0d 100644 --- a/pkg/eventsources/sources/nsq/start.go +++ b/pkg/eventsources/sources/nsq/start.go @@ -23,7 +23,7 @@ import ( "strconv" "time" - "github.com/nsqio/go-nsq" + nsq "github.com/nsqio/go-nsq" "go.uber.org/zap" "github.com/argoproj/argo-events/pkg/apis/events/v1alpha1" diff --git a/pkg/eventsources/sources/redis/start.go b/pkg/eventsources/sources/redis/start.go index c98003f436..58d2710c83 100644 --- a/pkg/eventsources/sources/redis/start.go +++ b/pkg/eventsources/sources/redis/start.go @@ -22,7 +22,7 @@ import ( "fmt" "time" - "github.com/go-redis/redis/v8" + redis "github.com/go-redis/redis/v8" "go.uber.org/zap" "github.com/argoproj/argo-events/pkg/apis/events/v1alpha1" diff --git a/pkg/eventsources/sources/redis/start_test.go b/pkg/eventsources/sources/redis/start_test.go index f6f0edeaab..383d5e6d6f 100644 --- a/pkg/eventsources/sources/redis/start_test.go +++ b/pkg/eventsources/sources/redis/start_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - "github.com/go-redis/redis/v8" + redis "github.com/go-redis/redis/v8" "github.com/stretchr/testify/assert" "go.uber.org/zap/zaptest" diff --git a/pkg/eventsources/sources/redis_stream/start.go b/pkg/eventsources/sources/redis_stream/start.go index 5df1d359a7..24b9247ffa 100644 --- a/pkg/eventsources/sources/redis_stream/start.go +++ b/pkg/eventsources/sources/redis_stream/start.go @@ -22,7 +22,7 @@ import ( "fmt" "time" - "github.com/go-redis/redis/v8" + redis "github.com/go-redis/redis/v8" "go.uber.org/zap" "github.com/argoproj/argo-events/pkg/apis/events/v1alpha1" diff --git a/pkg/eventsources/sources/storagegrid/start.go b/pkg/eventsources/sources/storagegrid/start.go index 9fd9d5d91f..8de8c723a8 100644 --- a/pkg/eventsources/sources/storagegrid/start.go +++ b/pkg/eventsources/sources/storagegrid/start.go @@ -27,7 +27,7 @@ import ( "time" "github.com/argoproj/argo-events/pkg/eventsources/events" - "github.com/go-resty/resty/v2" + resty "github.com/go-resty/resty/v2" "github.com/google/uuid" "github.com/joncalhoun/qson" "go.uber.org/zap" diff --git a/pkg/eventsources/sources/stripe/start.go b/pkg/eventsources/sources/stripe/start.go index 3cc64e0084..32c3217c48 100644 --- a/pkg/eventsources/sources/stripe/start.go +++ b/pkg/eventsources/sources/stripe/start.go @@ -24,7 +24,7 @@ import ( "net/http" "time" - "github.com/stripe/stripe-go" + stripe "github.com/stripe/stripe-go" "github.com/stripe/stripe-go/webhookendpoint" "go.uber.org/zap" diff --git a/pkg/reconciler/eventbus/installer/installer.go b/pkg/reconciler/eventbus/installer/installer.go index 4df921163c..9f8d48e10f 100644 --- a/pkg/reconciler/eventbus/installer/installer.go +++ b/pkg/reconciler/eventbus/installer/installer.go @@ -8,7 +8,6 @@ import ( "k8s.io/client-go/kubernetes" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/argoproj/argo-events/pkg/apis/events/v1alpha1" aev1 "github.com/argoproj/argo-events/pkg/apis/events/v1alpha1" "github.com/argoproj/argo-events/pkg/reconciler" ) @@ -57,9 +56,9 @@ func getInstaller(eventBus *aev1.EventBus, client client.Client, kubeClient kube func getLabels(bus *aev1.EventBus) map[string]string { return map[string]string{ - "controller": "eventbus-controller", - "eventbus-name": bus.Name, - v1alpha1.LabelOwnerName: bus.Name, + "controller": "eventbus-controller", + "eventbus-name": bus.Name, + aev1.LabelOwnerName: bus.Name, } } @@ -109,7 +108,7 @@ func linkedEventSources(ctx context.Context, namespace, eventBusName string, c c for _, es := range esl.Items { ebName := es.Spec.EventBusName if ebName == "" { - ebName = v1alpha1.DefaultEventBusName + ebName = aev1.DefaultEventBusName } if ebName == eventBusName { result++ @@ -129,7 +128,7 @@ func linkedSensors(ctx context.Context, namespace, eventBusName string, c client for _, s := range sl.Items { sName := s.Spec.EventBusName if sName == "" { - sName = v1alpha1.DefaultEventBusName + sName = aev1.DefaultEventBusName } if sName == eventBusName { result++ diff --git a/pkg/sensors/artifacts/git.go b/pkg/sensors/artifacts/git.go index da2b897c82..3efc2fe517 100644 --- a/pkg/sensors/artifacts/git.go +++ b/pkg/sensors/artifacts/git.go @@ -22,7 +22,7 @@ import ( "path" "strings" - "github.com/go-git/go-git/v5" + git "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/config" "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/transport" diff --git a/pkg/sensors/artifacts/s3.go b/pkg/sensors/artifacts/s3.go index 02f5edd352..c48e2a4351 100644 --- a/pkg/sensors/artifacts/s3.go +++ b/pkg/sensors/artifacts/s3.go @@ -21,7 +21,7 @@ import ( "fmt" "io" - "github.com/minio/minio-go/v7" + minio "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/argoproj/argo-events/pkg/apis/events/v1alpha1" diff --git a/pkg/sensors/dependencies/filter.go b/pkg/sensors/dependencies/filter.go index 8d6d5d82a9..dcb5d84923 100644 --- a/pkg/sensors/dependencies/filter.go +++ b/pkg/sensors/dependencies/filter.go @@ -28,7 +28,7 @@ import ( "time" "github.com/Knetic/govaluate" - "github.com/Masterminds/sprig/v3" + sprig "github.com/Masterminds/sprig/v3" "github.com/argoproj/argo-events/pkg/apis/events/v1alpha1" sharedutil "github.com/argoproj/argo-events/pkg/shared/util" "github.com/tidwall/gjson" @@ -227,7 +227,7 @@ filterData: } } - if f.Value == nil || len(f.Value) == 0 { + if len(f.Value) == 0 { errMsg := "no values specified" if operator == v1alpha1.OrLogicalOperator { errMessages = append(errMessages, errMsg) diff --git a/pkg/sensors/triggers/custom-trigger/custom-trigger.go b/pkg/sensors/triggers/custom-trigger/custom-trigger.go index 4a11df9ec7..aea60ee5d0 100644 --- a/pkg/sensors/triggers/custom-trigger/custom-trigger.go +++ b/pkg/sensors/triggers/custom-trigger/custom-trigger.go @@ -70,7 +70,6 @@ func NewCustomTrigger(sensor *v1alpha1.Sensor, trigger *v1alpha1.Trigger, logger logger.Infow("instantiating trigger client...", zap.Any("server-url", ct.ServerURL)) opt := []grpc.DialOption{ - grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()), } @@ -93,7 +92,7 @@ func NewCustomTrigger(sensor *v1alpha1.Sensor, trigger *v1alpha1.Trigger, logger opt = append(opt, grpc.WithTransportCredentials(creds)) } - conn, err := grpc.Dial( + conn, err := grpc.NewClient( ct.ServerURL, opt..., ) diff --git a/pkg/sensors/triggers/params.go b/pkg/sensors/triggers/params.go index 5cceacd960..41866a6e2c 100644 --- a/pkg/sensors/triggers/params.go +++ b/pkg/sensors/triggers/params.go @@ -64,7 +64,7 @@ func ConstructPayload(events map[string]*v1alpha1.Event, parameters []v1alpha1.T // ApplyTemplateParameters applies parameters to trigger template func ApplyTemplateParameters(events map[string]*v1alpha1.Event, trigger *v1alpha1.Trigger) error { - if trigger.Parameters != nil && len(trigger.Parameters) > 0 { + if len(trigger.Parameters) > 0 { templateBytes, err := json.Marshal(trigger.Template) if err != nil { return err diff --git a/pkg/shared/logging/logger.go b/pkg/shared/logging/logger.go index 442d08690b..9b9e9ca6db 100644 --- a/pkg/shared/logging/logger.go +++ b/pkg/shared/logging/logger.go @@ -7,7 +7,7 @@ import ( "strconv" zap "go.uber.org/zap" - "k8s.io/klog/v2" + klog "k8s.io/klog/v2" ) // Logger constants diff --git a/pkg/shared/util/json.go b/pkg/shared/util/json.go index 0cd7f2bec4..5f70e37f76 100644 --- a/pkg/shared/util/json.go +++ b/pkg/shared/util/json.go @@ -3,11 +3,11 @@ package util import "encoding/json" func MustJSON(in interface{}) string { - if data, err := json.Marshal(in); err != nil { + data, err := json.Marshal(in) + if err != nil { panic(err) - } else { - return string(data) } + return string(data) } // MustUnJSON unmarshalls JSON or panics. diff --git a/pkg/webhook/validator/eventbus.go b/pkg/webhook/validator/eventbus.go index 6b6e553e60..855963b40a 100644 --- a/pkg/webhook/validator/eventbus.go +++ b/pkg/webhook/validator/eventbus.go @@ -29,7 +29,7 @@ func NewEventBusValidator(client kubernetes.Interface, ebClient eventsclient.Eve func (eb *eventbus) ValidateCreate(ctx context.Context) *admissionv1.AdmissionResponse { if err := eventbuscontroller.ValidateEventBus(eb.neweb); err != nil { - return DeniedResponse(err.Error()) + return DeniedResponse("invalid EventBus: %s", err.Error()) } return AllowedResponse() @@ -40,7 +40,7 @@ func (eb *eventbus) ValidateUpdate(ctx context.Context) *admissionv1.AdmissionRe return AllowedResponse() } if err := eventbuscontroller.ValidateEventBus(eb.neweb); err != nil { - return DeniedResponse(err.Error()) + return DeniedResponse("invalid EventBus: %s", err.Error()) } switch { case eb.neweb.Spec.NATS != nil: diff --git a/pkg/webhook/validator/eventsource.go b/pkg/webhook/validator/eventsource.go index 07e69d0b91..14a8f3709a 100644 --- a/pkg/webhook/validator/eventsource.go +++ b/pkg/webhook/validator/eventsource.go @@ -29,7 +29,7 @@ func NewEventSourceValidator(client kubernetes.Interface, ebClient eventsclient. func (es *eventsource) ValidateCreate(ctx context.Context) *admissionv1.AdmissionResponse { if err := eventsourcecontroller.ValidateEventSource(es.newes); err != nil { - return DeniedResponse(err.Error()) + return DeniedResponse("invalid EventSource: %s", err.Error()) } return AllowedResponse() } diff --git a/pkg/webhook/validator/sensor.go b/pkg/webhook/validator/sensor.go index 3597ce9a82..83a28e82de 100644 --- a/pkg/webhook/validator/sensor.go +++ b/pkg/webhook/validator/sensor.go @@ -2,7 +2,6 @@ package validator import ( "context" - "fmt" admissionv1 "k8s.io/api/admission/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -36,11 +35,11 @@ func (s *sensor) ValidateCreate(ctx context.Context) *admissionv1.AdmissionRespo } eventBus, err := s.eventBusClient.Get(ctx, eventBusName, metav1.GetOptions{}) if err != nil { - return DeniedResponse(fmt.Sprintf("failed to get EventBus eventBusName=%s; err=%v", eventBusName, err)) + return DeniedResponse("failed to get EventBus eventBusName=%s; err=%v", eventBusName, err) } if err := sensorcontroller.ValidateSensor(s.newSensor, eventBus); err != nil { - return DeniedResponse(err.Error()) + return DeniedResponse("invalid Sensor: %s", err.Error()) } return AllowedResponse() }