diff --git a/cmd/compose/build.go b/cmd/compose/build.go index c9bfd2a65..298d3b675 100644 --- a/cmd/compose/build.go +++ b/cmd/compose/build.go @@ -110,16 +110,16 @@ func buildCommand(p *projectOptions, backend api.Service) *cobra.Command { cmd.Flags().StringArrayVar(&opts.args, "build-arg", []string{}, "Set build-time variables for services.") cmd.Flags().StringVar(&opts.ssh, "ssh", "", "Set SSH authentications used when building service images. (use 'default' for using your default SSH Agent)") cmd.Flags().Bool("parallel", true, "Build images in parallel. DEPRECATED") - cmd.Flags().MarkHidden("parallel") // nolint:errcheck + cmd.Flags().MarkHidden("parallel") //nolint:errcheck cmd.Flags().Bool("compress", true, "Compress the build context using gzip. DEPRECATED") - cmd.Flags().MarkHidden("compress") // nolint:errcheck + cmd.Flags().MarkHidden("compress") //nolint:errcheck cmd.Flags().Bool("force-rm", true, "Always remove intermediate containers. DEPRECATED") - cmd.Flags().MarkHidden("force-rm") // nolint:errcheck + cmd.Flags().MarkHidden("force-rm") //nolint:errcheck cmd.Flags().BoolVar(&opts.noCache, "no-cache", false, "Do not use cache when building the image") cmd.Flags().Bool("no-rm", false, "Do not remove intermediate containers after a successful build. DEPRECATED") - cmd.Flags().MarkHidden("no-rm") // nolint:errcheck + cmd.Flags().MarkHidden("no-rm") //nolint:errcheck cmd.Flags().StringVarP(&opts.memory, "memory", "m", "", "Set memory limit for the build container. Not supported on buildkit yet.") - cmd.Flags().MarkHidden("memory") // nolint:errcheck + cmd.Flags().MarkHidden("memory") //nolint:errcheck return cmd } diff --git a/cmd/formatter/logs.go b/cmd/formatter/logs.go index 71bbb2ba8..b5bc37361 100644 --- a/cmd/formatter/logs.go +++ b/cmd/formatter/logs.go @@ -89,14 +89,14 @@ func (l *logConsumer) Log(container, service, message string) { } p := l.getPresenter(container) for _, line := range strings.Split(message, "\n") { - fmt.Fprintf(l.writer, "%s%s\n", p.prefix, line) // nolint:errcheck + fmt.Fprintf(l.writer, "%s%s\n", p.prefix, line) //nolint:errcheck } } func (l *logConsumer) Status(container, msg string) { p := l.getPresenter(container) s := p.colors(fmt.Sprintf("%s %s\n", container, msg)) - l.writer.Write([]byte(s)) // nolint:errcheck + l.writer.Write([]byte(s)) //nolint:errcheck } func (l *logConsumer) computeWidth() { diff --git a/pkg/compose/attach.go b/pkg/compose/attach.go index 42b815f3f..52e905193 100644 --- a/pkg/compose/attach.go +++ b/pkg/compose/attach.go @@ -127,9 +127,9 @@ func (s *composeService) attachContainerStreams(ctx context.Context, container s if stdout != nil { go func() { if tty { - io.Copy(stdout, streamOut) // nolint:errcheck + io.Copy(stdout, streamOut) //nolint:errcheck } else { - stdcopy.StdCopy(stdout, stderr, streamOut) // nolint:errcheck + stdcopy.StdCopy(stdout, stderr, streamOut) //nolint:errcheck } }() } diff --git a/pkg/compose/build_classic.go b/pkg/compose/build_classic.go index e45ed90ee..db5d948e3 100644 --- a/pkg/compose/build_classic.go +++ b/pkg/compose/build_classic.go @@ -64,7 +64,7 @@ func (s *composeService) doBuildClassic(ctx context.Context, project *types.Proj return nameDigests, errs } -// nolint: gocyclo +//nolint: gocyclo func (s *composeService) doBuildClassicSimpleImage(ctx context.Context, options buildx.Options) (string, error) { var ( buildCtx io.ReadCloser @@ -96,7 +96,7 @@ func (s *composeService) doBuildClassicSimpleImage(ctx context.Context, options if err != nil { return "", errors.Errorf("unable to open Dockerfile: %v", err) } - defer dockerfileCtx.Close() // nolint:errcheck + defer dockerfileCtx.Close() //nolint:errcheck } case urlutil.IsGitURL(specifiedContext): tempDir, relDockerfile, err = build.GetContextFromGitURL(specifiedContext, dockerfileName) @@ -111,7 +111,7 @@ func (s *composeService) doBuildClassicSimpleImage(ctx context.Context, options } if tempDir != "" { - defer os.RemoveAll(tempDir) // nolint:errcheck + defer os.RemoveAll(tempDir) //nolint:errcheck contextDir = tempDir } @@ -175,7 +175,7 @@ func (s *composeService) doBuildClassicSimpleImage(ctx context.Context, options if err != nil { return "", err } - defer response.Body.Close() // nolint:errcheck + defer response.Body.Close() //nolint:errcheck imageID := "" aux := func(msg jsonmessage.JSONMessage) { diff --git a/pkg/compose/logs.go b/pkg/compose/logs.go index 7f2520745..7d26c815a 100644 --- a/pkg/compose/logs.go +++ b/pkg/compose/logs.go @@ -95,7 +95,7 @@ func (s *composeService) logContainers(ctx context.Context, consumer api.LogCons if err != nil { return err } - defer r.Close() // nolint errcheck + defer r.Close() //nolint errcheck name := getContainerNameWithoutProject(c) w := utils.GetWriter(func(line string) { diff --git a/pkg/compose/up.go b/pkg/compose/up.go index a20591b1f..b94c01f61 100644 --- a/pkg/compose/up.go +++ b/pkg/compose/up.go @@ -60,7 +60,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options return progress.Run(ctx, func(ctx context.Context) error { go func() { <-signalChan - s.Kill(ctx, project.Name, api.KillOptions{ // nolint:errcheck + s.Kill(ctx, project.Name, api.KillOptions{ //nolint:errcheck Services: project.ServiceNames(), }) }() @@ -74,7 +74,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options <-signalChan printer.Cancel() fmt.Println("Gracefully stopping... (press Ctrl+C again to force)") - stopFunc() // nolint:errcheck + stopFunc() //nolint:errcheck }() var exitCode int diff --git a/pkg/e2e/compose_test.go b/pkg/e2e/compose_test.go index f2ac2ad18..fd430488d 100644 --- a/pkg/e2e/compose_test.go +++ b/pkg/e2e/compose_test.go @@ -134,7 +134,7 @@ func TestDownComposefileInParentFolder(t *testing.T) { tmpFolder, err := os.MkdirTemp("fixtures/simple-composefile", "test-tmp") assert.NilError(t, err) - defer os.Remove(tmpFolder) // nolint: errcheck + defer os.Remove(tmpFolder) //nolint: errcheck projectName := filepath.Base(tmpFolder) res := c.RunDockerComposeCmd(t, "--project-directory", tmpFolder, "up", "-d") diff --git a/pkg/e2e/framework.go b/pkg/e2e/framework.go index 17d3ec704..66a6233a7 100644 --- a/pkg/e2e/framework.go +++ b/pkg/e2e/framework.go @@ -172,12 +172,12 @@ func CopyFile(t testing.TB, sourceFile string, destinationFile string) { src, err := os.Open(sourceFile) require.NoError(t, err, "Failed to open source file: %s") - // nolint: errcheck + //nolint: errcheck defer src.Close() dst, err := os.OpenFile(destinationFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o755) require.NoError(t, err, "Failed to open destination file: %s", destinationFile) - // nolint: errcheck + //nolint: errcheck defer dst.Close() _, err = io.Copy(dst, src) diff --git a/pkg/e2e/volumes_test.go b/pkg/e2e/volumes_test.go index ecce19e13..c07bfaadb 100644 --- a/pkg/e2e/volumes_test.go +++ b/pkg/e2e/volumes_test.go @@ -50,7 +50,7 @@ func TestLocalComposeVolume(t *testing.T) { t.Run("check container volume specs", func(t *testing.T) { res := c.RunDockerCmd(t, "inspect", "compose-e2e-volume-nginx2-1", "--format", "{{ json .Mounts }}") output := res.Stdout() - // nolint + //nolint assert.Assert(t, strings.Contains(output, `"Destination":"/usr/src/app/node_modules","Driver":"local","Mode":"z","RW":true,"Propagation":""`), output) assert.Assert(t, strings.Contains(output, `"Destination":"/myconfig","Mode":"","RW":false,"Propagation":"rprivate"`), output) }) @@ -68,7 +68,7 @@ func TestLocalComposeVolume(t *testing.T) { t.Run("check container bind-mounts specs", func(t *testing.T) { res := c.RunDockerCmd(t, "inspect", "compose-e2e-volume-nginx-1", "--format", "{{ json .Mounts }}") output := res.Stdout() - // nolint + //nolint assert.Assert(t, strings.Contains(output, `"Type":"bind"`)) assert.Assert(t, strings.Contains(output, `"Destination":"/usr/share/nginx/html"`)) }) @@ -103,7 +103,7 @@ func TestProjectVolumeBind(t *testing.T) { t.Run("up on project volume with bind specification", func(t *testing.T) { tmpDir, err := os.MkdirTemp("", projectName) assert.NilError(t, err) - defer os.RemoveAll(tmpDir) // nolint + defer os.RemoveAll(tmpDir) //nolint c.RunDockerComposeCmd(t, "--project-name", projectName, "down") diff --git a/pkg/progress/tty.go b/pkg/progress/tty.go index a94d659dd..0dc95b906 100644 --- a/pkg/progress/tty.go +++ b/pkg/progress/tty.go @@ -164,14 +164,14 @@ func (w *ttyWriter) print() { continue } line := lineText(event, "", terminalWidth, statusPadding, runtime.GOOS != "windows") - // nolint: errcheck + //nolint: errcheck fmt.Fprint(w.out, line) numLines++ for _, v := range w.eventIDs { ev := w.events[v] if ev.ParentID == event.ID { line := lineText(ev, " ", terminalWidth, statusPadding, runtime.GOOS != "windows") - // nolint: errcheck + //nolint: errcheck fmt.Fprint(w.out, line) numLines++ } diff --git a/pkg/utils/writer_test.go b/pkg/utils/writer_test.go index a36ad4770..7eedb844f 100644 --- a/pkg/utils/writer_test.go +++ b/pkg/utils/writer_test.go @@ -27,13 +27,13 @@ func TestSplitWriter(t *testing.T) { w := GetWriter(func(line string) { lines = append(lines, line) }) - w.Write([]byte("h")) // nolint: errcheck - w.Write([]byte("e")) // nolint: errcheck - w.Write([]byte("l")) // nolint: errcheck - w.Write([]byte("l")) // nolint: errcheck - w.Write([]byte("o")) // nolint: errcheck - w.Write([]byte("\n")) // nolint: errcheck - w.Write([]byte("world!\n")) // nolint: errcheck + w.Write([]byte("h")) //nolint: errcheck + w.Write([]byte("e")) //nolint: errcheck + w.Write([]byte("l")) //nolint: errcheck + w.Write([]byte("l")) //nolint: errcheck + w.Write([]byte("o")) //nolint: errcheck + w.Write([]byte("\n")) //nolint: errcheck + w.Write([]byte("world!\n")) //nolint: errcheck assert.DeepEqual(t, lines, []string{"hello", "world!"}) }