From b34af70dcdc099a6c78660f2a33a5337275ce93b Mon Sep 17 00:00:00 2001 From: cpanato Date: Thu, 2 May 2024 14:12:02 +0200 Subject: [PATCH] fix lints Signed-off-by: cpanato --- .github/workflows/build-snapshot.yaml | 24 ------------------------ cmd/fetch-tsa-certs/fetch_tsa_certs.go | 4 ++-- cmd/timestamp-cli/app/format/wrap.go | 2 +- cmd/timestamp-cli/app/inspect.go | 4 ++-- cmd/timestamp-cli/app/root.go | 2 +- cmd/timestamp-cli/app/timestamp.go | 4 ++-- cmd/timestamp-cli/app/verify.go | 4 ++-- cmd/timestamp-server/app/serve.go | 2 +- pkg/signer/signer.go | 2 +- 9 files changed, 12 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build-snapshot.yaml b/.github/workflows/build-snapshot.yaml index 5ce1b32ac..6772390e4 100644 --- a/.github/workflows/build-snapshot.yaml +++ b/.github/workflows/build-snapshot.yaml @@ -42,27 +42,3 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} LDFLAGS: ${{ env.GO_FLAGS }} - - - name: Generate subject - id: hash - env: - ARTIFACTS: "${{ steps.run-goreleaser.outputs.artifacts }}" - run: | - set -euo pipefail - checksum_file=$(echo "$ARTIFACTS" | jq -r '.[] | select (.type=="Checksum") | .path') - echo "hashes=$(cat $checksum_file | base64 -w0)" >> "$GITHUB_OUTPUT" - - - name: Set tag output - id: tag - run: echo "tag_name=${GITHUB_REF#refs/*/}" >> "$GITHUB_OUTPUT" - - provenance: - needs: - - snapshot - permissions: - actions: read # To read the workflow path. - uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.10.0 - with: - base64-subjects: "${{ needs.release.outputs.hashes }}" - upload-assets: false - continue-on-error: true diff --git a/cmd/fetch-tsa-certs/fetch_tsa_certs.go b/cmd/fetch-tsa-certs/fetch_tsa_certs.go index 012cccd7c..fe18517c8 100644 --- a/cmd/fetch-tsa-certs/fetch_tsa_certs.go +++ b/cmd/fetch-tsa-certs/fetch_tsa_certs.go @@ -85,7 +85,7 @@ func fetchCertificateChain(ctx context.Context, parent, intermediateKMSKey, leaf if err != nil { return nil, err } - intermediateSigner, _, err := intermediateKMSSigner.CryptoSigner(ctx, func(err error) {}) + intermediateSigner, _, err := intermediateKMSSigner.CryptoSigner(ctx, func(_ error) {}) if err != nil { return nil, err } @@ -176,7 +176,7 @@ func fetchCertificateChain(ctx context.Context, parent, intermediateKMSKey, leaf if err != nil { return nil, err } - leafKMSSigner, _, err = kmsSigner.CryptoSigner(ctx, func(err error) {}) + leafKMSSigner, _, err = kmsSigner.CryptoSigner(ctx, func(_ error) {}) if err != nil { return nil, err } diff --git a/cmd/timestamp-cli/app/format/wrap.go b/cmd/timestamp-cli/app/format/wrap.go index 8148b26ac..e2fbb6c8f 100644 --- a/cmd/timestamp-cli/app/format/wrap.go +++ b/cmd/timestamp-cli/app/format/wrap.go @@ -29,7 +29,7 @@ type CobraCmd func(cmd *cobra.Command, args []string) type formatCmd func(args []string) (interface{}, error) func WrapCmd(f formatCmd) CobraCmd { - return func(cmd *cobra.Command, args []string) { + return func(_ *cobra.Command, args []string) { obj, err := f(args) if err != nil { log.CliLogger.Fatal(err) diff --git a/cmd/timestamp-cli/app/inspect.go b/cmd/timestamp-cli/app/inspect.go index aa724b7ad..b2440348e 100644 --- a/cmd/timestamp-cli/app/inspect.go +++ b/cmd/timestamp-cli/app/inspect.go @@ -44,13 +44,13 @@ var inspectCmd = &cobra.Command{ Use: "inspect", Short: "Inspect timestamp", Long: "Inspect the signed timestamp response.", - PreRunE: func(cmd *cobra.Command, args []string) error { + PreRunE: func(cmd *cobra.Command, _ []string) error { if err := viper.BindPFlags(cmd.Flags()); err != nil { log.CliLogger.Fatal("Error initializing cmd line args: ", err) } return nil }, - Run: format.WrapCmd(func(args []string) (interface{}, error) { + Run: format.WrapCmd(func(_ []string) (interface{}, error) { tsr := viper.GetString("timestamp") tsrBytes, err := os.ReadFile(filepath.Clean(tsr)) if err != nil { diff --git a/cmd/timestamp-cli/app/root.go b/cmd/timestamp-cli/app/root.go index 45f628eb6..6b5c8ac86 100644 --- a/cmd/timestamp-cli/app/root.go +++ b/cmd/timestamp-cli/app/root.go @@ -32,7 +32,7 @@ var rootCmd = &cobra.Command{ Use: "timestamp-cli", Short: "Timestamp CLI", Long: `Timestamp command line interface tool`, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { + PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { return initConfig(cmd) }, } diff --git a/cmd/timestamp-cli/app/timestamp.go b/cmd/timestamp-cli/app/timestamp.go index 42d6e3313..c7e4b79ff 100644 --- a/cmd/timestamp-cli/app/timestamp.go +++ b/cmd/timestamp-cli/app/timestamp.go @@ -60,13 +60,13 @@ var timestampCmd = &cobra.Command{ Use: "timestamp", Short: "Signed timestamp command", Long: "Fetches a signed RFC 3161 timestamp. The timestamp response can be verified locally using a timestamp certificate chain.", - PreRunE: func(cmd *cobra.Command, args []string) error { + PreRunE: func(cmd *cobra.Command, _ []string) error { if err := viper.BindPFlags(cmd.Flags()); err != nil { log.CliLogger.Fatal("Error initializing cmd line args: ", err) } return nil }, - Run: format.WrapCmd(func(args []string) (interface{}, error) { + Run: format.WrapCmd(func(_ []string) (interface{}, error) { return runTimestamp() }), } diff --git a/cmd/timestamp-cli/app/verify.go b/cmd/timestamp-cli/app/verify.go index b995b5aba..68036ce53 100644 --- a/cmd/timestamp-cli/app/verify.go +++ b/cmd/timestamp-cli/app/verify.go @@ -60,13 +60,13 @@ var verifyCmd = &cobra.Command{ Use: "verify", Short: "Verify timestamp", Long: "Verify the timestamp response using a timestamp certificate chain.", - PreRunE: func(cmd *cobra.Command, args []string) error { + PreRunE: func(cmd *cobra.Command, _ []string) error { if err := viper.BindPFlags(cmd.Flags()); err != nil { log.CliLogger.Fatal("Error initializing cmd line args: ", err) } return nil }, - Run: format.WrapCmd(func(args []string) (interface{}, error) { + Run: format.WrapCmd(func(_ []string) (interface{}, error) { return runVerify() }), } diff --git a/cmd/timestamp-server/app/serve.go b/cmd/timestamp-server/app/serve.go index 47bb96e17..e7b4bfbfb 100644 --- a/cmd/timestamp-server/app/serve.go +++ b/cmd/timestamp-server/app/serve.go @@ -33,7 +33,7 @@ var serveCmd = &cobra.Command{ Use: "serve", Short: "start http server with configured api", Long: `Starts a http server and serves the configured api`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { if err := viper.BindPFlags(cmd.Flags()); err != nil { log.Logger.Fatal(err) } diff --git a/pkg/signer/signer.go b/pkg/signer/signer.go index b9b9663ae..ee79d53d4 100644 --- a/pkg/signer/signer.go +++ b/pkg/signer/signer.go @@ -49,7 +49,7 @@ func NewCryptoSigner(ctx context.Context, hash crypto.Hash, signer, kmsKey, tink if err != nil { return nil, err } - s, _, err := signer.CryptoSigner(ctx, func(err error) {}) + s, _, err := signer.CryptoSigner(ctx, func(_ error) {}) return s, err case TinkScheme: primaryKey, err := GetPrimaryKey(ctx, tinkKmsKey, hcVaultToken)