diff --git a/.golangci.yml b/.golangci.yml index 79f28ecc0c..ca1dfcbf9f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -109,7 +109,6 @@ linters: - { disabled: true, name: max-public-structs } - { disabled: true, name: nested-structs } - { disabled: true, name: package-comments } - - { disabled: true, name: redefines-builtin-id } - { disabled: true, name: unchecked-type-assertion } - { disabled: true, name: unexported-naming } - { disabled: true, name: unexported-return } @@ -136,3 +135,7 @@ linters: run: go: 1.24.7 + +issues: + max-issues-per-linter: 50 + max-same-issues: 50 diff --git a/packages/docker-reverse-proxy/internal/utils/string.go b/packages/docker-reverse-proxy/internal/utils/string.go index 1e317b65a6..f111b3f3d4 100644 --- a/packages/docker-reverse-proxy/internal/utils/string.go +++ b/packages/docker-reverse-proxy/internal/utils/string.go @@ -1,8 +1,8 @@ package utils -func SubstringMax(s string, max int) string { - if len(s) <= max { +func SubstringMax(s string, maxLen int) string { + if len(s) <= maxLen { return s } - return s[:max] + "..." + return s[:maxLen] + "..." } diff --git a/packages/orchestrator/internal/sandbox/build/build.go b/packages/orchestrator/internal/sandbox/build/build.go index 4f5f005125..7719df69e3 100644 --- a/packages/orchestrator/internal/sandbox/build/build.go +++ b/packages/orchestrator/internal/sandbox/build/build.go @@ -37,14 +37,6 @@ func NewFile( } } -func min(a, b int64) int64 { - if a < b { - return a - } - - return b -} - func (b *File) ReadAt(ctx context.Context, p []byte, off int64) (n int, err error) { for n < len(p) { mappedOffset, mappedLength, buildID, err := b.header.GetShiftedMapping(off + int64(n)) diff --git a/packages/orchestrator/internal/sandbox/uffd/userfaultfd/constants.go b/packages/orchestrator/internal/sandbox/uffd/userfaultfd/constants.go index 4eec520bcd..63a3b3e71e 100644 --- a/packages/orchestrator/internal/sandbox/uffd/userfaultfd/constants.go +++ b/packages/orchestrator/internal/sandbox/uffd/userfaultfd/constants.go @@ -76,13 +76,13 @@ func NewUffdioRegister(start, length, mode CULong) UffdioRegister { } } -func NewUffdioCopy(b []byte, address CULong, pagesize CULong, mode CULong, copy CLong) UffdioCopy { +func NewUffdioCopy(b []byte, address CULong, pagesize CULong, mode CULong, bytesCopied CLong) UffdioCopy { return UffdioCopy{ src: CULong(uintptr(unsafe.Pointer(&b[0]))), dst: address &^ (pagesize - 1), len: pagesize, mode: mode, - copy: copy, + copy: bytesCopied, } } diff --git a/packages/shared/pkg/storage/gcp_multipart.go b/packages/shared/pkg/storage/gcp_multipart.go index e71fad3147..5a70caa063 100644 --- a/packages/shared/pkg/storage/gcp_multipart.go +++ b/packages/shared/pkg/storage/gcp_multipart.go @@ -52,13 +52,13 @@ func createRetryableClient(config RetryConfig) *retryablehttp.Client { client.RetryWaitMax = config.MaxBackoff // Custom backoff function with full jitter to avoid thundering herd - client.Backoff = func(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration { + client.Backoff = func(start, maxBackoff time.Duration, attemptNum int, resp *http.Response) time.Duration { // Calculate exponential backoff - backoff := min + backoff := start for range attemptNum { backoff = time.Duration(float64(backoff) * config.BackoffMultiplier) - if backoff > max { - backoff = max + if backoff > maxBackoff { + backoff = maxBackoff break } } diff --git a/packages/shared/pkg/storage/gcp_multipart_test.go b/packages/shared/pkg/storage/gcp_multipart_test.go index 12c8554bdc..5472e2cd76 100644 --- a/packages/shared/pkg/storage/gcp_multipart_test.go +++ b/packages/shared/pkg/storage/gcp_multipart_test.go @@ -285,8 +285,8 @@ func TestMultipartUploader_HighConcurrency_StressTest(t *testing.T) { // Update max concurrent parts for { - max := atomic.LoadInt32(&maxConcurrentParts) - if current <= max || atomic.CompareAndSwapInt32(&maxConcurrentParts, max, current) { + maxConcurrent := atomic.LoadInt32(&maxConcurrentParts) + if current <= maxConcurrent || atomic.CompareAndSwapInt32(&maxConcurrentParts, maxConcurrent, current) { break } } @@ -564,8 +564,8 @@ func TestMultipartUploader_ResourceExhaustion_TooManyConcurrentUploads(t *testin // Track max observed concurrency for { - max := atomic.LoadInt32(&maxObservedConcurrency) - if current <= max || atomic.CompareAndSwapInt32(&maxObservedConcurrency, max, current) { + maxObserved := atomic.LoadInt32(&maxObservedConcurrency) + if current <= maxObserved || atomic.CompareAndSwapInt32(&maxObservedConcurrency, maxObserved, current) { break } } diff --git a/packages/shared/pkg/storage/storage_cache.go b/packages/shared/pkg/storage/storage_cache.go index e4d859ccbb..3c57c8b6da 100644 --- a/packages/shared/pkg/storage/storage_cache.go +++ b/packages/shared/pkg/storage/storage_cache.go @@ -399,8 +399,8 @@ func (c *CachedFileObjectProvider) readAndCacheFullRemoteFile(ctx context.Contex return int64(written), err } -func cleanup(msg string, close func() error) { - if err := close(); err != nil { +func cleanup(msg string, fn func() error) { + if err := fn(); err != nil { zap.L().Warn(msg, zap.Error(err)) } }