aboutsummaryrefslogtreecommitdiffstats
path: root/services/doctor
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-03-22 19:17:30 +0800
committerGitHub <noreply@github.com>2024-03-22 19:17:30 +0800
commit226231ea27d4f2b0f09fa4efb39501507613b284 (patch)
treef7a45b173d4c96ff34c3fe7e7da8c73dce8a4ae3 /services/doctor
parent2f060c5834d81f0317c795fc281f9a07e03e5962 (diff)
downloadgitea-226231ea27d4f2b0f09fa4efb39501507613b284.tar.gz
gitea-226231ea27d4f2b0f09fa4efb39501507613b284.zip
Fix some pending problems (#29985)
These changes are quite independent and trivial, so I don't want to open too many PRs. * https://github.com/go-gitea/gitea/pull/29882#discussion_r1529607091 * the `f.Close` should be called properly * the error message could be more meaningful (https://github.com/go-gitea/gitea/pull/29882#pullrequestreview-1942557935) * https://github.com/go-gitea/gitea/pull/29859#pullrequestreview-1942324716 * the new translation strings don't take arguments * https://github.com/go-gitea/gitea/pull/28710#discussion_r1443778807 * stale for long time * #28140 * a form was forgotten to be changed to work with backend code
Diffstat (limited to 'services/doctor')
-rw-r--r--services/doctor/authorizedkeys.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/services/doctor/authorizedkeys.go b/services/doctor/authorizedkeys.go
index bc0266c4bc..8d6fc9cb5e 100644
--- a/services/doctor/authorizedkeys.go
+++ b/services/doctor/authorizedkeys.go
@@ -51,11 +51,11 @@ func checkAuthorizedKeys(ctx context.Context, logger log.Logger, autofix bool) e
}
linesInAuthorizedKeys.Add(line)
}
- err = scanner.Err()
- if err != nil {
+ if err = scanner.Err(); err != nil {
return fmt.Errorf("scan: %w", err)
}
- f.Close()
+ // although there is a "defer close" above, here close explicitly before the generating, because it needs to open the file for writing again
+ _ = f.Close()
// now we regenerate and check if there are any lines missing
regenerated := &bytes.Buffer{}