Skip to content

Commit

Permalink
Prefer separate if blocks over else if
Browse files Browse the repository at this point in the history
ie prefer this:

if foo {
	return
}
if bar {
	something else
}

over this:

if foo {
	return
} else if bar {
	something else
}
  • Loading branch information
mostynb committed Mar 15, 2022
1 parent 6788219 commit d9766e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cache/disk/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,8 @@ func (c *diskCache) GetValidatedActionResult(ctx context.Context, hash string) (
err = c.findMissingCasBlobsInternal(ctx, pendingValidations, true)
if errors.Is(err, errMissingBlob) {
return nil, nil, nil // aka "not found"
} else if err != nil {
}
if err != nil {
return nil, nil, err
}

Expand Down
4 changes: 3 additions & 1 deletion cache/disk/findmissing.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ func (c *diskCache) findMissingCasBlobsInternal(ctx context.Context, blobs []*pb
if c.proxy == nil && failFast {
// There's no proxy, there are missing blobs from the local cache, and we are failing fast.
return errMissingBlob
} else if c.proxy != nil {
}

if c.proxy != nil {
for i := range chunk {
if chunk[i] == nil {
continue
Expand Down

0 comments on commit d9766e2

Please sign in to comment.