From ef7ccc829560f293c45fe9c4d0ea93d79bec5dbc Mon Sep 17 00:00:00 2001 From: Mathias Date: Sat, 5 Sep 2026 11:27:22 +0200 Subject: [PATCH] fix(lint): check resp.Body.Close()'s error (errcheck) 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. --- internal/adminbootstrap/adminbootstrap.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/adminbootstrap/adminbootstrap.go b/internal/adminbootstrap/adminbootstrap.go index cc74561..01399ba 100644 --- a/internal/adminbootstrap/adminbootstrap.go +++ b/internal/adminbootstrap/adminbootstrap.go @@ -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) }