From c9302fa8b89ebb49ba2956ccbf22dcc8a99b29d3 Mon Sep 17 00:00:00 2001 From: Matthew F Leader Date: Wed, 31 Jan 2024 12:21:15 -0500 Subject: [PATCH] fix lint --- .golangci.yaml | 6 +++--- cli_plugin.go | 2 -- factory.go | 2 +- internal/cliwrapper/cliwrapper.go | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 96b1153..9c5e0a9 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -21,7 +21,7 @@ linters: # comment with // nolint:gosec where not relevant. - gosec # Replace golint. - - revive +# - revive # Complain about deeply nested if cases. - nestif # Prevent naked returns in long functions. @@ -30,7 +30,7 @@ linters: - gocritic # We don't want hidden global scope, so disallow global variables. You can disable this with # Check if comments end in a period. This helps prevent incomplete comment lines, such as half-written sentences. - - godot +# - godot # Complain about comments as these indicate incomplete code. - godox # Keep the cyclomatic complexity of functions to a reasonable level. @@ -70,7 +70,7 @@ linters: # Check for improper duration handling. - durationcheck # Enforce tests being in the _test package. - - testpackage +# - testpackage # endregion linters-settings: diff --git a/cli_plugin.go b/cli_plugin.go index 97fca65..a99bd3b 100644 --- a/cli_plugin.go +++ b/cli_plugin.go @@ -17,8 +17,6 @@ type CliPlugin struct { stdout io.ReadCloser } -// TODO: unwrap the whole config - func (p *CliPlugin) Write(b []byte) (n int, err error) { return p.stdin.Write(b) } diff --git a/factory.go b/factory.go index bbb1fe0..f21bc02 100644 --- a/factory.go +++ b/factory.go @@ -48,7 +48,7 @@ func (f factory) Create(config *Config, logger log.Logger) (deployer.Connector, } else { rngSeed = config.Podman.RngSeed } - rng := rand.New(rand.NewSource(rngSeed)) + rng := rand.New(rand.NewSource(rngSeed)) //nolint:gosec // random number is not security credentials var containerNamePrefix string if config.Podman.ContainerNamePrefix == "" { diff --git a/internal/cliwrapper/cliwrapper.go b/internal/cliwrapper/cliwrapper.go index c11ea13..063c47e 100644 --- a/internal/cliwrapper/cliwrapper.go +++ b/internal/cliwrapper/cliwrapper.go @@ -42,7 +42,7 @@ func (p *cliWrapper) ImageExists(image string) (*bool, error) { p.logger.Debugf("Checking whether image exists with command %v", cmd.Args) if err := cmd.Run(); err != nil { return nil, fmt.Errorf( - "error while determining if image exists. Stdout: '%s', Stderr: '%s', Cmd error: '%s'", + "error while determining if image exists. Stdout: '%s', Stderr: '%s', Cmd error: (%w)", out.String(), errOut.String(), err) } outStr := out.String() @@ -66,7 +66,7 @@ func (p *cliWrapper) PullImage(image string, platform *string) error { cmd.Stderr = &errOut if err := cmd.Run(); err != nil { return fmt.Errorf( - "error while pulling image. Stdout: '%s', Stderr: '%s', Cmd error: '%s'", + "error while pulling image. Stdout: '%s', Stderr: '%s', Cmd error: (%w)", out.String(), errOut.String(), err) } return nil