Migrate go utils v2 - #33
Open
pgyula wants to merge 5 commits into
Open
Conversation
Swap the step's three remaining v1 go-utils usages for their v2 equivalents: retry (identical API, import-path swap only), filedownloader (reshaped as an injected Downloader interface, ctx moves from constructor to Download() call), and pathutil (NormalizedOSTempDirPath becomes an injected PathProvider). PathProvider is threaded through NewIntermediateFileDownloader and NewConcurrentArtifactDownloader alongside the existing Logger/ CommandFactory/EnvRepository injection, rather than calling the v2 package function inline. go-utils v1 moves to `// indirect` in go.mod - go-steputils/v2's own stepenv->export chain and the got download library both still pull it in internally, which is outside this step's control. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
downloadFile's single-threaded fallback (416 / unexpected EOF) only reaches go-utils/v2/filedownloader after downloadWithRetry's real 5x5s backoff, so it isn't covered by exercising downloadFile end-to-end. Test it directly instead, the same way the fallback branch constructs and calls it: success writes the destination file, a non-200 response returns an error and never creates the file. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Previous steps in this CI workflow created uncommitted file changes (e.g. a code formatter, linter, or code generator). This commit captures those changes. https://github.com/bitrise-steplib/bitrise-step-autofix-ci Modified files: - README.md
Previous steps in this CI workflow created uncommitted file changes (e.g. a code formatter, linter, or code generator). This commit captures those changes. https://github.com/bitrise-steplib/bitrise-step-autofix-ci Modified files: - README.md
lpusok
reviewed
Jul 29, 2026
The previous two tests constructed go-utils/v2/filedownloader directly and asserted on it, which tests the dependency rather than the step's fallback branch. They only existed because downloadWithRetry's 5x5s backoff made the fallback unreachable in a reasonable test. Make the backoff injectable instead: downloadWithRetry takes a retry.Sleeper (nil keeps the real time.Sleep in production), so the fallback can be driven end-to-end through downloadFile. The tests now serve a 416 to got's `Range: bytes=0-0` probe -- the real-world 0-byte-file case the fallback exists for -- and assert that the single-threaded download takes over and writes the file, and that a failing fallback surfaces the wrapped error with no file left behind. The same seam removes the real backoff from the two pre-existing retry tests: the downloader package now runs in 5s instead of 55s. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
step.ymlandREADME.mdis updated with the changes (if needed)Version
Requires a MAJOR/MINOR/PATCH version update
Context
Changes
Investigation details
Decisions