From fadc718dbabc1620705e2e411a9ef3286a120e7f Mon Sep 17 00:00:00 2001 From: Tore Martin Hagen Date: Mon, 26 Aug 2024 13:48:27 +0200 Subject: [PATCH] Fixed lint warnings --- cmd/kosli/attestation.go | 2 +- cmd/kosli/cli_utils.go | 2 +- internal/requests/requests.go | 2 +- internal/sonar/sonar.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/kosli/attestation.go b/cmd/kosli/attestation.go index d7fe697ad..bb96c728b 100644 --- a/cmd/kosli/attestation.go +++ b/cmd/kosli/attestation.go @@ -169,7 +169,7 @@ func newAttestationForm(payload interface{}, attachments []string) ( func wrapAttestationError(err error) error { if err != nil { - return fmt.Errorf(strings.Replace(err.Error(), "requires at least one of: artifact_fingerprint or git_commit_info.", + return fmt.Errorf("%s", strings.Replace(err.Error(), "requires at least one of: artifact_fingerprint or git_commit_info.", "requires at least one of: specifying the fingerprint (either by calculating it using the artifact name/path and --artifact-type, or by providing it using --fingerprint) or providing --commit (requires an available git repo to access commit details)", 1)) } return err diff --git a/cmd/kosli/cli_utils.go b/cmd/kosli/cli_utils.go index 1fdd58ef2..dd35ce76b 100644 --- a/cmd/kosli/cli_utils.go +++ b/cmd/kosli/cli_utils.go @@ -493,7 +493,7 @@ func ValidateArtifactArg(args []string, artifactType, inputSha256 string, always if argsWithLeadingSpace { errMsg = append(errMsg, "Arguments with a leading space are probably caused by a lone backslash that has a space after it.") } - return fmt.Errorf(strings.Join(errMsg, "\n")) + return fmt.Errorf("%s", strings.Join(errMsg, "\n")) } if len(args) == 0 || args[0] == "" { diff --git a/internal/requests/requests.go b/internal/requests/requests.go index f4eec2320..2704a1a70 100644 --- a/internal/requests/requests.go +++ b/internal/requests/requests.go @@ -233,7 +233,7 @@ func (c *Client) Do(p *RequestParams) (*HTTPResponse, error) { cleanedErrorMessage = fmt.Sprintf("%s", respBodyMap) } } - return nil, fmt.Errorf(cleanedErrorMessage) + return nil, fmt.Errorf("%s", cleanedErrorMessage) } return &HTTPResponse{string(body), resp}, nil } diff --git a/internal/sonar/sonar.go b/internal/sonar/sonar.go index d8f83aaa7..fe381907a 100644 --- a/internal/sonar/sonar.go +++ b/internal/sonar/sonar.go @@ -116,7 +116,7 @@ func (sc *SonarConfig) GetSonarResults() (*SonarResults, error) { message = fmt.Sprintf("%s\n", message) } } - return nil, fmt.Errorf(message) + return nil, fmt.Errorf("%s", message) } return sonarResult, nil