From 5c6c790ec3ff5c79bb941e107246a1c9bede3884 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 09:12:08 +0200 Subject: [PATCH] chore: fix the gci lint issue in testutil (backport #21695) (#21702) Co-authored-by: cool-developer <51834436+cool-develope@users.noreply.github.com> --- testutil/rest.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/testutil/rest.go b/testutil/rest.go index 5026d1f01b96..6dc1c5792ff9 100644 --- a/testutil/rest.go +++ b/testutil/rest.go @@ -42,15 +42,15 @@ func GetRequestWithHeaders(url string, headers map[string]string) ([]byte, error // GetRequest defines a wrapper around an HTTP GET request with a provided URL. // An error is returned if the request or reading the body fails. func GetRequest(url string) ([]byte, error) { - res, err := http.Get(url) + resp, err := http.Get(url) if err != nil { return nil, err } defer func() { - _ = res.Body.Close() + _ = resp.Body.Close() }() - body, err := io.ReadAll(res.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, err } @@ -61,15 +61,15 @@ func GetRequest(url string) ([]byte, error) { // PostRequest defines a wrapper around an HTTP POST request with a provided URL and data. // An error is returned if the request or reading the body fails. func PostRequest(url, contentType string, data []byte) ([]byte, error) { - res, err := http.Post(url, contentType, bytes.NewBuffer(data)) + resp, err := http.Post(url, contentType, bytes.NewBuffer(data)) if err != nil { return nil, fmt.Errorf("error while sending post request: %w", err) } defer func() { - _ = res.Body.Close() + _ = resp.Body.Close() }() - bz, err := io.ReadAll(res.Body) + bz, err := io.ReadAll(resp.Body) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) }