diff --git a/main.go b/main.go index 0ec835ff..f2280590 100644 --- a/main.go +++ b/main.go @@ -66,18 +66,18 @@ func main() { func run(ctx *cli.Context) error { c, err := config.Get(ctx) if err != nil { - fmt.Fprintf(ctx.App.Writer, "%v\n\n", err) + _, _ = fmt.Fprintf(ctx.App.Writer, "%v\n\n", err) _ = cli.ShowAppHelp(ctx) return cli.Exit(err.Error(), 1) } if ctx.NArg() > 0 { - fmt.Fprintf(ctx.App.Writer, + _, _ = fmt.Fprintf(ctx.App.Writer, "Error: bazel-remote does not take positional aguments\n") for i := 0; i < ctx.NArg(); i++ { - fmt.Fprintf(ctx.App.Writer, "arg: %s\n", ctx.Args().Get(i)) + _, _ = fmt.Fprintf(ctx.App.Writer, "arg: %s\n", ctx.Args().Get(i)) } - fmt.Fprintf(ctx.App.Writer, "\n") + _, _ = fmt.Fprintf(ctx.App.Writer, "\n") _ = cli.ShowAppHelp(ctx) os.Exit(1) diff --git a/server/grpc_asset.go b/server/grpc_asset.go index 8e22e3c2..dad68231 100644 --- a/server/grpc_asset.go +++ b/server/grpc_asset.go @@ -202,7 +202,7 @@ func (s *grpcServer) fetchItem(ctx context.Context, uri string, headers http.Hea if u.Scheme != "http" && u.Scheme != "https" { s.errorLogger.Printf("unsupported URI: %s", uri) - return "", int64(-1), fmt.Errorf("Unknown URL scheme: %q", u.Scheme) + return "", int64(-1), fmt.Errorf("unknown URL scheme: %q", u.Scheme) } req, err := http.NewRequest(http.MethodGet, uri, nil) @@ -223,7 +223,7 @@ func (s *grpcServer) fetchItem(ctx context.Context, uri string, headers http.Hea s.accessLogger.Printf("GRPC ASSET FETCH %s %s", uri, resp.Status) if resp.StatusCode < 200 || resp.StatusCode >= 300 { - return "", int64(-1), fmt.Errorf("Unsuccessful HTTP status code: %d", resp.StatusCode) + return "", int64(-1), fmt.Errorf("unsuccessful HTTP status code: %d", resp.StatusCode) } expectedSize := resp.ContentLength diff --git a/server/grpc_cas.go b/server/grpc_cas.go index dfaba418..24361357 100644 --- a/server/grpc_cas.go +++ b/server/grpc_cas.go @@ -455,7 +455,7 @@ func (s *grpcServer) SpliceBlob(ctx context.Context, req *pb.SpliceBlobRequest) rc, _, err := s.cache.Get(ctx, cache.CAS, chunkDigest.Hash, chunkDigest.SizeBytes, 0) if err != nil { if rc != nil { - rc.Close() + _ = rc.Close() } return nil, grpc_status.Errorf(codes.Unknown, @@ -474,20 +474,20 @@ func (s *grpcServer) SpliceBlob(ctx context.Context, req *pb.SpliceBlobRequest) copiedBytes, err := io.Copy(hasher, rc) if err != nil { - rc.Close() + _ = rc.Close() return nil, grpc_status.Errorf(codes.Unknown, "SpliceBlob failed to copy chunk %s/%d: %s", chunkDigest.Hash, chunkDigest.SizeBytes, err) } if copiedBytes != chunkDigest.SizeBytes { - rc.Close() + _ = rc.Close() return nil, grpc_status.Errorf(codes.Unknown, "SpliceBlob copied unpexpected number of bytes (%d) from chunk %s/%d", copiedBytes, chunkDigest.Hash, chunkDigest.SizeBytes) } - rc.Close() + _ = rc.Close() } req.BlobDigest = &pb.Digest{ @@ -539,13 +539,13 @@ func (s *grpcServer) SpliceBlob(ctx context.Context, req *pb.SpliceBlobRequest) writerResultChan := make(chan error, 1) go func() { - defer pw.Close() + defer func() { _ = pw.Close() }() for _, chunkDigest := range req.ChunkDigests { rc, _, err := s.cache.Get(ctx, cache.CAS, chunkDigest.Hash, chunkDigest.SizeBytes, 0) if err != nil { if rc != nil { - rc.Close() + _ = rc.Close() } writerResultChan <- grpc_status.Errorf(codes.Unknown, "SpliceBlob failed to get chunk %s/%d: %s", @@ -565,7 +565,7 @@ func (s *grpcServer) SpliceBlob(ctx context.Context, req *pb.SpliceBlobRequest) copiedBytes, err := io.Copy(pw, rc) if err != nil { - rc.Close() + _ = rc.Close() writerResultChan <- grpc_status.Errorf(codes.Unknown, "SpliceBlob failed to copy chunk %s/%d: %s", chunkDigest.Hash, chunkDigest.SizeBytes, err) @@ -573,14 +573,14 @@ func (s *grpcServer) SpliceBlob(ctx context.Context, req *pb.SpliceBlobRequest) } if copiedBytes != chunkDigest.SizeBytes { - rc.Close() + _ = rc.Close() writerResultChan <- grpc_status.Errorf(codes.Unknown, "SpliceBlob copied unpexpected number of bytes (%d) from chunk %s/%d", copiedBytes, chunkDigest.Hash, chunkDigest.SizeBytes) return } - rc.Close() + _ = rc.Close() } writerResultChan <- nil