Update to the latest golangci-lint

This commit is contained in:
9seconds
2026-02-11 10:20:04 +01:00
parent 37de052feb
commit ecba88d2e3
38 changed files with 82 additions and 78 deletions
+2 -2
View File
@@ -56,7 +56,7 @@ func (c *circuitBreakerDialer) doClosed(ctx context.Context,
select {
case <-ctx.Done():
if conn != nil {
conn.Close()
conn.Close() //nolint: errcheck
}
return nil, ctx.Err() //nolint: wrapcheck
@@ -93,7 +93,7 @@ func (c *circuitBreakerDialer) doHalfOpened(ctx context.Context,
select {
case <-ctx.Done():
if conn != nil {
conn.Close()
conn.Close() //nolint: errcheck
}
return nil, ctx.Err() //nolint: wrapcheck
+1 -1
View File
@@ -31,7 +31,7 @@ func (d *defaultDialer) DialContext(ctx context.Context, network, address string
// we do not need to call to end user. End users call us.
if err := SetServerSocketOptions(conn, 0); err != nil {
conn.Close()
conn.Close() //nolint: errcheck
return nil, fmt.Errorf("cannot set socket options: %w", err)
}
+2 -2
View File
@@ -51,7 +51,7 @@ func (suite *DefaultDialerTestSuite) TestConnectOk() {
suite.NoError(err)
suite.NotNil(conn)
conn.Close()
conn.Close() //nolint: errcheck
}
func (suite *DefaultDialerTestSuite) TestHTTPRequest() {
@@ -59,7 +59,7 @@ func (suite *DefaultDialerTestSuite) TestHTTPRequest() {
resp, err := httpClient.Get(suite.MakeURL("/get")) //nolint: noctx
if err == nil {
defer resp.Body.Close()
defer resp.Body.Close() //nolint: errcheck
}
suite.NoError(err)
+1 -1
View File
@@ -78,7 +78,7 @@ func (suite *Socks5ServerTestSuite) SetupSuite() {
}
func (suite *Socks5ServerTestSuite) TearDownSuite() {
suite.socks5Listener.Close()
suite.socks5Listener.Close() //nolint: errcheck
}
func (suite *Socks5ServerTestSuite) MakeSocks5URL(user, password string) *url.URL {
+1 -1
View File
@@ -75,7 +75,7 @@ func (suite *LoadBalancedSocks5TestSuite) TestCannotDial() {
func (suite *LoadBalancedSocks5TestSuite) TestDialOk() {
resp, err := suite.httpClient.Get(suite.MakeURL("/get")) //nolint: noctx
if err == nil {
defer resp.Body.Close()
defer resp.Body.Close() //nolint: errcheck
}
suite.NoError(err)
+2 -2
View File
@@ -34,7 +34,7 @@ func (suite *NetworkTestSuite) TestLocalHTTPRequest() {
resp, err := client.Get(suite.httpServer.URL + "/headers") //nolint: noctx
suite.NoError(err)
defer resp.Body.Close()
defer resp.Body.Close() //nolint: errcheck
data, err := io.ReadAll(resp.Body)
suite.NoError(err)
@@ -59,7 +59,7 @@ func (suite *NetworkTestSuite) TestRealHTTPRequest() {
resp, err := client.Get("https://httpbin.org/headers") //nolint: noctx
suite.NoError(err)
defer resp.Body.Close()
defer resp.Body.Close() //nolint: errcheck
data, err := io.ReadAll(resp.Body)
suite.NoError(err)
+1 -1
View File
@@ -16,7 +16,7 @@ func newProxyDialer(baseDialer Dialer, proxyURL *url.URL) Dialer {
)
if param := params.Get("open_threshold"); param != "" {
if intNum, err := strconv.ParseUint(param, 10, 32); err == nil { //nolint: gomnd
if intNum, err := strconv.ParseUint(param, 10, 32); err == nil {
openThreshold = uint32(intNum)
}
}
+2 -2
View File
@@ -14,14 +14,14 @@ func setSocketReuseAddrPort(conn syscall.RawConn) error {
var err error
conn.Control(func(fd uintptr) { //nolint: errcheck
err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR, 1) //nolint: nosnakecase
err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR, 1)
if err != nil {
err = fmt.Errorf("cannot set SO_REUSEADDR: %w", err)
return
}
err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1) //nolint: nosnakecase
err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1)
if err != nil {
err = fmt.Errorf("cannot set SO_REUSEPORT: %w", err)
}
+2 -2
View File
@@ -36,13 +36,13 @@ func (s socks5Dialer) DialContext(ctx context.Context, network, address string)
}
if err := s.handshake(conn); err != nil {
conn.Close()
conn.Close() //nolint: errcheck
return nil, fmt.Errorf("cannot perform a handshake: %w", err)
}
if err := s.connect(conn, address); err != nil {
conn.Close()
conn.Close() //nolint: errcheck
return nil, fmt.Errorf("cannot connect to a destination host %s: %w", address, err)
}
+2 -2
View File
@@ -35,7 +35,7 @@ func (suite *Socks5TestSuite) TestRequestFailed() {
resp, err := httpClient.Get(suite.MakeURL("/get")) //nolint: noctx
if err == nil {
defer resp.Body.Close()
defer resp.Body.Close() //nolint: errcheck
}
suite.Error(err)
@@ -48,7 +48,7 @@ func (suite *Socks5TestSuite) TestRequestOk() {
resp, err := httpClient.Get(suite.MakeURL("/get")) //nolint: noctx
if err == nil {
defer resp.Body.Close()
defer resp.Body.Close() //nolint: errcheck
}
suite.NoError(err)