Преглед на файлове

Update golangci-lint

tags/0.16
9seconds преди 7 години
родител
ревизия
f68b195306
променени са 8 файла, в които са добавени 14 реда и са изтрити 30 реда
  1. 1
    0
      .golangci.toml
  2. 2
    10
      Makefile
  3. 2
    2
      README.md
  4. 1
    3
      main.go
  5. 2
    7
      mtproto/rpc/rpc.go
  6. 3
    3
      obfuscated2/frame_test.go
  7. 1
    1
      stats/server.go
  8. 2
    4
      wrappers/streamcipher_pool.go

+ 1
- 0
.golangci.toml Целия файл

@@ -10,3 +10,4 @@ format = "colored-line-number"
10 10
 
11 11
 [linters]
12 12
 enable-all = true
13
+disable = ["gochecknoglobals"]

+ 2
- 10
Makefile Целия файл

@@ -4,7 +4,7 @@ APP_NAME     := $(IMAGE_NAME)
4 4
 
5 5
 CC_BINARIES  := $(shell bash -c "echo -n $(APP_NAME)-{linux,freebsd,openbsd}-{386,amd64} $(APP_NAME)-linux-{arm,arm64}")
6 6
 
7
-GOLANGCI_LINT_VERSION := v1.11.2
7
+GOLANGCI_LINT_VERSION := v1.13
8 8
 
9 9
 VERSION_GO         := $(shell go version)
10 10
 VERSION_DATE       := $(shell date -Ru)
@@ -59,10 +59,6 @@ test: vendor
59 59
 lint: vendor
60 60
 	@$(MOD_OFF) golangci-lint run
61 61
 
62
-.PHONY: critic
63
-critic: vendor
64
-	@$(MOD_OFF) gocritic check-project "$(ROOT_DIR)"
65
-
66 62
 .PHONY: clean
67 63
 clean:
68 64
 	@git clean -xfd && \
@@ -74,13 +70,9 @@ docker:
74 70
 	@docker build --pull -t "$(IMAGE_NAME)" "$(ROOT_DIR)"
75 71
 
76 72
 .PHONY: prepare
77
-prepare: install-lint install-critic
73
+prepare: install-lint
78 74
 
79 75
 .PHONY: install-lint
80 76
 install-lint:
81 77
 	@curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh \
82 78
 		| $(MOD_OFF) bash -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION)
83
-
84
-.PHONY: install-critic
85
-install-critic:
86
-	@$(MOD_OFF) go get -u github.com/go-critic/go-critic/...

+ 2
- 2
README.md Целия файл

@@ -226,13 +226,13 @@ This tool will listen on port 3128 by default with the given secret.
226 226
 # One-line runner
227 227
 
228 228
 ```console
229
-docker run --name mtg --restart=unless-stopped -p 3128:3128 -q 3129:3129 -d nineseconds/mtg:stable $(openssl rand -hex 16)
229
+docker run --name mtg --restart=unless-stopped -p 3128:3128 -p 3129:3129 -d nineseconds/mtg:stable $(openssl rand -hex 16)
230 230
 ```
231 231
 
232 232
 or in secret mode:
233 233
 
234 234
 ```console
235
-docker run --name mtg --restart=unless-stopped -p 3128:3128 -q 3129:3129 -d nineseconds/mtg:stable dd$(openssl rand -hex 16)
235
+docker run --name mtg --restart=unless-stopped -p 3128:3128 -p 3129:3129 -d nineseconds/mtg:stable dd$(openssl rand -hex 16)
236 236
 ```
237 237
 
238 238
 You will have this tool up and running on port 3128. Now curl

+ 1
- 3
main.go Целия файл

@@ -138,13 +138,11 @@ var (
138 138
 	adtag  = app.Arg("adtag", "ADTag of the proxy.").HexBytes()
139 139
 )
140 140
 
141
-func init() {
141
+func main() { // nolint: gocyclo
142 142
 	rand.Seed(time.Now().UTC().UnixNano())
143 143
 	app.Version(version)
144 144
 	app.HelpFlag.Short('h')
145
-}
146 145
 
147
-func main() { // nolint: gocyclo
148 146
 	kingpin.MustParse(app.Parse(os.Args[1:]))
149 147
 
150 148
 	err := setRLimit()

+ 2
- 7
mtproto/rpc/rpc.go Целия файл

@@ -23,11 +23,6 @@ var (
23 23
 	ProxyRequestExtraSize = []byte{0x18, 0x00, 0x00, 0x00}
24 24
 	ProxyRequestProxyTag  = []byte{0xae, 0x26, 0x1e, 0xdb}
25 25
 
26
-	HandshakeSenderPID []byte
27
-	HandshakePeerPID   []byte
28
-)
29
-
30
-func init() {
31 26
 	HandshakeSenderPID = []byte("IPIPPRPDTIME")
32
-	HandshakePeerPID = []byte("IPIPPRPDTIME")
33
-}
27
+	HandshakePeerPID   = []byte("IPIPPRPDTIME")
28
+)

+ 3
- 3
obfuscated2/frame_test.go Целия файл

@@ -78,10 +78,10 @@ func TestFrameGenerateValid(t *testing.T) {
78 78
 	}
79 79
 	for _, test := range validTests {
80 80
 		t.Run(strconv.Itoa(int(test)), func(tt *testing.T) {
81
-			frame := generateFrame(test)
81
+			frame := generateFrame(test) // nolint: scopelint
82 82
 			conType, err := frame.ConnectionType()
83
-			assert.Nil(t, err)
84
-			assert.Equal(t, conType, test)
83
+			assert.Nil(tt, err)
84
+			assert.Equal(tt, conType, test) // nolint: scopelint
85 85
 		})
86 86
 	}
87 87
 }

+ 1
- 1
stats/server.go Целия файл

@@ -12,7 +12,7 @@ import (
12 12
 func startServer(conf *config.Config, prometheusHandler http.Handler) {
13 13
 	log := zap.S().Named("stats")
14 14
 
15
-	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
15
+	http.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
16 16
 		w.Header().Set("Content-Type", "application/json")
17 17
 
18 18
 		first, err := json.Marshal(GetStats())

+ 2
- 4
wrappers/streamcipher_pool.go Целия файл

@@ -5,12 +5,10 @@ import (
5 5
 	"sync"
6 6
 )
7 7
 
8
-var streamCipherBufferPool sync.Pool
9
-
10
-func init() {
8
+var (
11 9
 	streamCipherBufferPool = sync.Pool{
12 10
 		New: func() interface{} {
13 11
 			return &bytes.Buffer{}
14 12
 		},
15 13
 	}
16
-}
14
+)

Loading…
Отказ
Запис