1
0
mirror of https://github.com/umputun/reproxy.git synced 2025-11-23 22:04:57 +02:00

lint: minor warn on deferred close

This commit is contained in:
Umputun
2023-02-27 00:00:04 -06:00
parent ffd6b08257
commit 34d9f4d1d5
3 changed files with 4 additions and 4 deletions

View File

@@ -66,7 +66,7 @@ func (cl *consulClient) getServiceNames() ([]string, error) {
if err != nil {
return nil, fmt.Errorf("error send request to consul, %w", err)
}
defer resp.Body.Close()
defer resp.Body.Close() // nolint
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("unexpected response status code %d", resp.StatusCode)
@@ -107,7 +107,7 @@ func (cl *consulClient) getServices(serviceName string) ([]consulService, error)
if err != nil {
return nil, fmt.Errorf("error send request to consul, %w", err)
}
defer resp.Body.Close()
defer resp.Body.Close() // nolint
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("unexpected response status code %d", resp.StatusCode)

View File

@@ -372,7 +372,7 @@ func (d *dockerClient) ListContainers() ([]containerInfo, error) {
return nil, fmt.Errorf("failed connection to docker socket: %w", err)
}
defer resp.Body.Close()
defer resp.Body.Close() // nolint
if resp.StatusCode != http.StatusOK {
e := struct {

View File

@@ -103,7 +103,7 @@ func (p *Plugin) send(client *http.Client, conductor, method string) error {
if err != nil {
return err
}
defer resp.Body.Close()
defer resp.Body.Close() // nolint
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("invalid status %s", resp.Status)