Skip to content

Commit 138ef30

Browse files
committed
Fix remaining golangci-lint errors
1 parent f89b7a1 commit 138ef30

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,18 @@ func main() {
6666
func run(ctx *cli.Context) error {
6767
c, err := config.Get(ctx)
6868
if err != nil {
69-
fmt.Fprintf(ctx.App.Writer, "%v\n\n", err)
69+
_, _ = fmt.Fprintf(ctx.App.Writer, "%v\n\n", err)
7070
_ = cli.ShowAppHelp(ctx)
7171
return cli.Exit(err.Error(), 1)
7272
}
7373

7474
if ctx.NArg() > 0 {
75-
fmt.Fprintf(ctx.App.Writer,
75+
_, _ = fmt.Fprintf(ctx.App.Writer,
7676
"Error: bazel-remote does not take positional aguments\n")
7777
for i := 0; i < ctx.NArg(); i++ {
78-
fmt.Fprintf(ctx.App.Writer, "arg: %s\n", ctx.Args().Get(i))
78+
_, _ = fmt.Fprintf(ctx.App.Writer, "arg: %s\n", ctx.Args().Get(i))
7979
}
80-
fmt.Fprintf(ctx.App.Writer, "\n")
80+
_, _ = fmt.Fprintf(ctx.App.Writer, "\n")
8181

8282
_ = cli.ShowAppHelp(ctx)
8383
os.Exit(1)

server/grpc_asset.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func (s *grpcServer) fetchItem(ctx context.Context, uri string, headers http.Hea
202202

203203
if u.Scheme != "http" && u.Scheme != "https" {
204204
s.errorLogger.Printf("unsupported URI: %s", uri)
205-
return "", int64(-1), fmt.Errorf("Unknown URL scheme: %q", u.Scheme)
205+
return "", int64(-1), fmt.Errorf("unknown URL scheme: %q", u.Scheme)
206206
}
207207

208208
req, err := http.NewRequest(http.MethodGet, uri, nil)
@@ -223,7 +223,7 @@ func (s *grpcServer) fetchItem(ctx context.Context, uri string, headers http.Hea
223223

224224
s.accessLogger.Printf("GRPC ASSET FETCH %s %s", uri, resp.Status)
225225
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
226-
return "", int64(-1), fmt.Errorf("Unsuccessful HTTP status code: %d", resp.StatusCode)
226+
return "", int64(-1), fmt.Errorf("unsuccessful HTTP status code: %d", resp.StatusCode)
227227
}
228228

229229
expectedSize := resp.ContentLength

server/grpc_cas.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ func (s *grpcServer) SpliceBlob(ctx context.Context, req *pb.SpliceBlobRequest)
455455
rc, _, err := s.cache.Get(ctx, cache.CAS, chunkDigest.Hash, chunkDigest.SizeBytes, 0)
456456
if err != nil {
457457
if rc != nil {
458-
rc.Close()
458+
_ = rc.Close()
459459
}
460460

461461
return nil, grpc_status.Errorf(codes.Unknown,
@@ -474,20 +474,20 @@ func (s *grpcServer) SpliceBlob(ctx context.Context, req *pb.SpliceBlobRequest)
474474

475475
copiedBytes, err := io.Copy(hasher, rc)
476476
if err != nil {
477-
rc.Close()
477+
_ = rc.Close()
478478
return nil, grpc_status.Errorf(codes.Unknown,
479479
"SpliceBlob failed to copy chunk %s/%d: %s",
480480
chunkDigest.Hash, chunkDigest.SizeBytes, err)
481481
}
482482

483483
if copiedBytes != chunkDigest.SizeBytes {
484-
rc.Close()
484+
_ = rc.Close()
485485
return nil, grpc_status.Errorf(codes.Unknown,
486486
"SpliceBlob copied unpexpected number of bytes (%d) from chunk %s/%d",
487487
copiedBytes, chunkDigest.Hash, chunkDigest.SizeBytes)
488488
}
489489

490-
rc.Close()
490+
_ = rc.Close()
491491
}
492492

493493
req.BlobDigest = &pb.Digest{
@@ -539,13 +539,13 @@ func (s *grpcServer) SpliceBlob(ctx context.Context, req *pb.SpliceBlobRequest)
539539
writerResultChan := make(chan error, 1)
540540

541541
go func() {
542-
defer pw.Close()
542+
defer func() { _ = pw.Close() }()
543543

544544
for _, chunkDigest := range req.ChunkDigests {
545545
rc, _, err := s.cache.Get(ctx, cache.CAS, chunkDigest.Hash, chunkDigest.SizeBytes, 0)
546546
if err != nil {
547547
if rc != nil {
548-
rc.Close()
548+
_ = rc.Close()
549549
}
550550
writerResultChan <- grpc_status.Errorf(codes.Unknown,
551551
"SpliceBlob failed to get chunk %s/%d: %s",
@@ -565,22 +565,22 @@ func (s *grpcServer) SpliceBlob(ctx context.Context, req *pb.SpliceBlobRequest)
565565

566566
copiedBytes, err := io.Copy(pw, rc)
567567
if err != nil {
568-
rc.Close()
568+
_ = rc.Close()
569569
writerResultChan <- grpc_status.Errorf(codes.Unknown,
570570
"SpliceBlob failed to copy chunk %s/%d: %s",
571571
chunkDigest.Hash, chunkDigest.SizeBytes, err)
572572
return
573573
}
574574

575575
if copiedBytes != chunkDigest.SizeBytes {
576-
rc.Close()
576+
_ = rc.Close()
577577
writerResultChan <- grpc_status.Errorf(codes.Unknown,
578578
"SpliceBlob copied unpexpected number of bytes (%d) from chunk %s/%d",
579579
copiedBytes, chunkDigest.Hash, chunkDigest.SizeBytes)
580580
return
581581
}
582582

583-
rc.Close()
583+
_ = rc.Close()
584584
}
585585

586586
writerResultChan <- nil

0 commit comments

Comments
 (0)