diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2023-05-08 05:09:10 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2023-05-08 05:09:10 +0300 |
commit | 1fe7261a90660978039adb8a8e46b095dad69659 (patch) | |
tree | 16c0dcc954605b018aad9d5ba1d53f9cd278a29a | |
parent | 6c557b2169b961d9f5b8ba5f9acc6636071c5421 (diff) |
Upgrade golangci-lint to v1.52.2 on CI
-rw-r--r-- | .gitlab/ci/test.yml | 2 | ||||
-rw-r--r-- | .golangci.yml | 10 | ||||
-rw-r--r-- | .tool-versions | 1 | ||||
-rw-r--r-- | app.go | 6 | ||||
-rw-r--r-- | internal/auth/auth.go | 4 | ||||
-rw-r--r-- | internal/serving/disk/symlink/symlink.go | 2 | ||||
-rw-r--r-- | internal/uniquedomain/middleware.go (renamed from internal/uniqueDomain/middleware.go) | 2 | ||||
-rw-r--r-- | internal/vfs/serving/main_test.go | 2 | ||||
-rw-r--r-- | internal/vfs/serving/serving_test.go | 2 |
9 files changed, 16 insertions, 15 deletions
diff --git a/.gitlab/ci/test.yml b/.gitlab/ci/test.yml index ef0fd0d2..7af9d2ca 100644 --- a/.gitlab/ci/test.yml +++ b/.gitlab/ci/test.yml @@ -43,7 +43,7 @@ cover: code_quality: extends: .tests-common - image: golangci/golangci-lint:v1.46.2 + image: golangci/golangci-lint:v1.52.2 variables: REPORT_FILE: gl-code-quality-report.json LINT_FLAGS: "--color never --deadline 15m" diff --git a/.golangci.yml b/.golangci.yml index 7009afd9..dd8bf738 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -81,7 +81,6 @@ linters: disable-all: true enable: - bodyclose - - deadcode - dogsled - errorlint - gci @@ -95,17 +94,16 @@ linters: - misspell - revive - staticcheck - - structcheck - typecheck - unconvert - unparam - unused - - varcheck - whitespace - - nolintlint fast: false issues: + exclude: + - "unused-parameter:" # Excluding configuration per-path, per-linter, per-text and per-source exclude-rules: - path: _test\.go @@ -116,6 +114,10 @@ issues: - path: internal/fixture/fixtures\.go linters: - gosec + - path: app.go + text: "G112" + linters: + - gosec # Maximum issues count per one linter. Set to 0 to disable. Default is 50. max-issues-per-linter: 0 diff --git a/.tool-versions b/.tool-versions index 8e754ce1..f434cb94 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,2 @@ golang 1.19.9 -golangci-lint 1.46.2 ruby 3.0.5 @@ -40,7 +40,7 @@ import ( "gitlab.com/gitlab-org/gitlab-pages/internal/source" "gitlab.com/gitlab-org/gitlab-pages/internal/source/gitlab" "gitlab.com/gitlab-org/gitlab-pages/internal/tls" - "gitlab.com/gitlab-org/gitlab-pages/internal/uniqueDomain" + "gitlab.com/gitlab-org/gitlab-pages/internal/uniquedomain" "gitlab.com/gitlab-org/gitlab-pages/internal/urilimiter" "gitlab.com/gitlab-org/gitlab-pages/metrics" ) @@ -134,7 +134,7 @@ func setRequestScheme(r *http.Request) *http.Request { func (a *theApp) buildHandlerPipeline() (http.Handler, error) { // Handlers should be applied in a reverse order handler := a.serveFileOrNotFoundHandler() - handler = uniqueDomain.NewMiddleware(handler) + handler = uniquedomain.NewMiddleware(handler) handler = a.Auth.AuthorizationMiddleware(handler) handler = routing.NewMiddleware(handler, a.source) @@ -183,7 +183,7 @@ func (a *theApp) buildHandlerPipeline() (http.Handler, error) { return handler, nil } -//nolint: gocyclo // ignore this +// nolint: gocyclo // ignore this func (a *theApp) Run() error { var limiter *netutil.Limiter if a.config.General.MaxConns > 0 { diff --git a/internal/auth/auth.go b/internal/auth/auth.go index c532d5f6..dcc81eee 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -28,7 +28,7 @@ import ( "gitlab.com/gitlab-org/gitlab-pages/internal/source" ) -//nolint: gosec // auth constants, not credentials +// nolint: gosec // auth constants, not credentials // gosec: G101: Potential hardcoded credentials const ( apiURLUserTemplate = "%s/api/v4/user" @@ -198,7 +198,7 @@ func (a *Auth) domainAllowed(ctx context.Context, name string, domains source.So return (domain != nil && err == nil) } -//nolint: gocyclo // TODO refactor this function https://gitlab.com/gitlab-org/gitlab-pages/-/issues/813 +// nolint: gocyclo // TODO refactor this function https://gitlab.com/gitlab-org/gitlab-pages/-/issues/813 func (a *Auth) handleProxyingAuth(session *hostSession, w http.ResponseWriter, r *http.Request, domains source.Source) bool { // handle auth callback e.g. https://gitlab.io/auth?domain=domain&state=state if shouldProxyAuthToGitlab(r) { diff --git a/internal/serving/disk/symlink/symlink.go b/internal/serving/disk/symlink/symlink.go index 35545a4d..fe26aa63 100644 --- a/internal/serving/disk/symlink/symlink.go +++ b/internal/serving/disk/symlink/symlink.go @@ -14,7 +14,7 @@ import ( "gitlab.com/gitlab-org/gitlab-pages/internal/vfs" ) -//nolint: gocyclo // this is vendored code +// nolint: gocyclo // this is vendored code func walkSymlinks(ctx context.Context, root vfs.Root, path string) (string, error) { volLen := volumeNameLen(path) pathSeparator := string(os.PathSeparator) diff --git a/internal/uniqueDomain/middleware.go b/internal/uniquedomain/middleware.go index b0af761a..0028822d 100644 --- a/internal/uniqueDomain/middleware.go +++ b/internal/uniquedomain/middleware.go @@ -1,4 +1,4 @@ -package uniqueDomain +package uniquedomain import ( "net" diff --git a/internal/vfs/serving/main_test.go b/internal/vfs/serving/main_test.go index 85e7c465..c0c2c29f 100644 --- a/internal/vfs/serving/main_test.go +++ b/internal/vfs/serving/main_test.go @@ -23,7 +23,7 @@ func TestMain(m *testing.M) { os.Exit(v) } -//nolint: gocyclo // this is vendored code +// nolint: gocyclo // this is vendored code func interestingGoroutines() (gs []string) { buf := make([]byte, 2<<20) buf = buf[:runtime.Stack(buf, true)] diff --git a/internal/vfs/serving/serving_test.go b/internal/vfs/serving/serving_test.go index 161fd2e2..f7bfc2e9 100644 --- a/internal/vfs/serving/serving_test.go +++ b/internal/vfs/serving/serving_test.go @@ -22,7 +22,7 @@ var ( lastMod = time.Now() ) -//nolint: gocyclo // this is vendored code +// nolint: gocyclo // this is vendored code func TestServeContent(t *testing.T) { defer afterTest(t) type serveParam struct { |