mirror of
https://github.com/anotherhadi/github-recon.git
synced 2026-10-05 19:08:24 +02:00
+6
-2
@@ -66,7 +66,9 @@ func FetchGitHubAPI(github *github.Client, token, path string) ([]byte, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error executing request for %s: %w", url, err)
|
return nil, fmt.Errorf("error executing request for %s: %w", url, err)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() {
|
||||||
|
_ = resp.Body.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||||
bodyBytes, _ := io.ReadAll(resp.Body)
|
bodyBytes, _ := io.ReadAll(resp.Body)
|
||||||
@@ -152,7 +154,9 @@ func (r Recon) WriteJson(data any) {
|
|||||||
r.Logger.Error("Failed to create JSON file", "err", err)
|
r.Logger.Error("Failed to create JSON file", "err", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer func() {
|
||||||
|
_ = file.Close()
|
||||||
|
}()
|
||||||
as_json, _ := json.MarshalIndent(data, "", "\t")
|
as_json, _ := json.MarshalIndent(data, "", "\t")
|
||||||
_, err = file.Write(as_json)
|
_, err = file.Write(as_json)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user