Skip to content

Commit 91dc646

Browse files
committed
Fix lint error
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
1 parent 7e594ff commit 91dc646

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

httpserver/httpserver_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func TestHTTPServer_BasicOperation(t *testing.T) {
7575
// Send the request
7676
resp, err := http.DefaultClient.Do(req)
7777
require.NoError(t, err)
78-
defer resp.Body.Close()
78+
defer func() { _ = resp.Body.Close() }()
7979

8080
// Check response
8181
assert.Equal(t, http.StatusOK, resp.StatusCode)
@@ -150,7 +150,7 @@ func TestHTTPServer_PanicHandling(t *testing.T) {
150150
// Make a test request
151151
resp, err := http.Get(ts.URL + "/panic")
152152
require.NoError(t, err)
153-
defer resp.Body.Close()
153+
defer func() { _ = resp.Body.Close() }()
154154

155155
// Check response
156156
assert.Equal(t, http.StatusInternalServerError, resp.StatusCode)
@@ -180,7 +180,7 @@ func TestHTTPServer_PanicHandling(t *testing.T) {
180180
assert.NotPanics(t, func() {
181181
resp, err := http.Get(ts.URL + "/panic")
182182
require.NoError(t, err)
183-
defer resp.Body.Close()
183+
defer func() { _ = resp.Body.Close() }()
184184
assert.Equal(t, http.StatusInternalServerError, resp.StatusCode)
185185
})
186186
}
@@ -224,7 +224,7 @@ func TestHTTPServer_Propagation(t *testing.T) {
224224
// Send the request
225225
resp, err := http.DefaultClient.Do(req)
226226
require.NoError(t, err)
227-
defer resp.Body.Close()
227+
defer func() { _ = resp.Body.Close() }()
228228

229229
// Check response
230230
assert.Equal(t, http.StatusOK, resp.StatusCode)
@@ -381,7 +381,7 @@ func TestHTTPServer_Health(t *testing.T) {
381381
// Make a request to the health endpoint
382382
resp, err := http.Get(ts.URL + "/health")
383383
require.NoError(t, err)
384-
defer resp.Body.Close()
384+
defer func() { _ = resp.Body.Close() }()
385385

386386
// Check response
387387
assert.Equal(t, http.StatusOK, resp.StatusCode)

httpserver/wrap_writter.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ type flushWriter struct {
164164

165165
func (f *flushWriter) Flush() {
166166
f.wroteHeader = true
167-
fl := f.basicWriter.ResponseWriter.(http.Flusher)
167+
fl := f.ResponseWriter.(http.Flusher)
168168
fl.Flush()
169169
}
170170

@@ -176,7 +176,7 @@ type hijackWriter struct {
176176
}
177177

178178
func (f *hijackWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
179-
hj := f.basicWriter.ResponseWriter.(http.Hijacker)
179+
hj := f.ResponseWriter.(http.Hijacker)
180180
return hj.Hijack()
181181
}
182182

@@ -189,12 +189,12 @@ type flushHijackWriter struct {
189189

190190
func (f *flushHijackWriter) Flush() {
191191
f.wroteHeader = true
192-
fl := f.basicWriter.ResponseWriter.(http.Flusher)
192+
fl := f.ResponseWriter.(http.Flusher)
193193
fl.Flush()
194194
}
195195

196196
func (f *flushHijackWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
197-
hj := f.basicWriter.ResponseWriter.(http.Hijacker)
197+
hj := f.ResponseWriter.(http.Hijacker)
198198
return hj.Hijack()
199199
}
200200

pg/client.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,12 @@ func NewClient(options ...Option) (*Client, error) {
216216
}
217217

218218
config, _ := pgxpool.ParseConfig("")
219-
config.ConnConfig.Config.Host = host
220-
config.ConnConfig.Config.Port = uint16(port)
221-
config.ConnConfig.Config.User = c.user
222-
config.ConnConfig.Config.Password = c.password
223-
config.ConnConfig.Config.Database = c.database
224-
config.ConnConfig.Config.TLSConfig = c.tlsConfig
219+
config.ConnConfig.Host = host
220+
config.ConnConfig.Port = uint16(port)
221+
config.ConnConfig.User = c.user
222+
config.ConnConfig.Password = c.password
223+
config.ConnConfig.Database = c.database
224+
config.ConnConfig.TLSConfig = c.tlsConfig
225225
config.MinConns = 1
226226
config.MaxConns = int32(c.poolSize)
227227

unit/unit.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func (u *Unit) runMetricsServer(ctx context.Context, initialized chan<- promethe
263263
if err != nil {
264264
return fmt.Errorf("cannot listen on %q: %w", httpServer.Addr, err)
265265
}
266-
defer listener.Close()
266+
defer func() { _ = listener.Close() }()
267267

268268
initialized <- registry
269269

@@ -389,7 +389,7 @@ func (u *Unit) loadConfigurationFromFile(filename string) error {
389389
if err != nil {
390390
return fmt.Errorf("cannot open file: %w", err)
391391
}
392-
defer file.Close()
392+
defer func() { _ = file.Close() }()
393393

394394
blob, err := io.ReadAll(file)
395395
if err != nil {

0 commit comments

Comments
 (0)