From 81105cf716d7a7a5b5415554ffcf8b59b2396d4b Mon Sep 17 00:00:00 2001 From: Ravi Chamarthy Date: Mon, 26 Aug 2024 17:36:29 -0700 Subject: [PATCH] chore: fix linter errors (#634) Signed-off-by: Ravi Chamarthy --- pkg/container/container.go | 4 ++-- pkg/log/log.go | 2 +- pkg/squashfs/squashfs.go | 4 ++-- pkg/types/layer_type.go | 2 +- pkg/types/stackerfile.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/container/container.go b/pkg/container/container.go index a0789183..b85e0587 100644 --- a/pkg/container/container.go +++ b/pkg/container/container.go @@ -116,9 +116,9 @@ func (c *Container) containerError(theErr error, msg string) error { } for _, err := range lxcErrors { - log.Debugf(err) + log.Debugf("%s", err) } - return errors.Wrapf(theErr, msg) + return errors.Wrap(theErr, msg) } func (c *Container) Execute(args []string, stdin io.Reader) error { diff --git a/pkg/log/log.go b/pkg/log/log.go index c8a8c280..e197dd15 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -75,7 +75,7 @@ func (th *TextHandler) HandleLog(e *log.Entry) error { } } - _, err := th.out.WriteString(fmt.Sprintf(e.Message)) + _, err := th.out.WriteString(e.Message) if err != nil { return err } diff --git a/pkg/squashfs/squashfs.go b/pkg/squashfs/squashfs.go index 7d82a533..c562a732 100644 --- a/pkg/squashfs/squashfs.go +++ b/pkg/squashfs/squashfs.go @@ -625,7 +625,7 @@ func ExtractSingleSquashPolicy(squashFile, extractDir string, policy *ExtractPol policy.Excuses = map[string]error{} } - if policy.Extractors == nil || len(policy.Extractors) == 0 { + if len(policy.Extractors) == 0 { policy.Excuses[initName] = errors.Errorf("policy had no extractors") return policy.Excuses[initName] } @@ -647,7 +647,7 @@ func ExtractSingleSquashPolicy(squashFile, extractDir string, policy *ExtractPol } // nothing worked. populate Excuses[initName] - policy.Excuses[initName] = errors.Errorf("No suitable extractor found:\n " + strings.Join(allExcuses, "\n ")) + policy.Excuses[initName] = errors.Errorf("No suitable extractor found:\n %s", strings.Join(allExcuses, "\n ")) return policy.Excuses[initName] } diff --git a/pkg/types/layer_type.go b/pkg/types/layer_type.go index 7404a7b2..889e2e4b 100644 --- a/pkg/types/layer_type.go +++ b/pkg/types/layer_type.go @@ -19,7 +19,7 @@ type LayerType struct { func (lt LayerType) String() string { if lt.Verity { - return fmt.Sprintf(lt.Type + "+verity") + return fmt.Sprintf("%s+verity", lt.Type) } return lt.Type } diff --git a/pkg/types/stackerfile.go b/pkg/types/stackerfile.go index e5dae0bc..5ae33287 100644 --- a/pkg/types/stackerfile.go +++ b/pkg/types/stackerfile.go @@ -123,7 +123,7 @@ func substitute(content string, substitutions []string) (string, error) { if len(unsupported_messages) > 0 { for _, msg := range unsupported_messages { - log.Errorf(msg) + log.Errorf("%s", msg) } return "", errors.Errorf("%d instances of unsupported placeholders found. Review log for how to update.", len(unsupported_messages)) }