Просмотр исходного кода

Fix lint issues

tags/v2.1.11^2^2
9seconds 2 месяцев назад
Родитель
Сommit
36c766b331

+ 2
- 2
mtglib/internal/dc/public_config_updater.go Просмотреть файл

29
 		resp, err := p.http.Do(req)
29
 		resp, err := p.http.Do(req)
30
 		if err != nil {
30
 		if err != nil {
31
 			if resp != nil {
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
 			return fmt.Errorf("cannot fetch url %s: %w", url, err)
35
 			return fmt.Errorf("cannot fetch url %s: %w", url, err)
36
 		}
36
 		}

+ 2
- 2
mtglib/internal/dc/public_config_updater_test.go Просмотреть файл

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

+ 0
- 2
mtglib/internal/dc/telegram.go Просмотреть файл

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

+ 1
- 1
mtglib/internal/obfuscation/obfuscator_test.go Просмотреть файл

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

+ 1
- 1
mtglib/proxy.go Просмотреть файл

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

Загрузка…
Отмена
Сохранить