From f5c061feda041689db3e0353b8033df692d9bbed Mon Sep 17 00:00:00 2001 From: Binbin Li Date: Mon, 27 Jan 2025 05:33:06 +0000 Subject: [PATCH] chore: fix linter Signed-off-by: Binbin Li --- .github/workflows/scan-vulns.yaml | 4 +--- cmd/ratify/cmd/discover.go | 2 +- cmd/ratify/cmd/referrer.go | 6 ++--- cmd/ratify/cmd/resolve.go | 2 +- cmd/ratify/cmd/root.go | 4 ++-- cmd/ratify/cmd/serve.go | 4 ++-- cmd/ratify/cmd/verify.go | 2 +- cmd/ratify/cmd/version.go | 2 +- go.mod | 14 +++++------ go.sum | 24 +++++++++---------- httpserver/Dockerfile | 2 +- httpserver/handlers.go | 2 +- httpserver/server_test.go | 14 +++++------ httpserver/tlsManager.go | 2 +- .../certificate_provider_test.go | 2 +- .../oras/authprovider/aws/awsecrbasic.go | 2 +- .../clusterresource/policy_controller_test.go | 2 +- .../clusterresource/store_controller_test.go | 2 +- pkg/controllers/logging.go | 2 +- .../policy_controller_test.go | 2 +- pkg/executor/core/executor_test.go | 18 +++++++------- .../azurekeyvault/provider_test.go | 4 ++-- .../keymanagementprovider_test.go | 2 +- pkg/manager/manager.go | 2 +- pkg/referrerstore/oras/oras.go | 4 ++-- pkg/referrerstore/oras/oras_test.go | 12 +++++----- pkg/referrerstore/plugin/plugin_test.go | 16 ++++++------- pkg/referrerstore/plugin/skel/skel_test.go | 14 +++++------ pkg/verifier/notation/pluginmanager.go | 2 +- pkg/verifier/plugin/plugin_test.go | 8 +++---- pkg/verifier/plugin/skel/skel_test.go | 6 ++--- 31 files changed, 91 insertions(+), 93 deletions(-) diff --git a/.github/workflows/scan-vulns.yaml b/.github/workflows/scan-vulns.yaml index 167321afc..a686493fc 100644 --- a/.github/workflows/scan-vulns.yaml +++ b/.github/workflows/scan-vulns.yaml @@ -52,8 +52,6 @@ jobs: wget https://github.com/aquasecurity/trivy/releases/download/v${{ env.TRIVY_VERSION }}/trivy_${{ env.TRIVY_VERSION }}_Linux-64bit.tar.gz tar zxvf trivy_${{ env.TRIVY_VERSION }}_Linux-64bit.tar.gz echo "$(pwd)" >> $GITHUB_PATH - env: - TRIVY_VERSION: "0.46.0" - name: Run trivy on git repository run: | @@ -68,7 +66,7 @@ jobs: for img in "localbuild:test" "localbuildcrd:test"; do trivy image --ignore-unfixed --vuln-type="os,library" "${img}" done - - name: Run trivy on images and exit on HIGH severity + - name: Run trivy on images and exit on HIGH/CRITICAL severity run: | trivy image --skip-db-update --ignore-unfixed --exit-code 1 --severity HIGH,CRITICAL --vuln-type="os,library" "localbuild:test" trivy image --skip-db-update --ignore-unfixed --exit-code 1 --severity HIGH,CRITICAL --vuln-type="os,library" --show-suppressed --ignorefile ./.github/crd.trivyignore.yaml "localbuildcrd:test" diff --git a/cmd/ratify/cmd/discover.go b/cmd/ratify/cmd/discover.go index c4f61e8ea..0f196e971 100644 --- a/cmd/ratify/cmd/discover.go +++ b/cmd/ratify/cmd/discover.go @@ -60,7 +60,7 @@ func NewCmdDiscover(argv ...string) *cobra.Command { Short: "Discover referrers for a subject", Example: eg, Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { return discover(opts) }, } diff --git a/cmd/ratify/cmd/referrer.go b/cmd/ratify/cmd/referrer.go index 8520e0f2a..512d667f4 100644 --- a/cmd/ratify/cmd/referrer.go +++ b/cmd/ratify/cmd/referrer.go @@ -46,7 +46,7 @@ func NewCmdReferrer(argv ...string) *cobra.Command { Use: referrerUse, Short: "Discover referrers for a subject", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { return cmd.Usage() }, } @@ -71,7 +71,7 @@ func NewCmdShowBlob(argv ...string) *cobra.Command { Short: "show blob at a digest", Example: eg, Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { return showBlob(opts) }, } @@ -100,7 +100,7 @@ func NewCmdShowRefManifest(argv ...string) *cobra.Command { Short: "show rference manifest at a digest", Example: eg, Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { return showRefManifest(opts) }, } diff --git a/cmd/ratify/cmd/resolve.go b/cmd/ratify/cmd/resolve.go index 0ecc87b39..2542953ff 100644 --- a/cmd/ratify/cmd/resolve.go +++ b/cmd/ratify/cmd/resolve.go @@ -54,7 +54,7 @@ func NewCmdResolve(argv ...string) *cobra.Command { Short: "Resolve digest of a subject that is referenced by a tag", Example: eg, Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { return resolve(opts) }, } diff --git a/cmd/ratify/cmd/root.go b/cmd/ratify/cmd/root.go index d52637b29..6b375447d 100644 --- a/cmd/ratify/cmd/root.go +++ b/cmd/ratify/cmd/root.go @@ -35,14 +35,14 @@ func New(use, short string) *cobra.Command { root := &cobra.Command{ Use: use, Short: short, - PersistentPreRun: func(cmd *cobra.Command, args []string) { + PersistentPreRun: func(_ *cobra.Command, _ []string) { if enableDebug { common.SetLoggingLevel("debug", logrus.StandardLogger()) } else { common.SetLoggingLevelFromEnv(logrus.StandardLogger()) } }, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { return cmd.Usage() }, SilenceUsage: true, diff --git a/cmd/ratify/cmd/serve.go b/cmd/ratify/cmd/serve.go index 65ebb513c..0870aabe6 100644 --- a/cmd/ratify/cmd/serve.go +++ b/cmd/ratify/cmd/serve.go @@ -58,7 +58,7 @@ func NewCmdServe(_ ...string) *cobra.Command { Short: "Run ratify as a server", Example: "ratify server", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { return serve(opts) }, } @@ -118,7 +118,7 @@ func serve(opts serveCmdOptions) error { if err != nil { return err } - logrus.Infof("starting server at" + opts.httpServerAddress) + logrus.Infof("starting server at: %s", opts.httpServerAddress) if err := server.Run(nil); err != nil { return err } diff --git a/cmd/ratify/cmd/verify.go b/cmd/ratify/cmd/verify.go index 170014133..12f5b9a0e 100644 --- a/cmd/ratify/cmd/verify.go +++ b/cmd/ratify/cmd/verify.go @@ -51,7 +51,7 @@ func NewCmdVerify(_ ...string) *cobra.Command { Short: "Verify a subject", Example: "sample example", Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { return verify(opts) }, } diff --git a/cmd/ratify/cmd/version.go b/cmd/ratify/cmd/version.go index 9a5fbd0a9..89237cbe3 100644 --- a/cmd/ratify/cmd/version.go +++ b/cmd/ratify/cmd/version.go @@ -35,7 +35,7 @@ ratify version` Short: "Show the ratify version information", Example: eg, Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { return runVersion() }, } diff --git a/go.mod b/go.mod index 0846cf772..7fc34ddbe 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/deislabs/ratify -go 1.22.0 +go 1.23.3 // Accidentally published prior to 1.0.0 release retract ( @@ -46,7 +46,7 @@ require ( go.opentelemetry.io/otel/exporters/prometheus v0.49.0 go.opentelemetry.io/otel/metric v1.28.0 go.opentelemetry.io/otel/sdk/metric v1.27.0 - golang.org/x/sync v0.8.0 + golang.org/x/sync v0.10.0 google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 k8s.io/api v0.28.11 @@ -232,14 +232,14 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.26.0 + golang.org/x/crypto v0.32.0 golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.28.0 // indirect + golang.org/x/net v0.34.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sys v0.23.0 // indirect - golang.org/x/term v0.23.0 // indirect - golang.org/x/text v0.17.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/term v0.28.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.6.0 // indirect gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index 27260f901..0fbca2a92 100644 --- a/go.sum +++ b/go.sum @@ -761,8 +761,8 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= -golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o= golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= @@ -801,8 +801,8 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= @@ -814,8 +814,8 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -848,8 +848,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= @@ -859,8 +859,8 @@ golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= -golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= +golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= +golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -874,8 +874,8 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/httpserver/Dockerfile b/httpserver/Dockerfile index 61cdf03d9..0112c5fbd 100644 --- a/httpserver/Dockerfile +++ b/httpserver/Dockerfile @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM --platform=$BUILDPLATFORM golang:1.22@sha256:a66eda637829ce891e9cf61ff1ee0edf544e1f6c5b0e666c7310dce231a66f28 as builder +FROM --platform=$BUILDPLATFORM golang:1.23@sha256:73f06be4578c9987ce560087e2e2ea6485fb605e3910542cadd8fa09fc5f3e31 as builder ARG TARGETPLATFORM ARG TARGETOS diff --git a/httpserver/handlers.go b/httpserver/handlers.go index 4f4d02aa7..fe6115c21 100644 --- a/httpserver/handlers.go +++ b/httpserver/handlers.go @@ -287,7 +287,7 @@ func sendResponse(results *[]externaldata.Item, systemErr string, w http.Respons } func processTimeout(h ContextHandler, duration time.Duration, isMutation bool) ContextHandler { - return func(handlerContext context.Context, w http.ResponseWriter, r *http.Request) error { + return func(_ context.Context, w http.ResponseWriter, r *http.Request) error { ctx, cancel := context.WithTimeout(r.Context(), duration) defer cancel() diff --git a/httpserver/server_test.go b/httpserver/server_test.go index 1aaf98ecd..bf3fccbb1 100644 --- a/httpserver/server_test.go +++ b/httpserver/server_test.go @@ -126,7 +126,7 @@ func TestServer_Timeout_Failed(t *testing.T) { CanVerifyFunc: func(at string) bool { return at == testArtifactType }, - VerifyResult: func(artifactType string) bool { + VerifyResult: func(_ string) bool { time.Sleep(time.Duration(timeoutDuration) * time.Second) return true }, @@ -194,7 +194,7 @@ func TestServer_MultipleSubjects_Success(t *testing.T) { CanVerifyFunc: func(at string) bool { return at == testArtifactType }, - VerifyResult: func(artifactType string) bool { + VerifyResult: func(_ string) bool { return true }, } @@ -268,7 +268,7 @@ func TestServer_Mutation_Success(t *testing.T) { CanVerifyFunc: func(at string) bool { return at == testArtifactType }, - VerifyResult: func(artifactType string) bool { + VerifyResult: func(_ string) bool { time.Sleep(time.Duration(timeoutDuration) * time.Second) return true }, @@ -344,7 +344,7 @@ func TestServer_Mutation_ReferrerStoreConfigInvalid_Failure(t *testing.T) { CanVerifyFunc: func(at string) bool { return at == testArtifactType }, - VerifyResult: func(artifactType string) bool { + VerifyResult: func(_ string) bool { time.Sleep(time.Duration(timeoutDuration) * time.Second) return true }, @@ -423,7 +423,7 @@ func TestServer_MultipleRequestsForSameSubject_Success(t *testing.T) { CanVerifyFunc: func(at string) bool { return at == testArtifactType }, - VerifyResult: func(artifactType string) bool { + VerifyResult: func(_ string) bool { return true }, } @@ -552,7 +552,7 @@ func TestServer_Verify_PolicyEnforcerConfigInvalid_Failure(t *testing.T) { CanVerifyFunc: func(at string) bool { return at == testArtifactType }, - VerifyResult: func(artifactType string) bool { + VerifyResult: func(_ string) bool { time.Sleep(time.Duration(timeoutDuration) * time.Second) return true }, @@ -671,7 +671,7 @@ func TestServer_Verify_VerifierConfigInvalid_Failure(t *testing.T) { // TestServe_serverGracefulShutdown tests the case where the server is shutdown gracefully func TestServer_serverGracefulShutdown(t *testing.T) { // create a server that sleeps for 5 seconds before responding - ts := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { time.Sleep(5 * time.Second) fmt.Fprintln(w, "request succeeded") })) diff --git a/httpserver/tlsManager.go b/httpserver/tlsManager.go index 3764e3d7b..442bd2598 100644 --- a/httpserver/tlsManager.go +++ b/httpserver/tlsManager.go @@ -73,7 +73,7 @@ func (t *TLSCertWatcher) Start() error { var watchErr error pollInterval := 1 * time.Second pollTimeout := 10 * time.Second - if err := wait.PollUntilContextTimeout(context.TODO(), pollInterval, pollTimeout, false, func(ctx context.Context) (done bool, err error) { + if err := wait.PollUntilContextTimeout(context.TODO(), pollInterval, pollTimeout, false, func(_ context.Context) (done bool, err error) { for f := range files { if err := t.watcher.Add(f); err != nil { watchErr = err diff --git a/pkg/certificateprovider/certificate_provider_test.go b/pkg/certificateprovider/certificate_provider_test.go index b30ed2ff7..f5f864e63 100644 --- a/pkg/certificateprovider/certificate_provider_test.go +++ b/pkg/certificateprovider/certificate_provider_test.go @@ -78,7 +78,7 @@ func TestDecodeCertificates_ByteArrayToCertificates(t *testing.T) { r, err := DecodeCertificates(c1) if err != nil { - t.Fatalf(err.Error()) + t.Fatal(err.Error()) } expectedLen := 1 diff --git a/pkg/common/oras/authprovider/aws/awsecrbasic.go b/pkg/common/oras/authprovider/aws/awsecrbasic.go index 3349e8372..3a1270070 100644 --- a/pkg/common/oras/authprovider/aws/awsecrbasic.go +++ b/pkg/common/oras/authprovider/aws/awsecrbasic.go @@ -70,7 +70,7 @@ func (d *awsEcrBasicAuthProvider) getEcrAuthToken(artifact string) (EcrAuthToken ctx := context.Background() // TODO: Update to use regional endpoint // nolint:staticcheck - resolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) { + resolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, _ ...interface{}) (aws.Endpoint, error) { if service == ecr.ServiceID && region == apiOverrideRegion { logrus.Info("AWS ECR basic auth using custom endpoint resolver...") logrus.Infof("AWS ECR basic auth API override endpoint: %s", apiOverrideEndpoint) diff --git a/pkg/controllers/clusterresource/policy_controller_test.go b/pkg/controllers/clusterresource/policy_controller_test.go index eb3713557..e544dfe2b 100644 --- a/pkg/controllers/clusterresource/policy_controller_test.go +++ b/pkg/controllers/clusterresource/policy_controller_test.go @@ -109,7 +109,7 @@ func TestWritePolicyStatus(t *testing.T) { } for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { + t.Run(tc.name, func(_ *testing.T) { writePolicyStatus(context.Background(), tc.reconciler, tc.policy, logger, tc.isSuccess, tc.errString) }) } diff --git a/pkg/controllers/clusterresource/store_controller_test.go b/pkg/controllers/clusterresource/store_controller_test.go index 4123e5e4c..7f224d09e 100644 --- a/pkg/controllers/clusterresource/store_controller_test.go +++ b/pkg/controllers/clusterresource/store_controller_test.go @@ -119,7 +119,7 @@ func TestWriteStoreStatus(t *testing.T) { } for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { + t.Run(tc.name, func(_ *testing.T) { writeStoreStatus(context.Background(), tc.reconciler, tc.store, logger, tc.isSuccess, tc.errString) }) } diff --git a/pkg/controllers/logging.go b/pkg/controllers/logging.go index 7ad3429f6..90abce740 100644 --- a/pkg/controllers/logging.go +++ b/pkg/controllers/logging.go @@ -122,7 +122,7 @@ func (sink *LogrusSink) createEntry(keysAndValues ...interface{}) *logrus.Entry } func (sink *LogrusSink) formatMessage(msg string) string { - if sink.names == nil || len(sink.names) == 0 { + if len(sink.names) == 0 { return msg } diff --git a/pkg/controllers/namespaceresource/policy_controller_test.go b/pkg/controllers/namespaceresource/policy_controller_test.go index 2764f0faf..b9f784099 100644 --- a/pkg/controllers/namespaceresource/policy_controller_test.go +++ b/pkg/controllers/namespaceresource/policy_controller_test.go @@ -137,7 +137,7 @@ func TestWritePolicyStatus(t *testing.T) { } for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { + t.Run(tc.name, func(_ *testing.T) { writePolicyStatus(context.Background(), tc.reconciler, tc.policy, logger, tc.isSuccess, tc.errString) }) } diff --git a/pkg/executor/core/executor_test.go b/pkg/executor/core/executor_test.go index a4fbb1518..d12ce2834 100644 --- a/pkg/executor/core/executor_test.go +++ b/pkg/executor/core/executor_test.go @@ -240,7 +240,7 @@ func TestVerifySubjectInternal_CanVerify_ExpectedResults(t *testing.T) { CanVerifyFunc: func(at string) bool { return at == testArtifactType1 }, - VerifyResult: func(artifactType string) bool { + VerifyResult: func(_ string) bool { return true }, } @@ -293,7 +293,7 @@ func TestVerifySubjectInternal_VerifyFailures_ExpectedResults(t *testing.T) { }, } ver := &TestVerifier{ - CanVerifyFunc: func(at string) bool { + CanVerifyFunc: func(_ string) bool { return true }, VerifyResult: func(artifactType string) bool { @@ -345,10 +345,10 @@ func TestVerifySubjectInternal_VerifySuccess_ExpectedResults(t *testing.T) { }, } ver := &TestVerifier{ - CanVerifyFunc: func(at string) bool { + CanVerifyFunc: func(_ string) bool { return true }, - VerifyResult: func(artifactType string) bool { + VerifyResult: func(_ string) bool { return true }, } @@ -402,7 +402,7 @@ func TestVerifySubjectInternalWithDecision_MultipleArtifacts_ExpectedResults(t * }, } ver := &TestVerifier{ - CanVerifyFunc: func(at string) bool { + CanVerifyFunc: func(_ string) bool { return true }, VerifyResult: func(artifactType string) bool { @@ -460,7 +460,7 @@ func TestVerifySubjectInternal_NestedReferences_Expected(t *testing.T) { CanVerifyFunc: func(at string) bool { return at == mocks.SbomArtifactType }, - VerifyResult: func(artifactType string) bool { + VerifyResult: func(_ string) bool { return true }, nestedReferences: []string{"string-content-does-not-matter"}, @@ -470,7 +470,7 @@ func TestVerifySubjectInternal_NestedReferences_Expected(t *testing.T) { CanVerifyFunc: func(at string) bool { return at == mocks.SignatureArtifactType }, - VerifyResult: func(artifactType string) bool { + VerifyResult: func(_ string) bool { return true }, } @@ -538,7 +538,7 @@ func TestVerifySubjectInternal_NoNestedReferences_Expected(t *testing.T) { CanVerifyFunc: func(at string) bool { return at == mocks.SbomArtifactType }, - VerifyResult: func(artifactType string) bool { + VerifyResult: func(_ string) bool { return true }, } @@ -547,7 +547,7 @@ func TestVerifySubjectInternal_NoNestedReferences_Expected(t *testing.T) { CanVerifyFunc: func(at string) bool { return at == mocks.SignatureArtifactType }, - VerifyResult: func(artifactType string) bool { + VerifyResult: func(_ string) bool { return true }, } diff --git a/pkg/keymanagementprovider/azurekeyvault/provider_test.go b/pkg/keymanagementprovider/azurekeyvault/provider_test.go index fc9730cad..6736c29e7 100644 --- a/pkg/keymanagementprovider/azurekeyvault/provider_test.go +++ b/pkg/keymanagementprovider/azurekeyvault/provider_test.go @@ -173,7 +173,7 @@ func TestCreate(t *testing.T) { } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - initKVClient = func(ctx context.Context, keyVaultEndpoint, tenantID, clientID string) (*kv.BaseClient, error) { + initKVClient = func(_ context.Context, _, _, _ string) (*kv.BaseClient, error) { return &kv.BaseClient{}, nil } _, err := factory.Create("v1", tc.config, "") @@ -224,7 +224,7 @@ func TestGetKeys(t *testing.T) { }, } - initKVClient = func(ctx context.Context, keyVaultEndpoint, tenantID, clientID string) (*kv.BaseClient, error) { + initKVClient = func(_ context.Context, _, _, _ string) (*kv.BaseClient, error) { return &kv.BaseClient{}, nil } provider, err := factory.Create("v1", config, "") diff --git a/pkg/keymanagementprovider/keymanagementprovider_test.go b/pkg/keymanagementprovider/keymanagementprovider_test.go index 9a4b6f0be..1ba8f6cc1 100644 --- a/pkg/keymanagementprovider/keymanagementprovider_test.go +++ b/pkg/keymanagementprovider/keymanagementprovider_test.go @@ -85,7 +85,7 @@ func TestDecodeCertificates_ByteArrayToCertificates(t *testing.T) { r, err := DecodeCertificates(c1) if err != nil { - t.Fatalf(err.Error()) + t.Fatal(err.Error()) } expectedLen := 1 diff --git a/pkg/manager/manager.go b/pkg/manager/manager.go index ba6876107..941a2a1de 100644 --- a/pkg/manager/manager.go +++ b/pkg/manager/manager.go @@ -105,7 +105,7 @@ func StartServer(httpServerAddress, configFilePath, certDirectory, caCertFile st logrus.Errorf("initialize server failed with error %v, exiting..", err) os.Exit(1) } - logrus.Infof("starting server at" + httpServerAddress) + logrus.Infof("starting server at: %s", httpServerAddress) if err := server.Run(certRotatorReady); err != nil { logrus.Errorf("starting server failed with error %v, exiting..", err) os.Exit(1) diff --git a/pkg/referrerstore/oras/oras.go b/pkg/referrerstore/oras/oras.go index 45bfc999a..df708b3e8 100644 --- a/pkg/referrerstore/oras/oras.go +++ b/pkg/referrerstore/oras/oras.go @@ -183,7 +183,7 @@ func createBaseStore(version string, storeConfig config.StorePluginConfig) (*ora insecureTransport.MaxIdleConnsPerHost = HTTPMaxIdleConnsPerHost // #nosec G402 insecureTransport.TLSClientConfig = &tls.Config{ - InsecureSkipVerify: true, + InsecureSkipVerify: true, //nolint:gosec } insecureRetryTransport := retry.NewTransport(insecureTransport) insecureRetryTransport.Policy = customRetryPolicy @@ -437,7 +437,7 @@ func createDefaultRepository(ctx context.Context, store *orasStore, targetRef co } // set the provider to return the resolved credentials - credentialProvider := func(ctx context.Context, registry string) (auth.Credential, error) { + credentialProvider := func(_ context.Context, _ string) (auth.Credential, error) { if authConfig.Username != "" || authConfig.Password != "" || authConfig.IdentityToken != "" { return auth.Credential{ Username: authConfig.Username, diff --git a/pkg/referrerstore/oras/oras_test.go b/pkg/referrerstore/oras/oras_test.go index b561e5009..7b376e1e1 100644 --- a/pkg/referrerstore/oras/oras_test.go +++ b/pkg/referrerstore/oras/oras_test.go @@ -101,7 +101,7 @@ func TestORASListReferrers_SubjectDesc(t *testing.T) { }, }, } - store.createRepository = func(ctx context.Context, store *orasStore, targetRef common.Reference) (registry.Repository, error) { + store.createRepository = func(_ context.Context, _ *orasStore, _ common.Reference) (registry.Repository, error) { return testRepo, nil } inputRef := common.Reference{ @@ -158,7 +158,7 @@ func TestORASListReferrers_NoSubjectDesc(t *testing.T) { }, }, } - store.createRepository = func(ctx context.Context, store *orasStore, targetRef common.Reference) (registry.Repository, error) { + store.createRepository = func(_ context.Context, _ *orasStore, _ common.Reference) (registry.Repository, error) { return testRepo, nil } inputRef := common.Reference{ @@ -226,7 +226,7 @@ func TestORASGetReferenceManifest_CachedDesc(t *testing.T) { artifactDigest: io.NopCloser(bytes.NewReader(manifestNotCachedBytes)), }, } - store.createRepository = func(ctx context.Context, store *orasStore, targetRef common.Reference) (registry.Repository, error) { + store.createRepository = func(_ context.Context, _ *orasStore, _ common.Reference) (registry.Repository, error) { return testRepo, nil } store.localCache = mocks.TestStorage{ @@ -290,7 +290,7 @@ func TestORASGetReferenceManifest_NotCachedDesc(t *testing.T) { artifactDigest: io.NopCloser(bytes.NewReader(manifestNotCachedBytes)), }, } - store.createRepository = func(ctx context.Context, store *orasStore, targetRef common.Reference) (registry.Repository, error) { + store.createRepository = func(_ context.Context, _ *orasStore, _ common.Reference) (registry.Repository, error) { return testRepo, nil } store.localCache = mocks.TestStorage{ @@ -346,7 +346,7 @@ func TestORASGetBlobContent_CachedDesc(t *testing.T) { }, }, } - store.createRepository = func(ctx context.Context, store *orasStore, targetRef common.Reference) (registry.Repository, error) { + store.createRepository = func(_ context.Context, _ *orasStore, _ common.Reference) (registry.Repository, error) { return testRepo, nil } store.localCache = mocks.TestStorage{ @@ -393,7 +393,7 @@ func TestORASGetBlobContent_NotCachedDesc(t *testing.T) { }, }, } - store.createRepository = func(ctx context.Context, store *orasStore, targetRef common.Reference) (registry.Repository, error) { + store.createRepository = func(_ context.Context, _ *orasStore, _ common.Reference) (registry.Repository, error) { return testRepo, nil } store.localCache = mocks.TestStorage{ diff --git a/pkg/referrerstore/plugin/plugin_test.go b/pkg/referrerstore/plugin/plugin_test.go index 40223e52b..62351cd2e 100644 --- a/pkg/referrerstore/plugin/plugin_test.go +++ b/pkg/referrerstore/plugin/plugin_test.go @@ -46,10 +46,10 @@ func (e *TestExecutor) FindInPaths(plugin string, paths []string) (string, error } func TestPluginMain_GetBlobContent_InvokeExpected(t *testing.T) { testExecutor := &TestExecutor{ - find: func(plugin string, paths []string) (string, error) { + find: func(_ string, _ []string) (string, error) { return testPath, nil }, - execute: func(ctx context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error) { + execute: func(_ context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error) { if pluginPath != testPath { t.Fatalf("mismatch in plugin path expected %s actual %s", testPath, pluginPath) } @@ -124,10 +124,10 @@ func TestPluginMain_GetBlobContent_InvokeExpected(t *testing.T) { func TestPluginMain_GetReferenceManifest_InvokeExpected(t *testing.T) { testExecutor := &TestExecutor{ - find: func(plugin string, paths []string) (string, error) { + find: func(_ string, _ []string) (string, error) { return testPath, nil }, - execute: func(ctx context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error) { + execute: func(_ context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error) { if pluginPath != testPath { t.Fatalf("mismatch in plugin path expected %s actual %s", testPath, pluginPath) } @@ -207,10 +207,10 @@ func TestPluginMain_GetReferenceManifest_InvokeExpected(t *testing.T) { func TestPluginMain_ListReferrers_InvokeExpected(t *testing.T) { testPlugin := "test-plugin" testExecutor := &TestExecutor{ - find: func(plugin string, paths []string) (string, error) { + find: func(_ string, _ []string) (string, error) { return testPath, nil }, - execute: func(ctx context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error) { + execute: func(_ context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error) { if pluginPath != testPath { t.Fatalf("mismatch in plugin path expected %s actual %s", testPath, pluginPath) } @@ -289,10 +289,10 @@ func TestPluginMain_GetSubjectDescriptor_InvokeExpected(t *testing.T) { testPlugin := "test-plugin" testDigest := digest.FromString("test") testExecutor := &TestExecutor{ - find: func(plugin string, paths []string) (string, error) { + find: func(_ string, _ []string) (string, error) { return testPath, nil }, - execute: func(ctx context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error) { + execute: func(_ context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error) { if pluginPath != testPath { t.Fatalf("mismatch in plugin path expected %s actual %s", testPath, pluginPath) } diff --git a/pkg/referrerstore/plugin/skel/skel_test.go b/pkg/referrerstore/plugin/skel/skel_test.go index 3a1e03ed3..9a330136e 100644 --- a/pkg/referrerstore/plugin/skel/skel_test.go +++ b/pkg/referrerstore/plugin/skel/skel_test.go @@ -54,7 +54,7 @@ func teardown() { } func TestPluginMain_GetBlobContent_ReturnsExpected(t *testing.T) { - getBlobContent := func(args *CmdArgs, subjectReference common.Reference, digest digest.Digest) ([]byte, error) { + getBlobContent := func(_ *CmdArgs, _ common.Reference, digest digest.Digest) ([]byte, error) { return []byte(digest.String()), nil } environment := map[string]string{ @@ -85,7 +85,7 @@ func TestPluginMain_GetBlobContent_ReturnsExpected(t *testing.T) { } func TestPluginMain_GetReferenceManifest_ReturnsExpected(t *testing.T) { - getReferenceManifest := func(args *CmdArgs, subjectReference common.Reference, digest digest.Digest) (ocispecs.ReferenceManifest, error) { + getReferenceManifest := func(_ *CmdArgs, _ common.Reference, _ digest.Digest) (ocispecs.ReferenceManifest, error) { return ocispecs.ReferenceManifest{ ArtifactType: "test-type", }, nil @@ -120,7 +120,7 @@ func TestPluginMain_GetReferenceManifest_ReturnsExpected(t *testing.T) { } func TestPluginMain_ListReferrers_ReturnsExpected(t *testing.T) { - listReferrers := func(args *CmdArgs, subjectReference common.Reference, artifactTypes []string, nextToken string, subjectDesc *ocispecs.SubjectDescriptor) (*referrerstore.ListReferrersResult, error) { + listReferrers := func(_ *CmdArgs, _ common.Reference, _ []string, _ string, _ *ocispecs.SubjectDescriptor) (*referrerstore.ListReferrersResult, error) { return &referrerstore.ListReferrersResult{ NextToken: "next-token", Referrers: []ocispecs.ReferenceDescriptor{ @@ -161,7 +161,7 @@ func TestPluginMain_ListReferrers_ReturnsExpected(t *testing.T) { func TestPluginMain_GetSubjectDesc_ReturnsExpected(t *testing.T) { testDigest := digest.FromString("test") - getSubjectDesc := func(args *CmdArgs, subjectReference common.Reference) (*ocispecs.SubjectDescriptor, error) { + getSubjectDesc := func(_ *CmdArgs, _ common.Reference) (*ocispecs.SubjectDescriptor, error) { return &ocispecs.SubjectDescriptor{Descriptor: v1.Descriptor{Digest: testDigest}}, nil } @@ -193,7 +193,7 @@ func TestPluginMain_GetSubjectDesc_ReturnsExpected(t *testing.T) { } func TestPluginMain_ErrorCases(t *testing.T) { - getBlobContent := func(args *CmdArgs, subjectReference common.Reference, digest digest.Digest) ([]byte, error) { + getBlobContent := func(_ *CmdArgs, _ common.Reference, _ digest.Digest) ([]byte, error) { return nil, fmt.Errorf("simulated error") } environment := map[string]string{ @@ -266,7 +266,7 @@ func TestPluginMain_ErrorCases(t *testing.T) { } func TestPluginMain_GetBlobContent_ErrorCases(t *testing.T) { - getBlobContent := func(args *CmdArgs, subjectReference common.Reference, digest digest.Digest) ([]byte, error) { + getBlobContent := func(_ *CmdArgs, _ common.Reference, digest digest.Digest) ([]byte, error) { return []byte(digest.String()), nil } environment := map[string]string{ @@ -301,7 +301,7 @@ func TestPluginMain_GetBlobContent_ErrorCases(t *testing.T) { } func TestPluginMain_ListReferrers_ErrorCases(t *testing.T) { - listReferrers := func(args *CmdArgs, subjectReference common.Reference, artifactTypes []string, nextToken string, subjectDesc *ocispecs.SubjectDescriptor) (*referrerstore.ListReferrersResult, error) { + listReferrers := func(_ *CmdArgs, _ common.Reference, _ []string, _ string, _ *ocispecs.SubjectDescriptor) (*referrerstore.ListReferrersResult, error) { return &referrerstore.ListReferrersResult{ NextToken: "next-token", Referrers: []ocispecs.ReferenceDescriptor{ diff --git a/pkg/verifier/notation/pluginmanager.go b/pkg/verifier/notation/pluginmanager.go index 20cf097b5..32d7ddcdf 100644 --- a/pkg/verifier/notation/pluginmanager.go +++ b/pkg/verifier/notation/pluginmanager.go @@ -52,7 +52,7 @@ func (m *RatifyPluginManager) Get(ctx context.Context, name string) (plugin.Plug // Lists available notation plugins in the target directory func (m *RatifyPluginManager) List(_ context.Context) ([]string, error) { var plugins []string - err := fs.WalkDir(m.pluginFS, ".", func(dir string, d fs.DirEntry, err error) error { + err := fs.WalkDir(m.pluginFS, ".", func(_ string, d fs.DirEntry, err error) error { if err != nil { return err } diff --git a/pkg/verifier/plugin/plugin_test.go b/pkg/verifier/plugin/plugin_test.go index dd6c2faf6..f00061c80 100644 --- a/pkg/verifier/plugin/plugin_test.go +++ b/pkg/verifier/plugin/plugin_test.go @@ -68,10 +68,10 @@ func TestNewVerifier_Expected(t *testing.T) { func TestVerify_IsSuccessTrue_Expected(t *testing.T) { testPlugin := "test-plugin" testExecutor := &TestExecutor{ - find: func(plugin string, paths []string) (string, error) { + find: func(_ string, _ []string) (string, error) { return testPath, nil }, - execute: func(ctx context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error) { + execute: func(_ context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error) { if pluginPath != testPath { t.Fatalf("mismatch in plugin path expected %s actual %s", testPath, pluginPath) } @@ -145,10 +145,10 @@ func TestVerify_IsSuccessTrue_Expected(t *testing.T) { func TestVerify_IsSuccessFalse_Expected(t *testing.T) { testPlugin := "test-plugin" testExecutor := &TestExecutor{ - find: func(plugin string, paths []string) (string, error) { + find: func(_ string, _ []string) (string, error) { return testPath, nil }, - execute: func(ctx context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error) { + execute: func(_ context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error) { if pluginPath != testPath { t.Fatalf("mismatch in plugin path expected %s actual %s", testPath, pluginPath) } diff --git a/pkg/verifier/plugin/skel/skel_test.go b/pkg/verifier/plugin/skel/skel_test.go index 97a78b411..4ae96f2b2 100644 --- a/pkg/verifier/plugin/skel/skel_test.go +++ b/pkg/verifier/plugin/skel/skel_test.go @@ -60,7 +60,7 @@ func teardown() { } func TestPluginMain_VerifyReference_ReturnsExpected(t *testing.T) { - verifyReference := func(args *CmdArgs, subjectReference common.Reference, referenceDescriptor ocispecs.ReferenceDescriptor, referrerStore referrerstore.ReferrerStore) (*verifier.VerifierResult, error) { + verifyReference := func(_ *CmdArgs, _ common.Reference, referenceDescriptor ocispecs.ReferenceDescriptor, referrerStore referrerstore.ReferrerStore) (*verifier.VerifierResult, error) { if referenceDescriptor.ArtifactType != "test-type" { t.Fatalf("expected artifact type %s actual %s", "test-type", referenceDescriptor.ArtifactType) } @@ -107,7 +107,7 @@ func TestPluginMain_VerifyReference_ReturnsExpected(t *testing.T) { } func TestPluginMain_VerifyReference_CanUseBuiltinStores(t *testing.T) { - verifyReference := func(args *CmdArgs, subjectReference common.Reference, referenceDescriptor ocispecs.ReferenceDescriptor, referrerStore referrerstore.ReferrerStore) (*verifier.VerifierResult, error) { + verifyReference := func(_ *CmdArgs, _ common.Reference, _ ocispecs.ReferenceDescriptor, referrerStore referrerstore.ReferrerStore) (*verifier.VerifierResult, error) { // expect to find a builtin store and fail if it was configured as a plugin if _, ok := referrerStore.(*sp.StorePlugin); ok { t.Fatalf("expected store to be builtin") @@ -144,7 +144,7 @@ func TestPluginMain_VerifyReference_CanUseBuiltinStores(t *testing.T) { } func TestPluginMain_ErrorCases(t *testing.T) { - verifyReference := func(args *CmdArgs, subjectReference common.Reference, referenceDescriptor ocispecs.ReferenceDescriptor, referrerStore referrerstore.ReferrerStore) (*verifier.VerifierResult, error) { + verifyReference := func(_ *CmdArgs, _ common.Reference, _ ocispecs.ReferenceDescriptor, _ referrerstore.ReferrerStore) (*verifier.VerifierResult, error) { return nil, fmt.Errorf("simulated error") } environment := map[string]string{