diff options
author | John Olheiser <john.olheiser@gmail.com> | 2023-01-12 14:57:12 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-12 14:57:12 -0600 |
commit | 1ee1147baa9af5365b4359848eccd4962e541377 (patch) | |
tree | 1a10efd1b561c4fd0cdf03ec7978dc90402e7c99 | |
parent | c86be819bb0d407c3e530bafd31b18cdd0be1116 (diff) | |
download | gitea-1ee1147baa9af5365b4359848eccd4962e541377.tar.gz gitea-1ee1147baa9af5365b4359848eccd4962e541377.zip |
fix: don't replace err variable in nested check (#22416)
We can use `:=` to make `err` local to the if-scope instead of
overwriting the `err` in outer scope.
Signed-off-by: jolheiser <john.olheiser@gmail.com>
-rw-r--r-- | services/repository/check.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/services/repository/check.go b/services/repository/check.go index 293cb04d38..597b66d05f 100644 --- a/services/repository/check.go +++ b/services/repository/check.go @@ -95,7 +95,7 @@ func GitGcRepo(ctx context.Context, repo *repo_model.Repository, timeout time.Du if err != nil { log.Error("Repository garbage collection failed for %v. Stdout: %s\nError: %v", repo, stdout, err) desc := fmt.Sprintf("Repository garbage collection failed for %s. Stdout: %s\nError: %v", repo.RepoPath(), stdout, err) - if err = system_model.CreateRepositoryNotice(desc); err != nil { + if err := system_model.CreateRepositoryNotice(desc); err != nil { log.Error("CreateRepositoryNotice: %v", err) } return fmt.Errorf("Repository garbage collection failed in repo: %s: Error: %w", repo.FullName(), err) @@ -105,7 +105,7 @@ func GitGcRepo(ctx context.Context, repo *repo_model.Repository, timeout time.Du if err := repo_module.UpdateRepoSize(ctx, repo); err != nil { log.Error("Updating size as part of garbage collection failed for %-v. Stdout: %s\nError: %v", repo, stdout, err) desc := fmt.Sprintf("Updating size as part of garbage collection failed for %s. Stdout: %s\nError: %v", repo.RepoPath(), stdout, err) - if err = system_model.CreateRepositoryNotice(desc); err != nil { + if err := system_model.CreateRepositoryNotice(desc); err != nil { log.Error("CreateRepositoryNotice: %v", err) } return fmt.Errorf("Updating size as part of garbage collection failed in repo: %s: Error: %w", repo.FullName(), err) |