diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ef1b5c5c6d..5130b05f24 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,9 +8,12 @@ jobs: lint: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: GolangCI-Lint Action - uses: golangci/golangci-lint-action@v2 + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: 1.17.x + - run: go version + - run: diff -u <(echo -n) <(gofmt -d .) + - uses: golangci/golangci-lint-action@v2 with: version: v1.28.3 diff --git a/bytesconv.go b/bytesconv.go index 79896e86a0..374092a30f 100644 --- a/bytesconv.go +++ b/bytesconv.go @@ -11,11 +11,11 @@ import ( "math" "net" "reflect" + "runtime" "strings" "sync" "time" "unsafe" - "runtime" ) // AppendHTMLEscape appends html-escaped s to dst and returns the extended dst. diff --git a/header.go b/header.go index 73e98449d2..f15ef371c8 100644 --- a/header.go +++ b/header.go @@ -271,11 +271,11 @@ func (h *RequestHeader) SetContentLength(contentLength int) { func (h *ResponseHeader) isCompressibleContentType() bool { contentType := h.ContentType() return bytes.HasPrefix(contentType, strTextSlash) || - bytes.HasPrefix(contentType, strApplicationSlash) || - bytes.HasPrefix(contentType, strImageSVG) || - bytes.HasPrefix(contentType, strImageIcon) || - bytes.HasPrefix(contentType, strFontSlash) || - bytes.HasPrefix(contentType, strMultipartSlash) + bytes.HasPrefix(contentType, strApplicationSlash) || + bytes.HasPrefix(contentType, strImageSVG) || + bytes.HasPrefix(contentType, strImageIcon) || + bytes.HasPrefix(contentType, strFontSlash) || + bytes.HasPrefix(contentType, strMultipartSlash) } // ContentType returns Content-Type header value. diff --git a/strings.go b/strings.go index 7f12cbc676..e28eaac262 100644 --- a/strings.go +++ b/strings.go @@ -73,10 +73,10 @@ var ( strBytes = []byte("bytes") strBasicSpace = []byte("Basic ") - strApplicationSlash = []byte("application/") - strImageSVG = []byte("image/svg") - strImageIcon = []byte("image/x-icon") - strFontSlash = []byte("font/") - strMultipartSlash = []byte("multipart/") - strTextSlash = []byte("text/") + strApplicationSlash = []byte("application/") + strImageSVG = []byte("image/svg") + strImageIcon = []byte("image/x-icon") + strFontSlash = []byte("font/") + strMultipartSlash = []byte("multipart/") + strTextSlash = []byte("text/") )