Skip to content

Commit 9f4ec6b

Browse files
committed
bugfix
1 parent df0de47 commit 9f4ec6b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

helper/clickhouse/clickhouse.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,15 @@ func reader(ctx context.Context, dsn string, query string, postBody io.Reader, g
102102
if err != nil {
103103
return
104104
}
105-
defer resp.Body.Close()
106105

107106
if resp.StatusCode != 200 {
108107
body, _ := ioutil.ReadAll(resp.Body)
108+
resp.Body.Close()
109109
err = fmt.Errorf("clickhouse response status %d: %s", resp.StatusCode, string(body))
110110
return
111111
}
112112

113113
bodyReader = resp.Body
114-
115114
return
116115
}
117116

@@ -122,6 +121,7 @@ func do(ctx context.Context, dsn string, query string, postBody io.Reader, gzip
122121
}
123122

124123
body, err := ioutil.ReadAll(bodyReader)
124+
bodyReader.Close()
125125
if err != nil {
126126
return nil, err
127127
}

0 commit comments

Comments
 (0)