diff --git a/api/server/router/build/build_routes.go b/api/server/router/build/build_routes.go index 57d9fc8c46..fb67534af2 100644 --- a/api/server/router/build/build_routes.go +++ b/api/server/router/build/build_routes.go @@ -176,7 +176,7 @@ func (br *buildRouter) postPrune(ctx context.Context, w http.ResponseWriter, r * if err := httputils.ParseForm(r); err != nil { return err } - filters, err := filters.FromJSON(r.Form.Get("filters")) + fltrs, err := filters.FromJSON(r.Form.Get("filters")) if err != nil { return errors.Wrap(err, "could not parse filters") } @@ -191,7 +191,7 @@ func (br *buildRouter) postPrune(ctx context.Context, w http.ResponseWriter, r * opts := types.BuildCachePruneOptions{ All: httputils.BoolValue(r, "all"), - Filters: filters, + Filters: fltrs, KeepStorage: int64(ks), } @@ -234,12 +234,12 @@ func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r * } output := ioutils.NewWriteFlusher(ww) - defer output.Close() + defer func() { _ = output.Close() }() errf := func(err error) error { if httputils.BoolValue(r, "q") && notVerboseBuffer.Len() > 0 { - output.Write(notVerboseBuffer.Bytes()) + _, _ = output.Write(notVerboseBuffer.Bytes()) } // Do not write the error in the http output if it's still empty. @@ -290,7 +290,7 @@ func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r * // Everything worked so if -q was provided the output from the daemon // should be just the image ID and we'll print that to stdout. if buildOptions.SuppressOutput { - fmt.Fprintln(streamformatter.NewStdoutWriter(output), imgID) + _, _ = fmt.Fprintln(streamformatter.NewStdoutWriter(output), imgID) } return nil } @@ -306,7 +306,7 @@ func getAuthConfigs(header http.Header) map[string]types.AuthConfig { authConfigsJSON := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authConfigsEncoded)) // Pulling an image does not error when no auth is provided so to remain // consistent with the existing api decode errors are ignored - json.NewDecoder(authConfigsJSON).Decode(&authConfigs) + _ = json.NewDecoder(authConfigsJSON).Decode(&authConfigs) return authConfigs } @@ -428,7 +428,7 @@ func (w *wcf) notify() { w.mu.Lock() if !w.ready { if w.buf.Len() > 0 { - io.Copy(w.Writer, w.buf) + _, _ = io.Copy(w.Writer, w.buf) } if w.flushed { w.flusher.Flush() diff --git a/api/server/router/image/image_routes.go b/api/server/router/image/image_routes.go index 41994bbef9..1f7d81adfa 100644 --- a/api/server/router/image/image_routes.go +++ b/api/server/router/image/image_routes.go @@ -91,7 +91,7 @@ func (s *imageRouter) postImagesCreate(ctx context.Context, w http.ResponseWrite if !output.Flushed() { return err } - output.Write(streamformatter.FormatError(err)) + _, _ = output.Write(streamformatter.FormatError(err)) } return nil @@ -136,7 +136,7 @@ func (s *imageRouter) postImagesPush(ctx context.Context, w http.ResponseWriter, if !output.Flushed() { return err } - output.Write(streamformatter.FormatError(err)) + _, _ = output.Write(streamformatter.FormatError(err)) } return nil } @@ -161,7 +161,7 @@ func (s *imageRouter) getImagesGet(ctx context.Context, w http.ResponseWriter, r if !output.Flushed() { return err } - output.Write(streamformatter.FormatError(err)) + _, _ = output.Write(streamformatter.FormatError(err)) } return nil } @@ -177,7 +177,7 @@ func (s *imageRouter) postImagesLoad(ctx context.Context, w http.ResponseWriter, output := ioutils.NewWriteFlusher(w) defer output.Close() if err := s.backend.LoadImage(r.Body, output, quiet); err != nil { - output.Write(streamformatter.FormatError(err)) + _, _ = output.Write(streamformatter.FormatError(err)) } return nil } diff --git a/api/server/router/plugin/plugin_routes.go b/api/server/router/plugin/plugin_routes.go index 9508ca8c9d..31b2c30215 100644 --- a/api/server/router/plugin/plugin_routes.go +++ b/api/server/router/plugin/plugin_routes.go @@ -123,7 +123,7 @@ func (pr *pluginRouter) upgradePlugin(ctx context.Context, w http.ResponseWriter if !output.Flushed() { return err } - output.Write(streamformatter.FormatError(err)) + _, _ = output.Write(streamformatter.FormatError(err)) } return nil @@ -162,7 +162,7 @@ func (pr *pluginRouter) pullPlugin(ctx context.Context, w http.ResponseWriter, r if !output.Flushed() { return err } - output.Write(streamformatter.FormatError(err)) + _, _ = output.Write(streamformatter.FormatError(err)) } return nil @@ -270,7 +270,7 @@ func (pr *pluginRouter) pushPlugin(ctx context.Context, w http.ResponseWriter, r if !output.Flushed() { return err } - output.Write(streamformatter.FormatError(err)) + _, _ = output.Write(streamformatter.FormatError(err)) } return nil }