Skip to content

Commit f547820

Browse files
committed
Fix linter complaints
1 parent 1c1ddee commit f547820

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

internal/generate.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ func retrieveDefaultInstallationID(hostname, jwt string) (string, error) {
113113
if err != nil {
114114
return "", fmt.Errorf("unable to POST to %s: %w", endpoint, err)
115115
}
116-
defer resp.Body.Close()
116+
defer func() {
117+
_ = resp.Body.Close()
118+
}()
117119

118120
if resp.StatusCode != 200 {
119121
return "", fmt.Errorf("unexpected status code: %d", resp.StatusCode)
@@ -149,7 +151,9 @@ func generateToken(hostname, jwt, installationID string) (*github.InstallationTo
149151
if err != nil {
150152
return nil, fmt.Errorf("unable to POST to %s: %w", endpoint, err)
151153
}
152-
defer resp.Body.Close()
154+
defer func() {
155+
_ = resp.Body.Close()
156+
}()
153157

154158
if resp.StatusCode != 201 {
155159
return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode)

internal/installations.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ func listInstallations(hostname, jwt string) (*[]github.Installation, error) {
9191
if err != nil {
9292
return nil, fmt.Errorf("unable to POST to %s: %w", endpoint, err)
9393
}
94-
defer resp.Body.Close()
94+
defer func() {
95+
_ = resp.Body.Close()
96+
}()
9597

9698
if resp.StatusCode != 200 {
9799
return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode)

internal/revoke.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ func revokeToken(hostname, token string) error {
4646
if err != nil {
4747
return fmt.Errorf("unable to DELETE to %s: %w", endpoint, err)
4848
}
49-
defer resp.Body.Close()
49+
defer func() {
50+
_ = resp.Body.Close()
51+
}()
5052

5153
if resp.StatusCode != 204 {
5254
return fmt.Errorf("token might be invalid or not properly formatted. Unexpected status code: %d", resp.StatusCode)

0 commit comments

Comments
 (0)