diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-06-07 11:09:06 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-06-10 09:34:46 +0300 |
commit | e5c66c287c13efaa237eac7720e8f9e8b3f94c52 (patch) | |
tree | 62cf6cbae21f9a51b0927b5183aad8fbd2f47f20 | |
parent | e5725bc39cd011c7e896e670b551cbd668ffd3ab (diff) |
cmd/gitaly-lfs-smudge: Don't return a reader when request fails
There is only a single caller of `smudgeOneObject()`, and that caller
will immediately bubble up any errors returned by this function. It is
thus needless to return an `io.NopCloser()` in case `smudgeOneObject()`
itself fails.
Return `nil` instead of the `io.NopCloser()` to clarify the code flow.
-rw-r--r-- | cmd/gitaly-lfs-smudge/smudge.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/gitaly-lfs-smudge/smudge.go b/cmd/gitaly-lfs-smudge/smudge.go index 7b6d4f7cc..b5b720a87 100644 --- a/cmd/gitaly-lfs-smudge/smudge.go +++ b/cmd/gitaly-lfs-smudge/smudge.go @@ -54,7 +54,7 @@ func smudgeOneObject(ctx context.Context, cfg smudge.Config, gitlabClient *gitla response, err := gitlabClient.Get(ctx, u.String()) if err != nil { - return io.NopCloser(contents), fmt.Errorf("error loading LFS object: %v", err) + return nil, fmt.Errorf("error loading LFS object: %v", err) } if response.StatusCode == 200 { |