Browse Source

Update to the latest golangci-lint

tags/v2.1.8^2
9seconds 2 months ago
parent
commit
ecba88d2e3

+ 17
- 18
.golangci.toml View File

@@ -1,22 +1,21 @@
1
+# https://golangci-lint.run/docs/configuration/file/
2
+
3
+version = 2
4
+
1 5
 [run]
2 6
 concurrency = 4
3
-deadline = "2m"
4 7
 tests = true
5
-skip-dirs = ["vendor"]
6
-
7
-[output]
8
-format = "colored-line-number"
9 8
 
10
-[linters]
11
-enable-all = true
12
-disable = [
13
-    "containedctx",
14
-    "exhaustivestruct",
15
-    "exhaustruct",
16
-    "gas",
17
-    "gochecknoglobals",
18
-    "goerr113",
19
-    "ireturn",
20
-    "thelper",
21
-    "varnamelen",
22
-]
9
+# [linters]
10
+# enable-all = true
11
+# disable = [
12
+#     "containedctx",
13
+#     "exhaustivestruct",
14
+#     "exhaustruct",
15
+#     "gas",
16
+#     "gochecknoglobals",
17
+#     "goerr113",
18
+#     "ireturn",
19
+#     "thelper",
20
+#     "varnamelen",
21
+# ]

+ 5
- 0
.mise.toml View File

@@ -10,6 +10,11 @@ sources = ["**/*.go", "go.mod", "go.sum"]
10 10
 outputs = ["mtg"]
11 11
 run = "go build"
12 12
 
13
+[tasks.lint]
14
+description = "Run linter"
15
+tools.golangci-lint = "latest"
16
+run = "golangci-lint run"
17
+
13 18
 [tasks.test]
14 19
 description = "Run tests"
15 20
 run = "go test -v ./..."

+ 1
- 1
antireplay/stable_bloom_filter.go View File

@@ -42,7 +42,7 @@ func NewStableBloomFilter(byteSize uint, errorRate float64) mtglib.AntiReplayCac
42 42
 		errorRate = DefaultStableBloomFilterErrorRate
43 43
 	}
44 44
 
45
-	sf := boom.NewDefaultStableBloomFilter(byteSize*8, errorRate) //nolint: gomnd
45
+	sf := boom.NewDefaultStableBloomFilter(byteSize*8, errorRate)
46 46
 	sf.SetHash(xxhash.New64())
47 47
 
48 48
 	return &stableBloomFilter{

+ 2
- 2
internal/cli/access.go View File

@@ -61,7 +61,7 @@ func (a *Access) Run(cli *CLI, version string) error {
61 61
 	}
62 62
 
63 63
 	wg := &sync.WaitGroup{}
64
-	wg.Add(2) //nolint: gomnd
64
+	wg.Add(2)
65 65
 
66 66
 	go func() {
67 67
 		defer wg.Done()
@@ -129,7 +129,7 @@ func (a *Access) getIP(ntw mtglib.Network, protocol string) net.IP {
129 129
 
130 130
 	defer func() {
131 131
 		io.Copy(io.Discard, resp.Body) //nolint: errcheck
132
-		resp.Body.Close()
132
+		resp.Body.Close() //nolint: errcheck
133 133
 	}()
134 134
 
135 135
 	data, err := io.ReadAll(resp.Body)

+ 2
- 2
internal/cli/run_proxy.go View File

@@ -164,7 +164,7 @@ func makeIPAllowlist(conf config.ListConfig,
164 164
 }
165 165
 
166 166
 func makeEventStream(conf *config.Config, logger mtglib.Logger) (mtglib.EventStream, error) {
167
-	factories := make([]events.ObserverFactory, 0, 2) //nolint: gomnd
167
+	factories := make([]events.ObserverFactory, 0, 2)
168 168
 
169 169
 	if conf.Stats.StatsD.Enabled.Get(false) {
170 170
 		statsdFactory, err := stats.NewStatsd(
@@ -271,7 +271,7 @@ func runProxy(conf *config.Config, version string) error { //nolint: funlen
271 271
 	go proxy.Serve(listener) //nolint: errcheck
272 272
 
273 273
 	<-ctx.Done()
274
-	listener.Close()
274
+	listener.Close() //nolint: errcheck
275 275
 	proxy.Shutdown()
276 276
 
277 277
 	return nil

+ 2
- 2
internal/cli/simple_run.go View File

@@ -35,7 +35,7 @@ func (s *SimpleRun) Run(cli *CLI, version string) error { //nolint: cyclop,funle
35 35
 		return fmt.Errorf("incorrect secret: %w", err)
36 36
 	}
37 37
 
38
-	if err := conf.Concurrency.Set(strconv.FormatUint(s.Concurrency, 10)); err != nil { //nolint: gomnd
38
+	if err := conf.Concurrency.Set(strconv.FormatUint(s.Concurrency, 10)); err != nil {
39 39
 		return fmt.Errorf("incorrect concurrency: %w", err)
40 40
 	}
41 41
 
@@ -43,7 +43,7 @@ func (s *SimpleRun) Run(cli *CLI, version string) error { //nolint: cyclop,funle
43 43
 		return fmt.Errorf("incorrect prefer-ip: %w", err)
44 44
 	}
45 45
 
46
-	if err := conf.DomainFrontingPort.Set(strconv.FormatUint(s.DomainFrontingPort, 10)); err != nil { //nolint: gomnd
46
+	if err := conf.DomainFrontingPort.Set(strconv.FormatUint(s.DomainFrontingPort, 10)); err != nil {
47 47
 		return fmt.Errorf("incorrect domain-fronting-port: %w", err)
48 48
 	}
49 49
 

+ 2
- 2
internal/config/type_concurrency.go View File

@@ -10,7 +10,7 @@ type TypeConcurrency struct {
10 10
 }
11 11
 
12 12
 func (t *TypeConcurrency) Set(value string) error {
13
-	concurrencyValue, err := strconv.ParseUint(value, 10, 16) //nolint: gomnd
13
+	concurrencyValue, err := strconv.ParseUint(value, 10, 16)
14 14
 	if err != nil {
15 15
 		return fmt.Errorf("value is not uint (%s): %w", value, err)
16 16
 	}
@@ -41,5 +41,5 @@ func (t TypeConcurrency) MarshalJSON() ([]byte, error) {
41 41
 }
42 42
 
43 43
 func (t TypeConcurrency) String() string {
44
-	return strconv.FormatUint(uint64(t.Value), 10) //nolint: gomnd
44
+	return strconv.FormatUint(uint64(t.Value), 10)
45 45
 }

+ 2
- 2
internal/config/type_error_rate.go View File

@@ -12,7 +12,7 @@ type TypeErrorRate struct {
12 12
 }
13 13
 
14 14
 func (t *TypeErrorRate) Set(value string) error {
15
-	parsedValue, err := strconv.ParseFloat(value, 64) //nolint: gomnd
15
+	parsedValue, err := strconv.ParseFloat(value, 64)
16 16
 	if err != nil {
17 17
 		return fmt.Errorf("value is not a float (%s): %w", value, err)
18 18
 	}
@@ -43,5 +43,5 @@ func (t TypeErrorRate) MarshalJSON() ([]byte, error) {
43 43
 }
44 44
 
45 45
 func (t TypeErrorRate) String() string {
46
-	return strconv.FormatFloat(t.Value, 'f', -1, 64) //nolint: gomnd
46
+	return strconv.FormatFloat(t.Value, 'f', -1, 64)
47 47
 }

+ 1
- 1
internal/config/type_hostport.go View File

@@ -18,7 +18,7 @@ func (t *TypeHostPort) Set(value string) error {
18 18
 		return fmt.Errorf("incorrect host:port value (%v): %w", value, err)
19 19
 	}
20 20
 
21
-	portValue, err := strconv.ParseUint(port, 10, 16) //nolint: gomnd
21
+	portValue, err := strconv.ParseUint(port, 10, 16)
22 22
 	if err != nil {
23 23
 		return fmt.Errorf("incorrect port number (%v): %w", value, err)
24 24
 	}

+ 1
- 1
internal/config/type_port.go View File

@@ -10,7 +10,7 @@ type TypePort struct {
10 10
 }
11 11
 
12 12
 func (t *TypePort) Set(value string) error {
13
-	portValue, err := strconv.ParseUint(value, 10, 16) //nolint: gomnd
13
+	portValue, err := strconv.ParseUint(value, 10, 16)
14 14
 	if err != nil {
15 15
 		return fmt.Errorf("incorrect port number (%v): %w", value, err)
16 16
 	}

+ 1
- 1
internal/testlib/capture_output.go View File

@@ -35,7 +35,7 @@ func captureOutput(filefp **os.File, callback func()) string {
35 35
 
36 36
 	callback()
37 37
 
38
-	writer.Close()
38
+	writer.Close() //nolint: errcheck
39 39
 	<-closeChan
40 40
 
41 41
 	return strings.TrimSpace(buf.String())

+ 1
- 1
internal/utils/net_listener.go View File

@@ -18,7 +18,7 @@ func (l Listener) Accept() (net.Conn, error) {
18 18
 	}
19 19
 
20 20
 	if err := network.SetClientSocketOptions(conn, 0); err != nil {
21
-		conn.Close()
21
+		conn.Close() //nolint: errcheck
22 22
 
23 23
 		return nil, fmt.Errorf("cannot set TCP options: %w", err)
24 24
 	}

+ 1
- 1
ipblocklist/files/http.go View File

@@ -23,7 +23,7 @@ func (h httpFile) Open(ctx context.Context) (io.ReadCloser, error) {
23 23
 	if err != nil {
24 24
 		if response != nil {
25 25
 			io.Copy(io.Discard, response.Body) //nolint: errcheck
26
-			response.Body.Close()
26
+			response.Body.Close() //nolint: errcheck
27 27
 		}
28 28
 
29 29
 		return nil, fmt.Errorf("cannot get url %s: %w", h.url, err)

+ 1
- 1
ipblocklist/files/http_test.go View File

@@ -77,7 +77,7 @@ func (suite *HTTPTestSuite) TestOk() {
77 77
 	readCloser, err := file.Open(suite.ctx)
78 78
 	suite.NoError(err)
79 79
 
80
-	defer readCloser.Close()
80
+	defer readCloser.Close() //nolint: errcheck
81 81
 
82 82
 	data, err := io.ReadAll(readCloser)
83 83
 	suite.NoError(err)

+ 3
- 3
ipblocklist/firehol.go View File

@@ -19,8 +19,8 @@ import (
19 19
 var (
20 20
 	fireholRegexpComment = regexp.MustCompile(`\s*#.*?$`)
21 21
 
22
-	fireholIPv4DefaultCIDR = net.CIDRMask(32, 32)   //nolint: gomnd
23
-	fireholIPv6DefaultCIDR = net.CIDRMask(128, 128) //nolint: gomnd
22
+	fireholIPv4DefaultCIDR = net.CIDRMask(32, 32)
23
+	fireholIPv6DefaultCIDR = net.CIDRMask(128, 128)
24 24
 )
25 25
 
26 26
 // FireholUpdateCallback defines a signature of the callback that has to be
@@ -130,7 +130,7 @@ func (f *Firehol) update() {
130 130
 				return
131 131
 			}
132 132
 
133
-			defer fileContent.Close()
133
+			defer fileContent.Close() //nolint: errcheck
134 134
 
135 135
 			if err := f.updateFromFile(mutex, ranger, bufio.NewScanner(fileContent)); err != nil {
136 136
 				logger.WarningError("update has failed", err)

+ 1
- 1
ipblocklist/firehol_test.go View File

@@ -35,7 +35,7 @@ func (suite *FireholTestSuite) SetupSuite() {
35 35
 			panic(err)
36 36
 		}
37 37
 
38
-		defer filefp.Close()
38
+		defer filefp.Close() //nolint: errcheck
39 39
 
40 40
 		io.Copy(w, filefp) //nolint: errcheck
41 41
 	})

+ 2
- 2
mtglib/internal/faketls/client_hello.go View File

@@ -56,7 +56,7 @@ func ParseClientHello(secret, handshake []byte) (ClientHello, error) {
56 56
 	if len(handshake)-4 != int(handshakeLength) {
57 57
 		return hello,
58 58
 			fmt.Errorf("incorrect handshake size. manifested=%d, real=%d",
59
-				handshakeLength, len(handshake)-4) //nolint: gomnd
59
+				handshakeLength, len(handshake)-4)
60 60
 	}
61 61
 
62 62
 	copy(hello.Random[:], handshake[ClientHelloRandomOffset:])
@@ -100,7 +100,7 @@ func parseSessionID(hello *ClientHello, handshake []byte) {
100 100
 }
101 101
 
102 102
 func parseCipherSuite(hello *ClientHello, handshake []byte) {
103
-	cipherSuiteOffset := ClientHelloSessionIDOffset + len(hello.SessionID) + 3 //nolint: gomnd
103
+	cipherSuiteOffset := ClientHelloSessionIDOffset + len(hello.SessionID) + 3
104 104
 	hello.CipherSuite = binary.BigEndian.Uint16(handshake[cipherSuiteOffset : cipherSuiteOffset+2])
105 105
 }
106 106
 

+ 1
- 1
mtglib/internal/faketls/welcome.go View File

@@ -36,7 +36,7 @@ func SendWelcomePacket(writer io.Writer, secret []byte, clientHello ClientHello)
36 36
 	rec.Type = record.TypeApplicationData
37 37
 	rec.Version = record.Version12
38 38
 
39
-	if _, err := io.CopyN(&rec.Payload, rand.Reader, int64(1024+mrand.Intn(3092))); err != nil { //nolint: gomnd
39
+	if _, err := io.CopyN(&rec.Payload, rand.Reader, int64(1024+mrand.Intn(3092))); err != nil {
40 40
 		panic(err)
41 41
 	}
42 42
 

+ 1
- 1
mtglib/internal/obfuscated2/handshake_frame.go View File

@@ -36,7 +36,7 @@ type handshakeFrame struct {
36 36
 }
37 37
 
38 38
 func (h *handshakeFrame) dc() int {
39
-	idx := int16(h.data[handshakeFrameOffsetDC]) | int16(h.data[handshakeFrameOffsetDC+1])<<8 //nolint: gomnd, lll // little endian for int16 is here
39
+	idx := int16(h.data[handshakeFrameOffsetDC]) | int16(h.data[handshakeFrameOffsetDC+1])<<8 //nolint: lll // little endian for int16 is here
40 40
 
41 41
 	switch {
42 42
 	case idx > 0:

+ 2
- 2
mtglib/internal/obfuscated2/server_handshake.go View File

@@ -47,12 +47,12 @@ func generateServerHanshakeFrame() serverHandshakeFrame {
47 47
 			panic(err)
48 48
 		}
49 49
 
50
-		if frame.data[0] == 0xef { //nolint: gomnd // taken from tg sources
50
+		if frame.data[0] == 0xef { // taken from tg sources
51 51
 			continue
52 52
 		}
53 53
 
54 54
 		switch binary.LittleEndian.Uint32(frame.data[:4]) {
55
-		case 0x44414548, 0x54534f50, 0x20544547, 0x4954504f, 0xeeeeeeee: //nolint: gomnd // taken from tg sources
55
+		case 0x44414548, 0x54534f50, 0x20544547, 0x4954504f, 0xeeeeeeee: // taken from tg sources
56 56
 			continue
57 57
 		}
58 58
 

+ 4
- 4
mtglib/internal/relay/relay.go View File

@@ -9,16 +9,16 @@ import (
9 9
 )
10 10
 
11 11
 func Relay(ctx context.Context, log Logger, telegramConn, clientConn essentials.Conn) {
12
-	defer telegramConn.Close()
13
-	defer clientConn.Close()
12
+	defer telegramConn.Close() //nolint: errcheck
13
+	defer clientConn.Close() //nolint: errcheck
14 14
 
15 15
 	ctx, cancel := context.WithCancel(ctx)
16 16
 	defer cancel()
17 17
 
18 18
 	go func() {
19 19
 		<-ctx.Done()
20
-		telegramConn.Close()
21
-		clientConn.Close()
20
+		telegramConn.Close() //nolint: errcheck
21
+		clientConn.Close() //nolint: errcheck
22 22
 	}()
23 23
 
24 24
 	closeChan := make(chan struct{})

+ 3
- 3
mtglib/proxy.go View File

@@ -110,7 +110,7 @@ func (p *Proxy) Serve(listener net.Listener) error {
110 110
 		logger := p.logger.BindStr("ip", ipAddr.String())
111 111
 
112 112
 		if !p.allowlist.Contains(ipAddr) {
113
-			conn.Close()
113
+			conn.Close() //nolint: errcheck
114 114
 			logger.Info("ip was rejected by allowlist")
115 115
 			p.eventStream.Send(p.ctx, NewEventIPAllowlisted(ipAddr))
116 116
 
@@ -118,7 +118,7 @@ func (p *Proxy) Serve(listener net.Listener) error {
118 118
 		}
119 119
 
120 120
 		if p.blocklist.Contains(ipAddr) {
121
-			conn.Close()
121
+			conn.Close() //nolint: errcheck
122 122
 			logger.Info("ip was blacklisted")
123 123
 			p.eventStream.Send(p.ctx, NewEventIPBlocklisted(ipAddr))
124 124
 
@@ -235,7 +235,7 @@ func (p *Proxy) doTelegramCall(ctx *streamContext) error {
235 235
 
236 236
 	encryptor, decryptor, err := obfuscated2.ServerHandshake(conn)
237 237
 	if err != nil {
238
-		conn.Close()
238
+		conn.Close() //nolint: errcheck
239 239
 
240 240
 		return fmt.Errorf("cannot perform obfuscated2 handshake: %w", err)
241 241
 	}

+ 2
- 2
mtglib/proxy_test.go View File

@@ -86,7 +86,7 @@ func (suite *ProxyTestSuite) SetupSuite() {
86 86
 
87 87
 func (suite *ProxyTestSuite) TearDownSuite() {
88 88
 	if suite.listener != nil {
89
-		suite.listener.Close()
89
+		suite.listener.Close() //nolint: errcheck
90 90
 	}
91 91
 
92 92
 	if suite.p != nil {
@@ -177,7 +177,7 @@ func (suite *ProxyTestSuite) TestHTTPSRequest() {
177 177
 	resp, err := client.Get(addr) //nolint: noctx
178 178
 	suite.NoError(err)
179 179
 
180
-	defer resp.Body.Close()
180
+	defer resp.Body.Close() //nolint: errcheck
181 181
 
182 182
 	suite.Equal(http.StatusOK, resp.StatusCode)
183 183
 

+ 1
- 1
mtglib/secret.go View File

@@ -74,7 +74,7 @@ func (s *Secret) Set(text string) error {
74 74
 		return fmt.Errorf("incorrect secret format: %w", err)
75 75
 	}
76 76
 
77
-	if len(decoded) < 2 { //nolint: gomnd // we need at least 1 byte here
77
+	if len(decoded) < 2 { // we need at least 1 byte here
78 78
 		return fmt.Errorf("secret is truncated, length=%d", len(decoded))
79 79
 	}
80 80
 

+ 2
- 2
mtglib/stream_context.go View File

@@ -40,11 +40,11 @@ func (s *streamContext) Close() {
40 40
 	s.ctxCancel()
41 41
 
42 42
 	if s.clientConn != nil {
43
-		s.clientConn.Close()
43
+		s.clientConn.Close() //nolint: errcheck
44 44
 	}
45 45
 
46 46
 	if s.telegramConn != nil {
47
-		s.telegramConn.Close()
47
+		s.telegramConn.Close() //nolint: errcheck
48 48
 	}
49 49
 }
50 50
 

+ 1
- 1
mtglib/stream_context_internal_test.go View File

@@ -24,7 +24,7 @@ func (suite *StreamContextTestSuite) SetupSuite() {
24 24
 
25 25
 func (suite *StreamContextTestSuite) SetupTest() {
26 26
 	ctx, cancel := context.WithCancel(context.Background())
27
-	ctx = context.WithValue(ctx, "key", "value") //nolint: golint, staticcheck
27
+	ctx = context.WithValue(ctx, "key", "value") //nolint: staticcheck
28 28
 
29 29
 	suite.ctxCancel = cancel
30 30
 	suite.connMock = &testlib.EssentialsConnMock{}

+ 2
- 2
network/circuit_breaker.go View File

@@ -56,7 +56,7 @@ func (c *circuitBreakerDialer) doClosed(ctx context.Context,
56 56
 	select {
57 57
 	case <-ctx.Done():
58 58
 		if conn != nil {
59
-			conn.Close()
59
+			conn.Close() //nolint: errcheck
60 60
 		}
61 61
 
62 62
 		return nil, ctx.Err() //nolint: wrapcheck
@@ -93,7 +93,7 @@ func (c *circuitBreakerDialer) doHalfOpened(ctx context.Context,
93 93
 	select {
94 94
 	case <-ctx.Done():
95 95
 		if conn != nil {
96
-			conn.Close()
96
+			conn.Close() //nolint: errcheck
97 97
 		}
98 98
 
99 99
 		return nil, ctx.Err() //nolint: wrapcheck

+ 1
- 1
network/default.go View File

@@ -31,7 +31,7 @@ func (d *defaultDialer) DialContext(ctx context.Context, network, address string
31 31
 
32 32
 	// we do not need to call to end user. End users call us.
33 33
 	if err := SetServerSocketOptions(conn, 0); err != nil {
34
-		conn.Close()
34
+		conn.Close() //nolint: errcheck
35 35
 
36 36
 		return nil, fmt.Errorf("cannot set socket options: %w", err)
37 37
 	}

+ 2
- 2
network/default_test.go View File

@@ -51,7 +51,7 @@ func (suite *DefaultDialerTestSuite) TestConnectOk() {
51 51
 	suite.NoError(err)
52 52
 	suite.NotNil(conn)
53 53
 
54
-	conn.Close()
54
+	conn.Close() //nolint: errcheck
55 55
 }
56 56
 
57 57
 func (suite *DefaultDialerTestSuite) TestHTTPRequest() {
@@ -59,7 +59,7 @@ func (suite *DefaultDialerTestSuite) TestHTTPRequest() {
59 59
 
60 60
 	resp, err := httpClient.Get(suite.MakeURL("/get")) //nolint: noctx
61 61
 	if err == nil {
62
-		defer resp.Body.Close()
62
+		defer resp.Body.Close() //nolint: errcheck
63 63
 	}
64 64
 
65 65
 	suite.NoError(err)

+ 1
- 1
network/init_test.go View File

@@ -78,7 +78,7 @@ func (suite *Socks5ServerTestSuite) SetupSuite() {
78 78
 }
79 79
 
80 80
 func (suite *Socks5ServerTestSuite) TearDownSuite() {
81
-	suite.socks5Listener.Close()
81
+	suite.socks5Listener.Close() //nolint: errcheck
82 82
 }
83 83
 
84 84
 func (suite *Socks5ServerTestSuite) MakeSocks5URL(user, password string) *url.URL {

+ 1
- 1
network/load_balanced_socks5_test.go View File

@@ -75,7 +75,7 @@ func (suite *LoadBalancedSocks5TestSuite) TestCannotDial() {
75 75
 func (suite *LoadBalancedSocks5TestSuite) TestDialOk() {
76 76
 	resp, err := suite.httpClient.Get(suite.MakeURL("/get")) //nolint: noctx
77 77
 	if err == nil {
78
-		defer resp.Body.Close()
78
+		defer resp.Body.Close() //nolint: errcheck
79 79
 	}
80 80
 
81 81
 	suite.NoError(err)

+ 2
- 2
network/network_test.go View File

@@ -34,7 +34,7 @@ func (suite *NetworkTestSuite) TestLocalHTTPRequest() {
34 34
 	resp, err := client.Get(suite.httpServer.URL + "/headers") //nolint: noctx
35 35
 	suite.NoError(err)
36 36
 
37
-	defer resp.Body.Close()
37
+	defer resp.Body.Close() //nolint: errcheck
38 38
 
39 39
 	data, err := io.ReadAll(resp.Body)
40 40
 	suite.NoError(err)
@@ -59,7 +59,7 @@ func (suite *NetworkTestSuite) TestRealHTTPRequest() {
59 59
 	resp, err := client.Get("https://httpbin.org/headers") //nolint: noctx
60 60
 	suite.NoError(err)
61 61
 
62
-	defer resp.Body.Close()
62
+	defer resp.Body.Close() //nolint: errcheck
63 63
 
64 64
 	data, err := io.ReadAll(resp.Body)
65 65
 	suite.NoError(err)

+ 1
- 1
network/proxy_dialer.go View File

@@ -16,7 +16,7 @@ func newProxyDialer(baseDialer Dialer, proxyURL *url.URL) Dialer {
16 16
 	)
17 17
 
18 18
 	if param := params.Get("open_threshold"); param != "" {
19
-		if intNum, err := strconv.ParseUint(param, 10, 32); err == nil { //nolint: gomnd
19
+		if intNum, err := strconv.ParseUint(param, 10, 32); err == nil {
20 20
 			openThreshold = uint32(intNum)
21 21
 		}
22 22
 	}

+ 2
- 2
network/sockopts_unix.go View File

@@ -14,14 +14,14 @@ func setSocketReuseAddrPort(conn syscall.RawConn) error {
14 14
 	var err error
15 15
 
16 16
 	conn.Control(func(fd uintptr) { //nolint: errcheck
17
-		err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR, 1) //nolint: nosnakecase
17
+		err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR, 1)
18 18
 		if err != nil {
19 19
 			err = fmt.Errorf("cannot set SO_REUSEADDR: %w", err)
20 20
 
21 21
 			return
22 22
 		}
23 23
 
24
-		err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1) //nolint: nosnakecase
24
+		err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1)
25 25
 		if err != nil {
26 26
 			err = fmt.Errorf("cannot set SO_REUSEPORT: %w", err)
27 27
 		}

+ 2
- 2
network/socks5.go View File

@@ -36,13 +36,13 @@ func (s socks5Dialer) DialContext(ctx context.Context, network, address string)
36 36
 	}
37 37
 
38 38
 	if err := s.handshake(conn); err != nil {
39
-		conn.Close()
39
+		conn.Close() //nolint: errcheck
40 40
 
41 41
 		return nil, fmt.Errorf("cannot perform a handshake: %w", err)
42 42
 	}
43 43
 
44 44
 	if err := s.connect(conn, address); err != nil {
45
-		conn.Close()
45
+		conn.Close() //nolint: errcheck
46 46
 
47 47
 		return nil, fmt.Errorf("cannot connect to a destination host %s: %w", address, err)
48 48
 	}

+ 2
- 2
network/socks5_test.go View File

@@ -35,7 +35,7 @@ func (suite *Socks5TestSuite) TestRequestFailed() {
35 35
 
36 36
 	resp, err := httpClient.Get(suite.MakeURL("/get")) //nolint: noctx
37 37
 	if err == nil {
38
-		defer resp.Body.Close()
38
+		defer resp.Body.Close() //nolint: errcheck
39 39
 	}
40 40
 
41 41
 	suite.Error(err)
@@ -48,7 +48,7 @@ func (suite *Socks5TestSuite) TestRequestOk() {
48 48
 
49 49
 	resp, err := httpClient.Get(suite.MakeURL("/get")) //nolint: noctx
50 50
 	if err == nil {
51
-		defer resp.Body.Close()
51
+		defer resp.Body.Close() //nolint: errcheck
52 52
 	}
53 53
 
54 54
 	suite.NoError(err)

+ 2
- 2
stats/prometheus_test.go View File

@@ -30,7 +30,7 @@ func (suite *PrometheusTestSuite) Get() (string, error) {
30 30
 		return "", err //nolint: wrapcheck
31 31
 	}
32 32
 
33
-	defer resp.Body.Close()
33
+	defer resp.Body.Close() //nolint: errcheck
34 34
 
35 35
 	data, err := io.ReadAll(resp.Body)
36 36
 	if err != nil {
@@ -51,7 +51,7 @@ func (suite *PrometheusTestSuite) SetupTest() {
51 51
 func (suite *PrometheusTestSuite) TearDownTest() {
52 52
 	suite.prometheus.Shutdown()
53 53
 	suite.NoError(suite.factory.Close())
54
-	suite.httpListener.Close()
54
+	suite.httpListener.Close() //nolint: errcheck
55 55
 }
56 56
 
57 57
 func (suite *PrometheusTestSuite) TestTelegramPath() {

+ 2
- 2
stats/statsd_test.go View File

@@ -100,8 +100,8 @@ func (suite *StatsdTestSuite) SetupTest() {
100 100
 
101 101
 func (suite *StatsdTestSuite) TearDownTest() {
102 102
 	suite.statsd.Shutdown()
103
-	suite.factory.Close()
104
-	suite.statsdServer.Close()
103
+	suite.factory.Close() //nolint: errcheck
104
+	suite.statsdServer.Close() //nolint: errcheck
105 105
 }
106 106
 
107 107
 func (suite *StatsdTestSuite) TestTelegramPath() {

Loading…
Cancel
Save