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.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user