Skip to content

Commit efb9989

Browse files
authored
fix(deps): manual ci dependencies (#859)
* fix(deps): manual ci dependencies * fix: ignore linter error check on defer * fix: restore comment * fix: code improvements
1 parent b022096 commit efb9989

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

.secrets.baseline

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "go.sum|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-01-24T17:27:34Z",
6+
"generated_at": "2025-04-15T12:18:50Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -138,7 +138,7 @@
138138
"hashed_secret": "3e4bdbe0b80e63c22b178576e906810777387b50",
139139
"is_secret": false,
140140
"is_verified": false,
141-
"line_number": 226,
141+
"line_number": 237,
142142
"type": "Secret Keyword",
143143
"verified_result": null
144144
}

tests/pr_test.go

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,18 @@ func TestRunFSCloudExample(t *testing.T) {
170170
cbrWorkingAsExpected := false
171171
reason := ""
172172
if resp != nil {
173-
defer resp.Body.Close() // Close the response body when done
173+
// Close the response body when done
174+
defer func() {
175+
if resp != nil {
176+
err := resp.Body.Close()
177+
if err != nil {
178+
// Handle or log the error
179+
log.Printf("Error closing response body: %v", err)
180+
}
181+
} else {
182+
log.Print("no response, defer close not needed")
183+
}
184+
}()
174185

175186
// Read the response body into a string
176187
bodyBytes, readErr := io.ReadAll(resp.Body)
@@ -240,7 +251,17 @@ func getIAMBearerToken(apikey string) string {
240251
fmt.Println("Error sending request:", err)
241252
return ""
242253
}
243-
defer resp.Body.Close()
254+
defer func() {
255+
if resp != nil {
256+
err := resp.Body.Close()
257+
if err != nil {
258+
// Handle or log the error
259+
log.Printf("Error closing response body: %v", err)
260+
}
261+
} else {
262+
log.Print("no response, defer close not needed")
263+
}
264+
}()
244265

245266
var responseJSON map[string]interface{}
246267
err = json.NewDecoder(resp.Body).Decode(&responseJSON)

0 commit comments

Comments
 (0)