diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 776a07a..63b7e18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,29 +11,27 @@ jobs: runs-on: ubuntu-latest steps: + - name: checkout + uses: actions/checkout@v4 + - name: set up go uses: actions/setup-go@v5 with: go-version: "1.23" id: go - - name: checkout - uses: actions/checkout@v4 - - name: build and test run: | - go get -v go test -timeout=60s -race -covermode=atomic -coverprofile=$GITHUB_WORKSPACE/profile.cov_tmp cat $GITHUB_WORKSPACE/profile.cov_tmp | grep -v "_mock.go" > $GITHUB_WORKSPACE/profile.cov go build -race env: - GO111MODULE: "on" TZ: "America/Chicago" - name: golangci-lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v7 with: - version: v1.64 + version: latest - name: install goveralls run: | @@ -42,4 +40,4 @@ jobs: - name: submit coverage run: $(go env GOPATH)/bin/goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/profile.cov env: - COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.golangci.yml b/.golangci.yml index ec36f9d..bd6fb4a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,66 +1,63 @@ +version: "2" run: timeout: 5m tests: false - -linters-settings: - govet: - enable: - - shadow - goconst: - min-len: 2 - min-occurrences: 2 - misspell: - locale: US - lll: - line-length: 140 - gocritic: - enabled-tags: - - performance - - style - - experimental - disabled-checks: - - wrapperFunc - - hugeParam - - rangeValCopy - - singleCaseSwitch - - ifElseChain - + concurrency: 4 linters: + default: none enable: - - revive - - govet - - unconvert - - staticcheck - - unused - - gosec - dupl - - misspell - - unparam - - typecheck - - ineffassign - - stylecheck - gochecknoinits - - copyloopvar - gocritic + - govet + - ineffassign + - misspell - nakedret - - gosimple - prealloc - fast: false - disable-all: true - -issues: - exclude-dirs: - - vendor - exclude-rules: - - text: "at least one file in a package should have a package comment" - linters: - - stylecheck - - text: "should have a package comment" - linters: - - revive - - path: _test\.go - linters: - - gosec - - dupl - exclude-use-default: false + - revive + - staticcheck + - unconvert + - unparam + - unused + settings: + goconst: + min-len: 2 + min-occurrences: 2 + gocritic: + disabled-checks: + - wrapperFunc + - hugeParam + - rangeValCopy + - singleCaseSwitch + - ifElseChain + enabled-tags: + - performance + - style + - experimental + govet: + enable-all: true + disable: + - fieldalignment + lll: + line-length: 140 + misspell: + locale: US + exclusions: + generated: lax + rules: + - linters: + - staticcheck + text: "at least one file in a package should have a package comment" + - linters: + - revive + text: "should have a package comment" + - linters: + - gosec + - dupl + path: _test\.go + paths: + - vendor + - third_party$ + - builtin$ + - examples$ diff --git a/file_server.go b/file_server.go index ccf47df..088ac9d 100644 --- a/file_server.go +++ b/file_server.go @@ -68,12 +68,14 @@ func NewFileServer(public, local string, options ...FsOpt) (*FS, error) { } // FileServer is a shortcut for making FS with listing disabled and the custom noFound reader (can be nil). +// // Deprecated: the method is for back-compatibility only and user should use the universal NewFileServer instead func FileServer(public, local string, notFound io.Reader) (http.Handler, error) { return NewFileServer(public, local, FsOptCustom404(notFound)) } // FileServerSPA is a shortcut for making FS with SPA-friendly handling of 404, listing disabled and the custom noFound reader (can be nil). +// // Deprecated: the method is for back-compatibility only and user should use the universal NewFileServer instead func FileServerSPA(public, local string, notFound io.Reader) (http.Handler, error) { return NewFileServer(public, local, FsOptCustom404(notFound), FsOptSPA) diff --git a/logger/logger.go b/logger/logger.go index e814663..2c49908 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -355,5 +355,5 @@ func (c *customResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { if hj, ok := c.ResponseWriter.(http.Hijacker); ok { return hj.Hijack() } - return nil, nil, fmt.Errorf("ResponseWriter does not implement the Hijacker interface") //nolint:golint //capital letter is OK here + return nil, nil, fmt.Errorf("ResponseWriter does not implement the Hijacker interface") }