Parcourir la source

Fix lint issues

tags/v2.1.11^2^2
9seconds il y a 2 mois
Parent
révision
36c766b331

+ 2
- 2
mtglib/internal/dc/public_config_updater.go Voir le fichier

@@ -29,8 +29,8 @@ func (p PublicConfigUpdater) Run(ctx context.Context, url, network string) {
29 29
 		resp, err := p.http.Do(req)
30 30
 		if err != nil {
31 31
 			if resp != nil {
32
-				io.Copy(io.Discard, resp.Body)
33
-				resp.Body.Close()
32
+				io.Copy(io.Discard, resp.Body) //nolint: errcheck
33
+				resp.Body.Close()              //nolint: errcheck
34 34
 			}
35 35
 			return fmt.Errorf("cannot fetch url %s: %w", url, err)
36 36
 		}

+ 2
- 2
mtglib/internal/dc/public_config_updater_test.go Voir le fichier

@@ -90,7 +90,7 @@ lala 0 0
90 90
 	s.responseHandler = func(w http.ResponseWriter) {
91 91
 		done = true
92 92
 		w.WriteHeader(http.StatusOK)
93
-		w.Write([]byte(result))
93
+		w.Write([]byte(result)) //nolint: errcheck
94 94
 	}
95 95
 	go s.u.Run(s.ctx, s.srv.URL, "tcp4")
96 96
 
@@ -114,7 +114,7 @@ proxy_for -100 101.10.0.0:3333;
114 114
 	s.responseHandler = func(w http.ResponseWriter) {
115 115
 		done = true
116 116
 		w.WriteHeader(http.StatusOK)
117
-		w.Write([]byte(result))
117
+		w.Write([]byte(result)) //nolint: errcheck
118 118
 	}
119 119
 	go s.u.Run(s.ctx, s.srv.URL, "tcp4")
120 120
 

+ 0
- 2
mtglib/internal/dc/telegram.go Voir le fichier

@@ -1,14 +1,12 @@
1 1
 package dc
2 2
 
3 3
 import (
4
-	"context"
5 4
 	"fmt"
6 5
 	"strings"
7 6
 	"sync"
8 7
 )
9 8
 
10 9
 type Telegram struct {
11
-	ctx      context.Context
12 10
 	lock     sync.RWMutex
13 11
 	view     dcView
14 12
 	preferIP preferIP

+ 1
- 1
mtglib/internal/obfuscation/obfuscator_test.go Voir le fichier

@@ -20,7 +20,7 @@ type ObfuscatorTestSuite struct {
20 20
 }
21 21
 
22 22
 func (s *ObfuscatorTestSuite) SetupSuite() {
23
-	s.SnapshotTestSuite.Setup("", "client-handshake")
23
+	s.Setup("", "client-handshake")
24 24
 
25 25
 	secret := mtglib.GenerateSecret("hostname.com")
26 26
 	s.secret = &secret

+ 1
- 1
mtglib/proxy.go Voir le fichier

@@ -245,7 +245,7 @@ func (p *Proxy) doTelegramCall(ctx *streamContext) error {
245 245
 
246 246
 	tgConn, err := foundAddr.Obfuscator.SendHandshake(conn, ctx.dc)
247 247
 	if err != nil {
248
-		conn.Close()
248
+		conn.Close() // nolint: errcheck
249 249
 		return fmt.Errorf("cannot perform server handshake: %w", err)
250 250
 	}
251 251
 

Chargement…
Annuler
Enregistrer