From dc6eb815da29e84ffd8f69684cd492261aaf2d6a Mon Sep 17 00:00:00 2001 From: xjasonlyu Date: Thu, 11 May 2023 10:57:42 +0800 Subject: [PATCH] CI(linter): enable new linters --- .golangci.yaml | 13 ++++++++++--- component/simple-obfs/http.go | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 3455902..26a4188 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,13 +1,20 @@ linters: disable-all: true enable: - - gofumpt - - staticcheck - - govet - gci + - gofumpt + - gosimple + - govet + - ineffassign + - misspell + - staticcheck + - unconvert + - unused + - usestdlibvars linters-settings: gci: + custom-order: true sections: - standard - default diff --git a/component/simple-obfs/http.go b/component/simple-obfs/http.go index 57cdec6..f9a2ed1 100644 --- a/component/simple-obfs/http.go +++ b/component/simple-obfs/http.go @@ -65,7 +65,7 @@ func (ho *HTTPObfs) Write(b []byte) (int, error) { if ho.firstRequest { randBytes := make([]byte, 16) rand.Read(randBytes) - req, _ := http.NewRequest("GET", fmt.Sprintf("http://%s/", ho.host), bytes.NewBuffer(b[:])) + req, _ := http.NewRequest(http.MethodGet, fmt.Sprintf("http://%s/", ho.host), bytes.NewBuffer(b[:])) req.Header.Set("User-Agent", fmt.Sprintf("curl/7.%d.%d", mRand.Int()%54, mRand.Int()%2)) req.Header.Set("Upgrade", "websocket") req.Header.Set("Connection", "Upgrade")