fix(lint): check resp.Body.Close()'s error (errcheck)
CD / Deploy via GitOps (push) Successful in 5s
CD / Lint / Test / Vet (push) Successful in 18s
CD / Build & Import (push) Successful in 6s

Caught by CI, not locally -- this sandbox's golangci-lint crashes on any
repo, a pre-existing environment issue unrelated to this code (documented
in dispatch's own session history). gitea-mcp's actual CI run has a
working linter and correctly flagged this.
This commit is contained in:
2026-09-05 11:27:22 +02:00
parent 4d6597639e
commit ef7ccc8295
+5 -5
View File
@@ -160,7 +160,7 @@ func (b Bootstrapper) userExists(ctx context.Context, username string) (bool, er
if err != nil {
return false, err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()
switch resp.StatusCode {
case http.StatusOK:
return true, nil
@@ -185,7 +185,7 @@ func (b Bootstrapper) createUser(ctx context.Context, req Request, password stri
if err != nil {
return err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode/100 != 2 {
return statusErr(resp)
}
@@ -199,7 +199,7 @@ func (b Bootstrapper) resetPassword(ctx context.Context, username, password stri
if err != nil {
return err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode/100 != 2 {
return statusErr(resp)
}
@@ -226,7 +226,7 @@ func (b Bootstrapper) mintToken(ctx context.Context, username, password, tokenNa
if err != nil {
return "", err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode/100 != 2 {
return "", statusErr(resp)
}
@@ -251,7 +251,7 @@ func (b Bootstrapper) grantReadAccess(ctx context.Context, r RepoRef, username s
if err != nil {
return err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode/100 != 2 {
return statusErr(resp)
}