Update golangci-lint

This commit is contained in:
9seconds
2019-01-24 08:15:56 +03:00
parent 16558a7c55
commit f68b195306
8 changed files with 14 additions and 30 deletions
+1
View File
@@ -10,3 +10,4 @@ format = "colored-line-number"
[linters]
enable-all = true
disable = ["gochecknoglobals"]
+2 -10
View File
@@ -4,7 +4,7 @@ APP_NAME := $(IMAGE_NAME)
CC_BINARIES := $(shell bash -c "echo -n $(APP_NAME)-{linux,freebsd,openbsd}-{386,amd64} $(APP_NAME)-linux-{arm,arm64}")
GOLANGCI_LINT_VERSION := v1.11.2
GOLANGCI_LINT_VERSION := v1.13
VERSION_GO := $(shell go version)
VERSION_DATE := $(shell date -Ru)
@@ -59,10 +59,6 @@ test: vendor
lint: vendor
@$(MOD_OFF) golangci-lint run
.PHONY: critic
critic: vendor
@$(MOD_OFF) gocritic check-project "$(ROOT_DIR)"
.PHONY: clean
clean:
@git clean -xfd && \
@@ -74,13 +70,9 @@ docker:
@docker build --pull -t "$(IMAGE_NAME)" "$(ROOT_DIR)"
.PHONY: prepare
prepare: install-lint install-critic
prepare: install-lint
.PHONY: install-lint
install-lint:
@curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh \
| $(MOD_OFF) bash -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION)
.PHONY: install-critic
install-critic:
@$(MOD_OFF) go get -u github.com/go-critic/go-critic/...
+2 -2
View File
@@ -226,13 +226,13 @@ This tool will listen on port 3128 by default with the given secret.
# One-line runner
```console
docker run --name mtg --restart=unless-stopped -p 3128:3128 -q 3129:3129 -d nineseconds/mtg:stable $(openssl rand -hex 16)
docker run --name mtg --restart=unless-stopped -p 3128:3128 -p 3129:3129 -d nineseconds/mtg:stable $(openssl rand -hex 16)
```
or in secret mode:
```console
docker run --name mtg --restart=unless-stopped -p 3128:3128 -q 3129:3129 -d nineseconds/mtg:stable dd$(openssl rand -hex 16)
docker run --name mtg --restart=unless-stopped -p 3128:3128 -p 3129:3129 -d nineseconds/mtg:stable dd$(openssl rand -hex 16)
```
You will have this tool up and running on port 3128. Now curl
+1 -3
View File
@@ -138,13 +138,11 @@ var (
adtag = app.Arg("adtag", "ADTag of the proxy.").HexBytes()
)
func init() {
func main() { // nolint: gocyclo
rand.Seed(time.Now().UTC().UnixNano())
app.Version(version)
app.HelpFlag.Short('h')
}
func main() { // nolint: gocyclo
kingpin.MustParse(app.Parse(os.Args[1:]))
err := setRLimit()
+2 -7
View File
@@ -23,11 +23,6 @@ var (
ProxyRequestExtraSize = []byte{0x18, 0x00, 0x00, 0x00}
ProxyRequestProxyTag = []byte{0xae, 0x26, 0x1e, 0xdb}
HandshakeSenderPID []byte
HandshakePeerPID []byte
)
func init() {
HandshakeSenderPID = []byte("IPIPPRPDTIME")
HandshakePeerPID = []byte("IPIPPRPDTIME")
}
HandshakePeerPID = []byte("IPIPPRPDTIME")
)
+3 -3
View File
@@ -78,10 +78,10 @@ func TestFrameGenerateValid(t *testing.T) {
}
for _, test := range validTests {
t.Run(strconv.Itoa(int(test)), func(tt *testing.T) {
frame := generateFrame(test)
frame := generateFrame(test) // nolint: scopelint
conType, err := frame.ConnectionType()
assert.Nil(t, err)
assert.Equal(t, conType, test)
assert.Nil(tt, err)
assert.Equal(tt, conType, test) // nolint: scopelint
})
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ import (
func startServer(conf *config.Config, prometheusHandler http.Handler) {
log := zap.S().Named("stats")
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
http.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json")
first, err := json.Marshal(GetStats())
+2 -4
View File
@@ -5,12 +5,10 @@ import (
"sync"
)
var streamCipherBufferPool sync.Pool
func init() {
var (
streamCipherBufferPool = sync.Pool{
New: func() interface{} {
return &bytes.Buffer{}
},
}
}
)