resolveURL: maxRedirects guard inconsistent with apiclient/redirect.go #34

Open
opened 2026-05-04 17:08:03 +02:00 by heiko · 0 comments
Owner

Problem

resolveURL in internal/builder/clone.go uses len(via) >= 10 to cap redirects, while apiclient/redirect.go uses len(via) > maxRedirects (where maxRedirects = 10). The two are semantically equivalent but inconsistent, and resolveURL does not reuse the maxRedirects constant.

Suggested fix

Either export maxRedirects from apiclient and reference it here, or define a shared constant. At minimum, align the comparison operator so the intent is clear.


Identified by AI code review (Claude Sonnet 4.6)

## Problem `resolveURL` in `internal/builder/clone.go` uses `len(via) >= 10` to cap redirects, while `apiclient/redirect.go` uses `len(via) > maxRedirects` (where `maxRedirects = 10`). The two are semantically equivalent but inconsistent, and `resolveURL` does not reuse the `maxRedirects` constant. ## Suggested fix Either export `maxRedirects` from `apiclient` and reference it here, or define a shared constant. At minimum, align the comparison operator so the intent is clear. --- *Identified by AI code review (Claude Sonnet 4.6)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
heiko/gogogo#34
No description provided.