From e41de5680e119e3e840491db383c5b2fccb7d24a Mon Sep 17 00:00:00 2001 From: Joe Lombrozo Date: Sun, 21 Sep 2025 20:41:32 -0700 Subject: [PATCH] enable the revive 'redefines-builtin-id' rule --- .golangci.yml | 5 ++++- packages/api/internal/handlers/template_request_build.go | 4 ++-- packages/docker-reverse-proxy/internal/utils/string.go | 6 +++--- packages/orchestrator/internal/sandbox/build/build.go | 8 -------- packages/shared/pkg/storage/gcp_multipart.go | 8 ++++---- packages/shared/pkg/storage/gcp_multipart_test.go | 8 ++++---- 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 96dd683d6a..a18e30b6b1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -107,7 +107,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 } @@ -133,3 +132,7 @@ linters: run: go: 1.24.7 + +issues: + max-issues-per-linter: 50 + max-same-issues: 50 diff --git a/packages/api/internal/handlers/template_request_build.go b/packages/api/internal/handlers/template_request_build.go index a5dacca538..9a9ca607b5 100644 --- a/packages/api/internal/handlers/template_request_build.go +++ b/packages/api/internal/handlers/template_request_build.go @@ -426,7 +426,7 @@ func findTeamAndTier(teams []queries.GetTeamsWithUsersTeamsWithTierRow, teamID * return nil, nil, fmt.Errorf("default team not found") } -func (a *APIStore) TemplateRequestBuild(c *gin.Context, templateID api.TemplateID, new bool) *api.Template { +func (a *APIStore) TemplateRequestBuild(c *gin.Context, templateID api.TemplateID, isNew bool) *api.Template { ctx := c.Request.Context() body, err := utils.ParseBody[api.TemplateBuildRequest](ctx, c) @@ -474,7 +474,7 @@ func (a *APIStore) TemplateRequestBuild(c *gin.Context, templateID api.TemplateI ClusterID: utils.WithClusterFallback(team.ClusterID), BuilderNodeID: builderNodeID, TemplateID: templateID, - IsNew: new, + IsNew: isNew, UserID: userID, Team: team, Tier: tier, 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 8605260d34..6b2a4dcd5f 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/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 } }