silence gosec warning G107

Signed-off-by: zhzhuang-zju <m17799853869@163.com>
This commit is contained in:
zhzhuang-zju 2024-05-13 10:09:14 +08:00
parent 4ccffccc70
commit 9960261c17
1 changed files with 7 additions and 2 deletions

View File

@ -243,11 +243,16 @@ type httpget func(url string) (int, string, io.ReadCloser, error)
// httpgetImpl Implements a function to retrieve a url and return the results.
func httpgetImpl(url string) (int, string, io.ReadCloser, error) {
// nolint:gosec
resp, err := http.Get(url)
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
return 0, "", nil, err
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
return 0, "", nil, err
}
return resp.StatusCode, resp.Status, resp.Body, nil
}