Skip to content

Commit fc723ac

Browse files
committed
Fix nolint issues
Reference -> https://golangci-lint.run/usage/false-positives/#nolint-directive Signed-off-by: Ulysses Souza <[email protected]>
1 parent 96cbb1c commit fc723ac

File tree

11 files changed

+31
-31
lines changed

11 files changed

+31
-31
lines changed

cmd/compose/build.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,16 @@ func buildCommand(p *projectOptions, backend api.Service) *cobra.Command {
110110
cmd.Flags().StringArrayVar(&opts.args, "build-arg", []string{}, "Set build-time variables for services.")
111111
cmd.Flags().StringVar(&opts.ssh, "ssh", "", "Set SSH authentications used when building service images. (use 'default' for using your default SSH Agent)")
112112
cmd.Flags().Bool("parallel", true, "Build images in parallel. DEPRECATED")
113-
cmd.Flags().MarkHidden("parallel") // nolint:errcheck
113+
cmd.Flags().MarkHidden("parallel") //nolint:errcheck
114114
cmd.Flags().Bool("compress", true, "Compress the build context using gzip. DEPRECATED")
115-
cmd.Flags().MarkHidden("compress") // nolint:errcheck
115+
cmd.Flags().MarkHidden("compress") //nolint:errcheck
116116
cmd.Flags().Bool("force-rm", true, "Always remove intermediate containers. DEPRECATED")
117-
cmd.Flags().MarkHidden("force-rm") // nolint:errcheck
117+
cmd.Flags().MarkHidden("force-rm") //nolint:errcheck
118118
cmd.Flags().BoolVar(&opts.noCache, "no-cache", false, "Do not use cache when building the image")
119119
cmd.Flags().Bool("no-rm", false, "Do not remove intermediate containers after a successful build. DEPRECATED")
120-
cmd.Flags().MarkHidden("no-rm") // nolint:errcheck
120+
cmd.Flags().MarkHidden("no-rm") //nolint:errcheck
121121
cmd.Flags().StringVarP(&opts.memory, "memory", "m", "", "Set memory limit for the build container. Not supported on buildkit yet.")
122-
cmd.Flags().MarkHidden("memory") // nolint:errcheck
122+
cmd.Flags().MarkHidden("memory") //nolint:errcheck
123123

124124
return cmd
125125
}

cmd/formatter/logs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ func (l *logConsumer) Log(container, service, message string) {
8989
}
9090
p := l.getPresenter(container)
9191
for _, line := range strings.Split(message, "\n") {
92-
fmt.Fprintf(l.writer, "%s%s\n", p.prefix, line) // nolint:errcheck
92+
fmt.Fprintf(l.writer, "%s%s\n", p.prefix, line) //nolint:errcheck
9393
}
9494
}
9595

9696
func (l *logConsumer) Status(container, msg string) {
9797
p := l.getPresenter(container)
9898
s := p.colors(fmt.Sprintf("%s %s\n", container, msg))
99-
l.writer.Write([]byte(s)) // nolint:errcheck
99+
l.writer.Write([]byte(s)) //nolint:errcheck
100100
}
101101

102102
func (l *logConsumer) computeWidth() {

pkg/compose/attach.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ func (s *composeService) attachContainerStreams(ctx context.Context, container s
127127
if stdout != nil {
128128
go func() {
129129
if tty {
130-
io.Copy(stdout, streamOut) // nolint:errcheck
130+
io.Copy(stdout, streamOut) //nolint:errcheck
131131
} else {
132-
stdcopy.StdCopy(stdout, stderr, streamOut) // nolint:errcheck
132+
stdcopy.StdCopy(stdout, stderr, streamOut) //nolint:errcheck
133133
}
134134
}()
135135
}

pkg/compose/build_classic.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (s *composeService) doBuildClassic(ctx context.Context, project *types.Proj
6464
return nameDigests, errs
6565
}
6666

67-
// nolint: gocyclo
67+
//nolint: gocyclo
6868
func (s *composeService) doBuildClassicSimpleImage(ctx context.Context, options buildx.Options) (string, error) {
6969
var (
7070
buildCtx io.ReadCloser
@@ -96,7 +96,7 @@ func (s *composeService) doBuildClassicSimpleImage(ctx context.Context, options
9696
if err != nil {
9797
return "", errors.Errorf("unable to open Dockerfile: %v", err)
9898
}
99-
defer dockerfileCtx.Close() // nolint:errcheck
99+
defer dockerfileCtx.Close() //nolint:errcheck
100100
}
101101
case urlutil.IsGitURL(specifiedContext):
102102
tempDir, relDockerfile, err = build.GetContextFromGitURL(specifiedContext, dockerfileName)
@@ -111,7 +111,7 @@ func (s *composeService) doBuildClassicSimpleImage(ctx context.Context, options
111111
}
112112

113113
if tempDir != "" {
114-
defer os.RemoveAll(tempDir) // nolint:errcheck
114+
defer os.RemoveAll(tempDir) //nolint:errcheck
115115
contextDir = tempDir
116116
}
117117

@@ -175,7 +175,7 @@ func (s *composeService) doBuildClassicSimpleImage(ctx context.Context, options
175175
if err != nil {
176176
return "", err
177177
}
178-
defer response.Body.Close() // nolint:errcheck
178+
defer response.Body.Close() //nolint:errcheck
179179

180180
imageID := ""
181181
aux := func(msg jsonmessage.JSONMessage) {

pkg/compose/logs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func (s *composeService) logContainers(ctx context.Context, consumer api.LogCons
9595
if err != nil {
9696
return err
9797
}
98-
defer r.Close() // nolint errcheck
98+
defer r.Close() //nolint errcheck
9999

100100
name := getContainerNameWithoutProject(c)
101101
w := utils.GetWriter(func(line string) {

pkg/compose/up.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
6060
return progress.Run(ctx, func(ctx context.Context) error {
6161
go func() {
6262
<-signalChan
63-
s.Kill(ctx, project.Name, api.KillOptions{ // nolint:errcheck
63+
s.Kill(ctx, project.Name, api.KillOptions{ //nolint:errcheck
6464
Services: project.ServiceNames(),
6565
})
6666
}()
@@ -74,7 +74,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
7474
<-signalChan
7575
printer.Cancel()
7676
fmt.Println("Gracefully stopping... (press Ctrl+C again to force)")
77-
stopFunc() // nolint:errcheck
77+
stopFunc() //nolint:errcheck
7878
}()
7979

8080
var exitCode int

pkg/e2e/compose_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func TestDownComposefileInParentFolder(t *testing.T) {
134134

135135
tmpFolder, err := os.MkdirTemp("fixtures/simple-composefile", "test-tmp")
136136
assert.NilError(t, err)
137-
defer os.Remove(tmpFolder) // nolint: errcheck
137+
defer os.Remove(tmpFolder) //nolint: errcheck
138138
projectName := filepath.Base(tmpFolder)
139139

140140
res := c.RunDockerComposeCmd(t, "--project-directory", tmpFolder, "up", "-d")

pkg/e2e/framework.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ func CopyFile(t testing.TB, sourceFile string, destinationFile string) {
172172

173173
src, err := os.Open(sourceFile)
174174
require.NoError(t, err, "Failed to open source file: %s")
175-
// nolint: errcheck
175+
//nolint: errcheck
176176
defer src.Close()
177177

178178
dst, err := os.OpenFile(destinationFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o755)
179179
require.NoError(t, err, "Failed to open destination file: %s", destinationFile)
180-
// nolint: errcheck
180+
//nolint: errcheck
181181
defer dst.Close()
182182

183183
_, err = io.Copy(dst, src)

pkg/e2e/volumes_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func TestLocalComposeVolume(t *testing.T) {
5050
t.Run("check container volume specs", func(t *testing.T) {
5151
res := c.RunDockerCmd(t, "inspect", "compose-e2e-volume-nginx2-1", "--format", "{{ json .Mounts }}")
5252
output := res.Stdout()
53-
// nolint
53+
//nolint
5454
assert.Assert(t, strings.Contains(output, `"Destination":"/usr/src/app/node_modules","Driver":"local","Mode":"z","RW":true,"Propagation":""`), output)
5555
assert.Assert(t, strings.Contains(output, `"Destination":"/myconfig","Mode":"","RW":false,"Propagation":"rprivate"`), output)
5656
})
@@ -68,7 +68,7 @@ func TestLocalComposeVolume(t *testing.T) {
6868
t.Run("check container bind-mounts specs", func(t *testing.T) {
6969
res := c.RunDockerCmd(t, "inspect", "compose-e2e-volume-nginx-1", "--format", "{{ json .Mounts }}")
7070
output := res.Stdout()
71-
// nolint
71+
//nolint
7272
assert.Assert(t, strings.Contains(output, `"Type":"bind"`))
7373
assert.Assert(t, strings.Contains(output, `"Destination":"/usr/share/nginx/html"`))
7474
})
@@ -103,7 +103,7 @@ func TestProjectVolumeBind(t *testing.T) {
103103
t.Run("up on project volume with bind specification", func(t *testing.T) {
104104
tmpDir, err := os.MkdirTemp("", projectName)
105105
assert.NilError(t, err)
106-
defer os.RemoveAll(tmpDir) // nolint
106+
defer os.RemoveAll(tmpDir) //nolint
107107

108108
c.RunDockerComposeCmd(t, "--project-name", projectName, "down")
109109

pkg/progress/tty.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@ func (w *ttyWriter) print() {
164164
continue
165165
}
166166
line := lineText(event, "", terminalWidth, statusPadding, runtime.GOOS != "windows")
167-
// nolint: errcheck
167+
//nolint: errcheck
168168
fmt.Fprint(w.out, line)
169169
numLines++
170170
for _, v := range w.eventIDs {
171171
ev := w.events[v]
172172
if ev.ParentID == event.ID {
173173
line := lineText(ev, " ", terminalWidth, statusPadding, runtime.GOOS != "windows")
174-
// nolint: errcheck
174+
//nolint: errcheck
175175
fmt.Fprint(w.out, line)
176176
numLines++
177177
}

0 commit comments

Comments
 (0)