Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKassio Borges <kassioborgesm@gmail.com>2023-04-11 16:10:50 +0300
committerKassio Borges <kassioborgesm@gmail.com>2023-04-12 14:02:13 +0300
commit4818095bc357ec6415e939a321af507b2c42daad (patch)
tree7c47f3a19a8bf701b9926bf901ea5c4394a382be
parent29ac8e1a6ad17403f74c438c36e1637ac555ae20 (diff)
Update golangci-lint tool
-rw-r--r--Makefile.util.mk2
-rw-r--r--app.go2
-rw-r--r--internal/auth/auth.go4
-rw-r--r--internal/handlers/handlers.go2
-rw-r--r--internal/redirects/matching.go6
-rw-r--r--internal/redirects/validations_test.go2
-rw-r--r--internal/serving/disk/symlink/symlink.go4
-rw-r--r--internal/source/gitlab/cache/cache.go72
-rw-r--r--internal/vfs/errors.go2
-rw-r--r--internal/vfs/serving/main_test.go2
-rw-r--r--internal/vfs/serving/serving_test.go2
11 files changed, 51 insertions, 49 deletions
diff --git a/Makefile.util.mk b/Makefile.util.mk
index d87eb2fb..b0a282cf 100644
--- a/Makefile.util.mk
+++ b/Makefile.util.mk
@@ -3,7 +3,7 @@
OUT_FORMAT ?= colored-line-number
LINT_FLAGS ?= $(if $V,-v)
REPORT_FILE ?=
-GOLANGCI_VERSION=v1.46.2
+GOLANGCI_VERSION=v1.52.2
GOTESTSUM_VERSION=v1.10.0
COVERAGE_PACKAGES=$(shell (go list ./... | grep -v -e "test/acceptance" | tr "\n", "," | sed 's/\(.*\),/\1 /'))
diff --git a/app.go b/app.go
index 96aa084b..aa63fc7f 100644
--- a/app.go
+++ b/app.go
@@ -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 dcc81eee..c532d5f6 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/handlers/handlers.go b/internal/handlers/handlers.go
index 80c771d5..5b15fba1 100644
--- a/internal/handlers/handlers.go
+++ b/internal/handlers/handlers.go
@@ -62,7 +62,7 @@ func (a *Handlers) HandleArtifactRequest(w http.ResponseWriter, r *http.Request)
return true
}
- // nolint: bodyclose // false positive
+ //nolint: bodyclose // false positive
// a.checkIfLoginRequiredOrInvalidToken returns a response.Body, closing this body is responsibility
// of the TryMakeRequest implementation
return a.Artifact.TryMakeRequest(w, r, token, a.checkIfLoginRequiredOrInvalidToken(w, r, token))
diff --git a/internal/redirects/matching.go b/internal/redirects/matching.go
index 25e2ce2e..d52863ee 100644
--- a/internal/redirects/matching.go
+++ b/internal/redirects/matching.go
@@ -20,12 +20,12 @@ var (
//
// For example, given a "from" URL like this:
//
-// /a/*/url/with/:placeholders
+// /a/*/url/with/:placeholders
//
// this function would match URLs like this:
//
-// /a/nice/url/with/text
-// /a/super/extra/nice/url/with/matches
+// /a/nice/url/with/text
+// /a/super/extra/nice/url/with/matches
//
// If the first return value is `true`, the second return value is the path that this
// rule should redirect/rewrite to. This path is effectively the rule's "to" path that
diff --git a/internal/redirects/validations_test.go b/internal/redirects/validations_test.go
index 5f3a24ec..8cb11e11 100644
--- a/internal/redirects/validations_test.go
+++ b/internal/redirects/validations_test.go
@@ -117,7 +117,7 @@ func TestRedirectsValidateRule(t *testing.T) {
expectedErr: errNoStartingForwardSlashInURLPath,
},
"no_parameters": {
- rule: "/ /something 302 foo=bar",
+ rule: "/ /something 302 foo=bar",
expectedErr: errNoParams,
},
"invalid_status": {
diff --git a/internal/serving/disk/symlink/symlink.go b/internal/serving/disk/symlink/symlink.go
index c9ad0191..35545a4d 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)
@@ -25,7 +25,7 @@ func walkSymlinks(ctx context.Context, root vfs.Root, path string) (string, erro
vol := path[:volLen]
dest := vol
linksWalked := 0
- // nolint: ineffassign // this is vendored code
+ //nolint: ineffassign // this is vendored code
for start, end := volLen, volLen; start < len(path); start = end {
for start < len(path) && os.IsPathSeparator(path[start]) {
start++
diff --git a/internal/source/gitlab/cache/cache.go b/internal/source/gitlab/cache/cache.go
index 7dddb176..f91c9aa2 100644
--- a/internal/source/gitlab/cache/cache.go
+++ b/internal/source/gitlab/cache/cache.go
@@ -28,17 +28,17 @@ func NewCache(client api.Client, cc *config.Cache) *Cache {
// Resolve is going to return a lookup based on a domain name. The caching
// algorithm works as follows:
-// - We first check if the cache entry exists, and if it is up-to-date. If it
-// is fresh we return the lookup entry from cache and it is a cache hit.
-// - If entry is not up-to-date, that means it has been created in a cache
-// more than `entryRefreshTimeout` duration ago, we schedule an asynchronous
-// retrieval of the latest configuration we are going to obtain through the
-// API, and we immediately return an old value, to avoid blocking clients. In
-// this case it is also a cache hit.
-// - If cache entry has not been populated with a lookup information yet, we
-// block all the clients and make them wait until we retrieve the lookup from
-// the GitLab API. Clients should not wait for longer than
-// `retrievalTimeout`. It is a cache miss.
+// - We first check if the cache entry exists, and if it is up-to-date. If it
+// is fresh we return the lookup entry from cache and it is a cache hit.
+// - If entry is not up-to-date, that means it has been created in a cache
+// more than `entryRefreshTimeout` duration ago, we schedule an asynchronous
+// retrieval of the latest configuration we are going to obtain through the
+// API, and we immediately return an old value, to avoid blocking clients. In
+// this case it is also a cache hit.
+// - If cache entry has not been populated with a lookup information yet, we
+// block all the clients and make them wait until we retrieve the lookup from
+// the GitLab API. Clients should not wait for longer than
+// `retrievalTimeout`. It is a cache miss.
//
// We are going to retrieve a lookup from GitLab API using a retriever type. In
// case of failures (when GitLab API client returns an error) we will retry the
@@ -49,32 +49,34 @@ func NewCache(client api.Client, cc *config.Cache) *Cache {
//
// Examples:
// 1. Everything works
-// - a client opens pages
-// - we create a new cache entry
-// - cache entry needs a warm up
-// - a client waits until we retrieve a lookup
-// - we successfully retrieve a lookup
-// - we cache this response
-// - and we pass it upstream to all clients
+// - a client opens pages
+// - we create a new cache entry
+// - cache entry needs a warm up
+// - a client waits until we retrieve a lookup
+// - we successfully retrieve a lookup
+// - we cache this response
+// - and we pass it upstream to all clients
+//
// 2. A domain does not exist
-// - a client opens pages
-// - we create a new cache entry
-// - cache entry needs a warm up
-// - a client waits until we retrieve a lookup
-// - GitLab responded with a lookup and 204 HTTP status
-// - we cache this response with domain being `nil`
-// - we pass this lookup upstream to all the clients
+// - a client opens pages
+// - we create a new cache entry
+// - cache entry needs a warm up
+// - a client waits until we retrieve a lookup
+// - GitLab responded with a lookup and 204 HTTP status
+// - we cache this response with domain being `nil`
+// - we pass this lookup upstream to all the clients
+//
// 3. GitLab is not responding
-// - a client opens pages
-// - we create a new cache entry
-// - cache entry needs a warm up
-// - a client waits until we retrieve a lookup
-// - GitLab does not respond or responds with an error
-// - we retry this retrieval every `maxRetrievalInterval`
-// - we retry this retrieval `maxRetrievalRetries` in total
-// - we create a lookup that contains information about an error
-// - we cache this response
-// - we pass this lookup upstream to all the clients
+// - a client opens pages
+// - we create a new cache entry
+// - cache entry needs a warm up
+// - a client waits until we retrieve a lookup
+// - GitLab does not respond or responds with an error
+// - we retry this retrieval every `maxRetrievalInterval`
+// - we retry this retrieval `maxRetrievalRetries` in total
+// - we create a lookup that contains information about an error
+// - we cache this response
+// - we pass this lookup upstream to all the clients
func (c *Cache) Resolve(ctx context.Context, domain string) *api.Lookup {
entry := c.store.LoadOrCreate(domain)
diff --git a/internal/vfs/errors.go b/internal/vfs/errors.go
index 6fa2f29b..31ad895d 100644
--- a/internal/vfs/errors.go
+++ b/internal/vfs/errors.go
@@ -27,7 +27,7 @@ func (r *ReadError) Unwrap() error {
}
func (r *ReadError) Is(target error) bool {
- // nolint: errorlint // implementing type equality for errors.Is
+ //nolint: errorlint // implementing type equality for errors.Is
_, ok := target.(*ReadError)
return ok
}
diff --git a/internal/vfs/serving/main_test.go b/internal/vfs/serving/main_test.go
index c0c2c29f..85e7c465 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 f7bfc2e9..161fd2e2 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 {