From c8fa8317c93ccfb91f5f5a8173fd935bb846a749 Mon Sep 17 00:00:00 2001 From: Bob Callaway Date: Fri, 12 May 2023 10:41:35 -0700 Subject: [PATCH] fix lint errors, bump linter up to 1.52 Signed-off-by: Bob Callaway --- .github/workflows/verify.yml | 2 +- cmd/rekor-cli/app/state/state.go | 5 +---- cmd/rekor-cli/app/upload.go | 5 +---- cmd/rekor-cli/app/verify.go | 5 +---- cmd/rekor-cli/main_test.go | 2 +- cmd/rekor-server/main_test.go | 2 +- pkg/api/entries.go | 10 +++++----- pkg/api/index.go | 2 +- pkg/api/public_key.go | 2 +- pkg/api/tlog.go | 4 ++-- pkg/fuzz/fuzz_utils.go | 2 +- pkg/generated/restapi/configure_rekor_server.go | 8 ++++---- pkg/pki/minisign/minisign.go | 2 +- pkg/pki/minisign/minisign_test.go | 2 +- pkg/pki/pgp/pgp.go | 2 +- pkg/pki/pgp/pgp_test.go | 2 +- pkg/pki/pkcs7/pkcs7.go | 2 +- pkg/pki/ssh/ssh.go | 2 +- pkg/pki/tuf/tuf.go | 2 +- pkg/types/alpine/alpine_test.go | 2 +- pkg/types/cose/cose_test.go | 2 +- pkg/types/cose/v0.0.1/entry.go | 2 +- pkg/types/hashedrekord/hashedrekord_test.go | 2 +- pkg/types/hashedrekord/v0.0.1/entry.go | 4 ++-- pkg/types/helm/helm_test.go | 2 +- pkg/types/intoto/intoto_test.go | 2 +- pkg/types/intoto/v0.0.1/entry.go | 2 +- pkg/types/intoto/v0.0.2/entry.go | 2 +- pkg/types/jar/jar_test.go | 2 +- pkg/types/jar/v0.0.1/entry.go | 2 +- pkg/types/rekord/rekord_test.go | 2 +- pkg/types/rfc3161/rfc3161_test.go | 2 +- pkg/types/rfc3161/v0.0.1/entry.go | 2 +- pkg/types/rpm/rpm_test.go | 2 +- pkg/types/test_util.go | 10 +++++----- pkg/types/tuf/tuf_test.go | 2 +- pkg/types/types_test.go | 8 ++++---- pkg/verify/verify_test.go | 6 +++--- 38 files changed, 56 insertions(+), 65 deletions(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 263e2eb7b..fbfaf546e 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -59,4 +59,4 @@ jobs: uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0 timeout-minutes: 5 with: - version: v1.51 + version: v1.52 diff --git a/cmd/rekor-cli/app/state/state.go b/cmd/rekor-cli/app/state/state.go index 21c008891..1985b81d1 100644 --- a/cmd/rekor-cli/app/state/state.go +++ b/cmd/rekor-cli/app/state/state.go @@ -47,10 +47,7 @@ func Dump(key string, sth *util.SignedCheckpoint) error { if err != nil { return err } - if err := os.WriteFile(statePath, b, 0600); err != nil { - return err - } - return nil + return os.WriteFile(statePath, b, 0600) } func loadStateFile() persistedState { diff --git a/cmd/rekor-cli/app/upload.go b/cmd/rekor-cli/app/upload.go index aedc6da93..040ab4ea3 100644 --- a/cmd/rekor-cli/app/upload.go +++ b/cmd/rekor-cli/app/upload.go @@ -61,10 +61,7 @@ var uploadCmd = &cobra.Command{ if err := viper.BindPFlags(cmd.Flags()); err != nil { return err } - if err := validateArtifactPFlags(false, false); err != nil { - return err - } - return nil + return validateArtifactPFlags(false, false) }, Long: `This command takes the public key, signature and URL of the release artifact and uploads it to the rekor server.`, Run: format.WrapCmd(func(args []string) (interface{}, error) { diff --git a/cmd/rekor-cli/app/verify.go b/cmd/rekor-cli/app/verify.go index 1d4d86fca..cffd81b9d 100644 --- a/cmd/rekor-cli/app/verify.go +++ b/cmd/rekor-cli/app/verify.go @@ -85,10 +85,7 @@ var verifyCmd = &cobra.Command{ if err := viper.BindPFlags(cmd.Flags()); err != nil { return fmt.Errorf("error initializing cmd line args: %s", err) } - if err := validateArtifactPFlags(true, true); err != nil { - return err - } - return nil + return validateArtifactPFlags(true, true) }, Run: format.WrapCmd(func(args []string) (interface{}, error) { ctx := context.Background() diff --git a/cmd/rekor-cli/main_test.go b/cmd/rekor-cli/main_test.go index 6a11ccbb1..fd8902753 100644 --- a/cmd/rekor-cli/main_test.go +++ b/cmd/rekor-cli/main_test.go @@ -21,6 +21,6 @@ import ( "github.com/sigstore/rekor/cmd/rekor-cli/app" ) -func TestCover(t *testing.T) { +func TestCover(_ *testing.T) { app.Execute() } diff --git a/cmd/rekor-server/main_test.go b/cmd/rekor-server/main_test.go index 8fa9c4e13..5c151b829 100644 --- a/cmd/rekor-server/main_test.go +++ b/cmd/rekor-server/main_test.go @@ -21,6 +21,6 @@ import ( "github.com/sigstore/rekor/cmd/rekor-server/app" ) -func TestCover(t *testing.T) { +func TestCover(_ *testing.T) { app.Execute() } diff --git a/pkg/api/entries.go b/pkg/api/entries.go index 27f9b8cb2..1f5bc2665 100644 --- a/pkg/api/entries.go +++ b/pkg/api/entries.go @@ -68,7 +68,7 @@ func signEntry(ctx context.Context, signer signature.Signer, entry models.LogEnt } // logEntryFromLeaf creates a signed LogEntry struct from trillian structs -func logEntryFromLeaf(ctx context.Context, signer signature.Signer, tc trillianclient.TrillianClient, leaf *trillian.LogLeaf, +func logEntryFromLeaf(ctx context.Context, signer signature.Signer, _ trillianclient.TrillianClient, leaf *trillian.LogLeaf, signedLogRoot *trillian.SignedLogRoot, proof *trillian.Proof, tid int64, ranges sharding.LogRanges) (models.LogEntry, error) { log.ContextLogger(ctx).Debugf("log entry from leaf %d", leaf.GetLeafIndex()) @@ -554,7 +554,7 @@ func retrieveUUIDFromTree(ctx context.Context, uuid string, tid int64) (models.L // handlers for APIs that may be disabled in a given instance -func CreateLogEntryNotImplementedHandler(params entries.CreateLogEntryParams) middleware.Responder { +func CreateLogEntryNotImplementedHandler(_ entries.CreateLogEntryParams) middleware.Responder { err := &models.Error{ Code: http.StatusNotImplemented, Message: "Create Entry API not enabled in this Rekor instance", @@ -563,7 +563,7 @@ func CreateLogEntryNotImplementedHandler(params entries.CreateLogEntryParams) mi return entries.NewCreateLogEntryDefault(http.StatusNotImplemented).WithPayload(err) } -func GetLogEntryByIndexNotImplementedHandler(params entries.GetLogEntryByIndexParams) middleware.Responder { +func GetLogEntryByIndexNotImplementedHandler(_ entries.GetLogEntryByIndexParams) middleware.Responder { err := &models.Error{ Code: http.StatusNotImplemented, Message: "Get Log Entry by Index API not enabled in this Rekor instance", @@ -572,7 +572,7 @@ func GetLogEntryByIndexNotImplementedHandler(params entries.GetLogEntryByIndexPa return entries.NewGetLogEntryByIndexDefault(http.StatusNotImplemented).WithPayload(err) } -func GetLogEntryByUUIDNotImplementedHandler(params entries.GetLogEntryByUUIDParams) middleware.Responder { +func GetLogEntryByUUIDNotImplementedHandler(_ entries.GetLogEntryByUUIDParams) middleware.Responder { err := &models.Error{ Code: http.StatusNotImplemented, Message: "Get Log Entry by UUID API not enabled in this Rekor instance", @@ -581,7 +581,7 @@ func GetLogEntryByUUIDNotImplementedHandler(params entries.GetLogEntryByUUIDPara return entries.NewGetLogEntryByUUIDDefault(http.StatusNotImplemented).WithPayload(err) } -func SearchLogQueryNotImplementedHandler(params entries.SearchLogQueryParams) middleware.Responder { +func SearchLogQueryNotImplementedHandler(_ entries.SearchLogQueryParams) middleware.Responder { err := &models.Error{ Code: http.StatusNotImplemented, Message: "Search Log Query API not enabled in this Rekor instance", diff --git a/pkg/api/index.go b/pkg/api/index.go index 728642503..69f695a28 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -89,7 +89,7 @@ func SearchIndexHandler(params index.SearchIndexParams) middleware.Responder { return index.NewSearchIndexOK().WithPayload(result.Values()) } -func SearchIndexNotImplementedHandler(params index.SearchIndexParams) middleware.Responder { +func SearchIndexNotImplementedHandler(_ index.SearchIndexParams) middleware.Responder { err := models.Error{ Code: http.StatusNotImplemented, Message: "Search Index API not enabled in this Rekor instance", diff --git a/pkg/api/public_key.go b/pkg/api/public_key.go index e7e6b0fbc..b4ff91625 100644 --- a/pkg/api/public_key.go +++ b/pkg/api/public_key.go @@ -36,7 +36,7 @@ func GetPublicKeyHandler(params pubkey.GetPublicKeyParams) middleware.Responder // handlers for APIs that may be disabled in a given instance -func GetPublicKeyNotImplementedHandler(params pubkey.GetPublicKeyParams) middleware.Responder { +func GetPublicKeyNotImplementedHandler(_ pubkey.GetPublicKeyParams) middleware.Responder { err := &models.Error{ Code: http.StatusNotImplemented, Message: "Get Public Key API not enabled in this Rekor instance", diff --git a/pkg/api/tlog.go b/pkg/api/tlog.go index 33da70b15..931099915 100644 --- a/pkg/api/tlog.go +++ b/pkg/api/tlog.go @@ -168,7 +168,7 @@ func inactiveShardLogInfo(ctx context.Context, tid int64) (*models.InactiveShard // handlers for APIs that may be disabled in a given instance -func GetLogInfoNotImplementedHandler(params tlog.GetLogInfoParams) middleware.Responder { +func GetLogInfoNotImplementedHandler(_ tlog.GetLogInfoParams) middleware.Responder { err := &models.Error{ Code: http.StatusNotImplemented, Message: "Get Log Info API not enabled in this Rekor instance", @@ -177,7 +177,7 @@ func GetLogInfoNotImplementedHandler(params tlog.GetLogInfoParams) middleware.Re return tlog.NewGetLogInfoDefault(http.StatusNotImplemented).WithPayload(err) } -func GetLogProofNotImplementedHandler(params tlog.GetLogProofParams) middleware.Responder { +func GetLogProofNotImplementedHandler(_ tlog.GetLogProofParams) middleware.Responder { err := &models.Error{ Code: http.StatusNotImplemented, Message: "Get Log Proof API not enabled in this Rekor instance", diff --git a/pkg/fuzz/fuzz_utils.go b/pkg/fuzz/fuzz_utils.go index 15f274cd7..feb38f048 100644 --- a/pkg/fuzz/fuzz_utils.go +++ b/pkg/fuzz/fuzz_utils.go @@ -139,7 +139,7 @@ func setArtifactFields(ff *fuzz.ConsumeFuzzer, props *types.ArtifactProperties) } // creates a file on disk and returns the url of it. -func createAbsFile(ff *fuzz.ConsumeFuzzer, fileName string, fileContents []byte) (*url.URL, error) { +func createAbsFile(_ *fuzz.ConsumeFuzzer, fileName string, fileContents []byte) (*url.URL, error) { file, err := os.Create(fileName) if err != nil { return nil, err diff --git a/pkg/generated/restapi/configure_rekor_server.go b/pkg/generated/restapi/configure_rekor_server.go index 2041f0759..3f4bd5d67 100644 --- a/pkg/generated/restapi/configure_rekor_server.go +++ b/pkg/generated/restapi/configure_rekor_server.go @@ -65,7 +65,7 @@ type apiToRecord struct { path *string // Path to record in metrics, if any. } -func configureFlags(api *operations.RekorServerAPI) { +func configureFlags(_ *operations.RekorServerAPI) { // api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{ ... } } @@ -162,7 +162,7 @@ func configureAPI(api *operations.RekorServerAPI) http.Handler { } // The TLS configuration before HTTPS server starts. -func configureTLS(tlsConfig *tls.Config) { +func configureTLS(_ *tls.Config) { // Make all necessary changes to the TLS configuration here. } @@ -170,7 +170,7 @@ func configureTLS(tlsConfig *tls.Config) { // If you need to modify a config, store server instance to stop it individually later, this is the place. // This function can be called multiple times, depending on the number of serving schemes. // scheme value will be set accordingly: "http", "https" or "unix" -func configureServer(s *http.Server, scheme, addr string) { +func configureServer(_ *http.Server, _, _ string) { } // The middleware configuration is for the handler executors. These do not apply to the swagger.json document. @@ -209,7 +209,7 @@ type zapLogEntry struct { r *http.Request } -func (z *zapLogEntry) Write(status, bytes int, header http.Header, elapsed time.Duration, extra interface{}) { +func (z *zapLogEntry) Write(status, bytes int, _ http.Header, elapsed time.Duration, extra interface{}) { var fields []interface{} // follows https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry as a convention diff --git a/pkg/pki/minisign/minisign.go b/pkg/pki/minisign/minisign.go index 928dfdbcd..0bcb02fa8 100644 --- a/pkg/pki/minisign/minisign.go +++ b/pkg/pki/minisign/minisign.go @@ -114,7 +114,7 @@ func (s Signature) Verify(r io.Reader, k interface{}, opts ...sigsig.VerifyOptio r = bytes.NewReader(h.Sum(nil)) } - return verifier.VerifySignature(bytes.NewReader(s.signature.Signature[:]), r) + return verifier.VerifySignature(bytes.NewReader(s.signature.Signature[:]), r, opts...) } // PublicKey Public Key that follows the minisign standard; supports signify and minisign public keys diff --git a/pkg/pki/minisign/minisign_test.go b/pkg/pki/minisign/minisign_test.go index 4487b4771..c91db0274 100644 --- a/pkg/pki/minisign/minisign_test.go +++ b/pkg/pki/minisign/minisign_test.go @@ -122,7 +122,7 @@ func TestReadSignature(t *testing.T) { type BadReader struct { } -func (br BadReader) Read(p []byte) (n int, err error) { +func (br BadReader) Read(_ []byte) (n int, err error) { return 0, errors.New("test error") } diff --git a/pkg/pki/pgp/pgp.go b/pkg/pki/pgp/pgp.go index fce63ff8a..aee7fa14b 100644 --- a/pkg/pki/pgp/pgp.go +++ b/pkg/pki/pgp/pgp.go @@ -134,7 +134,7 @@ func (s Signature) CanonicalValue() ([]byte, error) { } // Verify implements the pki.Signature interface -func (s Signature) Verify(r io.Reader, k interface{}, opts ...sigsig.VerifyOption) error { +func (s Signature) Verify(r io.Reader, k interface{}, _ ...sigsig.VerifyOption) error { if len(s.signature) == 0 { return fmt.Errorf("PGP signature has not been initialized") } diff --git a/pkg/pki/pgp/pgp_test.go b/pkg/pki/pgp/pgp_test.go index 60ed66c0b..20362f7bd 100644 --- a/pkg/pki/pgp/pgp_test.go +++ b/pkg/pki/pgp/pgp_test.go @@ -94,7 +94,7 @@ func TestReadSignature(t *testing.T) { type BadReader struct { } -func (br BadReader) Read(p []byte) (n int, err error) { +func (br BadReader) Read(_ []byte) (n int, err error) { return 0, errors.New("test error") } diff --git a/pkg/pki/pkcs7/pkcs7.go b/pkg/pki/pkcs7/pkcs7.go index 6fd5757ac..8694844da 100644 --- a/pkg/pki/pkcs7/pkcs7.go +++ b/pkg/pki/pkcs7/pkcs7.go @@ -106,7 +106,7 @@ func (s Signature) CanonicalValue() ([]byte, error) { } // Verify implements the pki.Signature interface -func (s Signature) Verify(r io.Reader, k interface{}, opts ...sigsig.VerifyOption) error { +func (s Signature) Verify(r io.Reader, _ interface{}, _ ...sigsig.VerifyOption) error { if len(*s.raw) == 0 { return fmt.Errorf("PKCS7 signature has not been initialized") } diff --git a/pkg/pki/ssh/ssh.go b/pkg/pki/ssh/ssh.go index a55a0ef89..30f84ba23 100644 --- a/pkg/pki/ssh/ssh.go +++ b/pkg/pki/ssh/ssh.go @@ -51,7 +51,7 @@ func (s Signature) CanonicalValue() ([]byte, error) { } // Verify implements the pki.Signature interface -func (s Signature) Verify(r io.Reader, k interface{}, opts ...sigsig.VerifyOption) error { +func (s Signature) Verify(r io.Reader, k interface{}, _ ...sigsig.VerifyOption) error { if s.signature == nil { return fmt.Errorf("ssh signature has not been initialized") } diff --git a/pkg/pki/tuf/tuf.go b/pkg/pki/tuf/tuf.go index 0a0cf4971..7da68e2e4 100644 --- a/pkg/pki/tuf/tuf.go +++ b/pkg/pki/tuf/tuf.go @@ -78,7 +78,7 @@ func (s Signature) CanonicalValue() ([]byte, error) { } // Verify implements the pki.Signature interface -func (s Signature) Verify(_ io.Reader, k interface{}, opts ...sigsig.VerifyOption) error { +func (s Signature) Verify(_ io.Reader, k interface{}, _ ...sigsig.VerifyOption) error { key, ok := k.(*PublicKey) if !ok { return fmt.Errorf("invalid public key type for: %v", k) diff --git a/pkg/types/alpine/alpine_test.go b/pkg/types/alpine/alpine_test.go index 3d0e10ece..9ab119815 100644 --- a/pkg/types/alpine/alpine_test.go +++ b/pkg/types/alpine/alpine_test.go @@ -39,7 +39,7 @@ func (u UnmarshalFailsTester) NewEntry() types.EntryImpl { return &UnmarshalFailsTester{} } -func (u UnmarshalFailsTester) Unmarshal(pe models.ProposedEntry) error { +func (u UnmarshalFailsTester) Unmarshal(_ models.ProposedEntry) error { return errors.New("error") } diff --git a/pkg/types/cose/cose_test.go b/pkg/types/cose/cose_test.go index 2a0cfb1ed..0371ea47f 100644 --- a/pkg/types/cose/cose_test.go +++ b/pkg/types/cose/cose_test.go @@ -40,7 +40,7 @@ func (u UnmarshalFailsTester) NewEntry() types.EntryImpl { return &UnmarshalFailsTester{} } -func (u UnmarshalFailsTester) Unmarshal(pe models.ProposedEntry) error { +func (u UnmarshalFailsTester) Unmarshal(_ models.ProposedEntry) error { return errors.New("error") } diff --git a/pkg/types/cose/v0.0.1/entry.go b/pkg/types/cose/v0.0.1/entry.go index 531102640..685aacc4d 100644 --- a/pkg/types/cose/v0.0.1/entry.go +++ b/pkg/types/cose/v0.0.1/entry.go @@ -188,7 +188,7 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error { return v.validate() } -func (v *V001Entry) Canonicalize(ctx context.Context) ([]byte, error) { +func (v *V001Entry) Canonicalize(_ context.Context) ([]byte, error) { if v.keyObj == nil { return nil, errors.New("cannot canonicalze empty key") } diff --git a/pkg/types/hashedrekord/hashedrekord_test.go b/pkg/types/hashedrekord/hashedrekord_test.go index 213e13b38..e03395400 100644 --- a/pkg/types/hashedrekord/hashedrekord_test.go +++ b/pkg/types/hashedrekord/hashedrekord_test.go @@ -39,7 +39,7 @@ func (u UnmarshalFailsTester) NewEntry() types.EntryImpl { return &UnmarshalFailsTester{} } -func (u UnmarshalFailsTester) Unmarshal(pe models.ProposedEntry) error { +func (u UnmarshalFailsTester) Unmarshal(_ models.ProposedEntry) error { return errors.New("error") } diff --git a/pkg/types/hashedrekord/v0.0.1/entry.go b/pkg/types/hashedrekord/v0.0.1/entry.go index a386d8a66..36d042dff 100644 --- a/pkg/types/hashedrekord/v0.0.1/entry.go +++ b/pkg/types/hashedrekord/v0.0.1/entry.go @@ -104,7 +104,7 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error { return err } -func (v *V001Entry) Canonicalize(ctx context.Context) ([]byte, error) { +func (v *V001Entry) Canonicalize(_ context.Context) ([]byte, error) { sigObj, keyObj, err := v.validate() if err != nil { return nil, types.ValidationError(err) @@ -189,7 +189,7 @@ func (v *V001Entry) validate() (pki.Signature, pki.PublicKey, error) { return sigObj, keyObj, nil } -func (v V001Entry) CreateFromArtifactProperties(ctx context.Context, props types.ArtifactProperties) (models.ProposedEntry, error) { +func (v V001Entry) CreateFromArtifactProperties(_ context.Context, props types.ArtifactProperties) (models.ProposedEntry, error) { returnVal := models.Hashedrekord{} re := V001Entry{} diff --git a/pkg/types/helm/helm_test.go b/pkg/types/helm/helm_test.go index a8d2fdadd..db9d7a775 100644 --- a/pkg/types/helm/helm_test.go +++ b/pkg/types/helm/helm_test.go @@ -39,7 +39,7 @@ func (u UnmarshalFailsTester) NewEntry() types.EntryImpl { return &UnmarshalFailsTester{} } -func (u UnmarshalFailsTester) Unmarshal(pe models.ProposedEntry) error { +func (u UnmarshalFailsTester) Unmarshal(_ models.ProposedEntry) error { return errors.New("error") } diff --git a/pkg/types/intoto/intoto_test.go b/pkg/types/intoto/intoto_test.go index 7feeb2afa..af4c90f13 100644 --- a/pkg/types/intoto/intoto_test.go +++ b/pkg/types/intoto/intoto_test.go @@ -39,7 +39,7 @@ func (u UnmarshalFailsTester) NewEntry() types.EntryImpl { return &UnmarshalFailsTester{} } -func (u UnmarshalFailsTester) Unmarshal(pe models.ProposedEntry) error { +func (u UnmarshalFailsTester) Unmarshal(_ models.ProposedEntry) error { return errors.New("error") } diff --git a/pkg/types/intoto/v0.0.1/entry.go b/pkg/types/intoto/v0.0.1/entry.go index 8b84dec72..1e2c0e8ce 100644 --- a/pkg/types/intoto/v0.0.1/entry.go +++ b/pkg/types/intoto/v0.0.1/entry.go @@ -183,7 +183,7 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error { return v.validate() } -func (v *V001Entry) Canonicalize(ctx context.Context) ([]byte, error) { +func (v *V001Entry) Canonicalize(_ context.Context) ([]byte, error) { if v.keyObj == nil { return nil, errors.New("cannot canonicalize empty key") } diff --git a/pkg/types/intoto/v0.0.2/entry.go b/pkg/types/intoto/v0.0.2/entry.go index 083e93747..93080267f 100644 --- a/pkg/types/intoto/v0.0.2/entry.go +++ b/pkg/types/intoto/v0.0.2/entry.go @@ -211,7 +211,7 @@ func (v *V002Entry) Unmarshal(pe models.ProposedEntry) error { return nil } -func (v *V002Entry) Canonicalize(ctx context.Context) ([]byte, error) { +func (v *V002Entry) Canonicalize(_ context.Context) ([]byte, error) { if err := v.IntotoObj.Validate(strfmt.Default); err != nil { return nil, err } diff --git a/pkg/types/jar/jar_test.go b/pkg/types/jar/jar_test.go index b41f6e278..4e43b747a 100644 --- a/pkg/types/jar/jar_test.go +++ b/pkg/types/jar/jar_test.go @@ -38,7 +38,7 @@ func (u UnmarshalFailsTester) NewEntry() types.EntryImpl { return &UnmarshalFailsTester{} } -func (u UnmarshalFailsTester) Unmarshal(pe models.ProposedEntry) error { +func (u UnmarshalFailsTester) Unmarshal(_ models.ProposedEntry) error { return errors.New("error") } diff --git a/pkg/types/jar/v0.0.1/entry.go b/pkg/types/jar/v0.0.1/entry.go index ab85ccd5a..f93a810a0 100644 --- a/pkg/types/jar/v0.0.1/entry.go +++ b/pkg/types/jar/v0.0.1/entry.go @@ -110,7 +110,7 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error { return v.validate() } -func (v *V001Entry) fetchExternalEntities(ctx context.Context) (*pkcs7.PublicKey, *pkcs7.Signature, error) { +func (v *V001Entry) fetchExternalEntities(_ context.Context) (*pkcs7.PublicKey, *pkcs7.Signature, error) { if err := v.validate(); err != nil { return nil, nil, types.ValidationError(err) } diff --git a/pkg/types/rekord/rekord_test.go b/pkg/types/rekord/rekord_test.go index dace7f170..7d1694105 100644 --- a/pkg/types/rekord/rekord_test.go +++ b/pkg/types/rekord/rekord_test.go @@ -39,7 +39,7 @@ func (u UnmarshalFailsTester) NewEntry() types.EntryImpl { return &UnmarshalFailsTester{} } -func (u UnmarshalFailsTester) Unmarshal(pe models.ProposedEntry) error { +func (u UnmarshalFailsTester) Unmarshal(_ models.ProposedEntry) error { return errors.New("error") } diff --git a/pkg/types/rfc3161/rfc3161_test.go b/pkg/types/rfc3161/rfc3161_test.go index 36a146db1..f9a6b3f42 100644 --- a/pkg/types/rfc3161/rfc3161_test.go +++ b/pkg/types/rfc3161/rfc3161_test.go @@ -39,7 +39,7 @@ func (u UnmarshalFailsTester) NewEntry() types.EntryImpl { return &UnmarshalFailsTester{} } -func (u UnmarshalFailsTester) Unmarshal(pe models.ProposedEntry) error { +func (u UnmarshalFailsTester) Unmarshal(_ models.ProposedEntry) error { return errors.New("error") } diff --git a/pkg/types/rfc3161/v0.0.1/entry.go b/pkg/types/rfc3161/v0.0.1/entry.go index eed8bfae8..6033d14c3 100644 --- a/pkg/types/rfc3161/v0.0.1/entry.go +++ b/pkg/types/rfc3161/v0.0.1/entry.go @@ -118,7 +118,7 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error { return nil } -func (v *V001Entry) Canonicalize(ctx context.Context) ([]byte, error) { +func (v *V001Entry) Canonicalize(_ context.Context) ([]byte, error) { if v.tsrContent == nil { return nil, errors.New("tsr content must be set before canonicalizing") } diff --git a/pkg/types/rpm/rpm_test.go b/pkg/types/rpm/rpm_test.go index 747cc9a0f..d365238bd 100644 --- a/pkg/types/rpm/rpm_test.go +++ b/pkg/types/rpm/rpm_test.go @@ -39,7 +39,7 @@ func (u UnmarshalFailsTester) NewEntry() types.EntryImpl { return &UnmarshalFailsTester{} } -func (u UnmarshalFailsTester) Unmarshal(pe models.ProposedEntry) error { +func (u UnmarshalFailsTester) Unmarshal(_ models.ProposedEntry) error { return errors.New("error") } diff --git a/pkg/types/test_util.go b/pkg/types/test_util.go index e65f57465..ee8d57022 100644 --- a/pkg/types/test_util.go +++ b/pkg/types/test_util.go @@ -43,11 +43,11 @@ func (u BaseUnmarshalTester) IndexKeys() ([]string, error) { return []string{}, nil } -func (u BaseUnmarshalTester) Canonicalize(ctx context.Context) ([]byte, error) { +func (u BaseUnmarshalTester) Canonicalize(_ context.Context) ([]byte, error) { return nil, nil } -func (u BaseUnmarshalTester) Unmarshal(pe models.ProposedEntry) error { +func (u BaseUnmarshalTester) Unmarshal(_ models.ProposedEntry) error { return nil } @@ -73,14 +73,14 @@ func (b BaseProposedEntryTester) Kind() string { return "nil" } -func (b BaseProposedEntryTester) SetKind(v string) { +func (b BaseProposedEntryTester) SetKind(_ string) { } -func (b BaseProposedEntryTester) Validate(r strfmt.Registry) error { +func (b BaseProposedEntryTester) Validate(_ strfmt.Registry) error { return nil } -func (b BaseProposedEntryTester) ContextValidate(ctx context.Context, r strfmt.Registry) error { +func (b BaseProposedEntryTester) ContextValidate(_ context.Context, _ strfmt.Registry) error { return nil } diff --git a/pkg/types/tuf/tuf_test.go b/pkg/types/tuf/tuf_test.go index a08cbb971..16a9fb96f 100644 --- a/pkg/types/tuf/tuf_test.go +++ b/pkg/types/tuf/tuf_test.go @@ -43,7 +43,7 @@ func (u UnmarshalFailsTester) Verifier() (pki.PublicKey, error) { return nil, nil } -func (u UnmarshalFailsTester) Unmarshal(pe models.ProposedEntry) error { +func (u UnmarshalFailsTester) Unmarshal(_ models.ProposedEntry) error { return errors.New("error") } diff --git a/pkg/types/types_test.go b/pkg/types/types_test.go index ea7c5302e..7d9ca6647 100644 --- a/pkg/types/types_test.go +++ b/pkg/types/types_test.go @@ -38,11 +38,11 @@ func (e InvalidEntry) Kind() string { func (e InvalidEntry) SetKind(string) {} -func (e InvalidEntry) Validate(formats strfmt.Registry) error { +func (e InvalidEntry) Validate(_ strfmt.Registry) error { return nil } -func (e InvalidEntry) ContextValidate(context context.Context, formats strfmt.Registry) error { +func (e InvalidEntry) ContextValidate(_ context.Context, _ strfmt.Registry) error { return nil } @@ -57,11 +57,11 @@ func (e UnmarshalErrorValidEntry) Kind() string { func (e UnmarshalErrorValidEntry) SetKind(string) {} -func (e UnmarshalErrorValidEntry) Validate(formats strfmt.Registry) error { +func (e UnmarshalErrorValidEntry) Validate(_ strfmt.Registry) error { return errors.New("invalid content") } -func (e UnmarshalErrorValidEntry) ContextValidate(context context.Context, formats strfmt.Registry) error { +func (e UnmarshalErrorValidEntry) ContextValidate(_ context.Context, _ strfmt.Registry) error { return nil } diff --git a/pkg/verify/verify_test.go b/pkg/verify/verify_test.go index 7cc7ded84..02dd06ad6 100644 --- a/pkg/verify/verify_test.go +++ b/pkg/verify/verify_test.go @@ -38,7 +38,7 @@ type TlogClient struct { LogInfo models.LogInfo } -func (m *TlogClient) GetLogProof(params *tlog.GetLogProofParams, opts ...tlog.ClientOption) (*tlog.GetLogProofOK, error) { +func (m *TlogClient) GetLogProof(_ *tlog.GetLogProofParams, _ ...tlog.ClientOption) (*tlog.GetLogProofOK, error) { return &tlog.GetLogProofOK{ Payload: &models.ConsistencyProof{ Hashes: m.Proof, @@ -46,14 +46,14 @@ func (m *TlogClient) GetLogProof(params *tlog.GetLogProofParams, opts ...tlog.Cl }}, nil } -func (m *TlogClient) GetLogInfo(params *tlog.GetLogInfoParams, opts ...tlog.ClientOption) (*tlog.GetLogInfoOK, error) { +func (m *TlogClient) GetLogInfo(_ *tlog.GetLogInfoParams, _ ...tlog.ClientOption) (*tlog.GetLogInfoOK, error) { return &tlog.GetLogInfoOK{ Payload: &m.LogInfo, }, nil } // TODO: Implement mock -func (m *TlogClient) SetTransport(transport runtime.ClientTransport) { +func (m *TlogClient) SetTransport(_ runtime.ClientTransport) { } func TestConsistency(t *testing.T) {