From bf7ca4dc4b77e5fca64d75e9a1938f465b804130 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 21 Aug 2024 16:55:33 +0200 Subject: [PATCH] container/stream: fix non-constant format string in call (govet) container/stream/streams.go:111:21: printf: non-constant format string in call to fmt.Errorf (govet) return fmt.Errorf(strings.Join(errors, "\n")) ^ Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 4a93233b8830ad5448ed7c848555f9b379b90ed1) Signed-off-by: Sebastiaan van Stijn --- container/stream/streams.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/container/stream/streams.go b/container/stream/streams.go index 78ec048396..b64e3a3969 100644 --- a/container/stream/streams.go +++ b/container/stream/streams.go @@ -2,6 +2,7 @@ package stream // import "github.com/docker/docker/container/stream" import ( "context" + "errors" "fmt" "io" "strings" @@ -91,24 +92,24 @@ func (c *Config) NewNopInputPipe() { // CloseStreams ensures that the configured streams are properly closed. func (c *Config) CloseStreams() error { - var errors []string + var errs []string if c.stdin != nil { if err := c.stdin.Close(); err != nil { - errors = append(errors, fmt.Sprintf("error close stdin: %s", err)) + errs = append(errs, fmt.Sprintf("error close stdin: %s", err)) } } if err := c.stdout.Clean(); err != nil { - errors = append(errors, fmt.Sprintf("error close stdout: %s", err)) + errs = append(errs, fmt.Sprintf("error close stdout: %s", err)) } if err := c.stderr.Clean(); err != nil { - errors = append(errors, fmt.Sprintf("error close stderr: %s", err)) + errs = append(errs, fmt.Sprintf("error close stderr: %s", err)) } - if len(errors) > 0 { - return fmt.Errorf(strings.Join(errors, "\n")) + if len(errs) > 0 { + return errors.New(strings.Join(errs, "\n")) } return nil