Skip to content

Commit fbf2704

Browse files
authored
Refactor update_command.go: Split 1,331-line file into 8 focused modules (#6897)
1 parent 0e47188 commit fbf2704

9 files changed

Lines changed: 1272 additions & 1209 deletions

pkg/cli/download_workflow.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616
var downloadLog = logger.New("cli:download_workflow")
1717

1818
// resolveLatestReleaseViaGit finds the latest release using git ls-remote
19+
//
20+
//nolint:unused // Fallback implementation for when GitHub API is unavailable
1921
func resolveLatestReleaseViaGit(repo, currentRef string, allowMajor, verbose bool) (string, error) {
2022
if verbose {
2123
fmt.Fprintln(os.Stderr, console.FormatVerboseMessage(fmt.Sprintf("Fetching latest release for %s via git ls-remote (current: %s, allow major: %v)", repo, currentRef, allowMajor)))
@@ -95,6 +97,8 @@ func resolveLatestReleaseViaGit(repo, currentRef string, allowMajor, verbose boo
9597
}
9698

9799
// isBranchRefViaGit checks if a ref is a branch using git ls-remote
100+
//
101+
//nolint:unused // Fallback implementation for when GitHub API is unavailable
98102
func isBranchRefViaGit(repo, ref string) (bool, error) {
99103
downloadLog.Printf("Attempting git ls-remote to check if ref is branch: %s@%s", repo, ref)
100104

@@ -125,6 +129,8 @@ func isBranchRefViaGit(repo, ref string) (bool, error) {
125129
}
126130

127131
// isBranchRef checks if a ref is a branch in the repository
132+
//
133+
//nolint:unused // Reserved for future use
128134
func isBranchRef(repo, ref string) (bool, error) {
129135
// Use gh CLI to list branches
130136
cmd := workflow.ExecGH("api", fmt.Sprintf("/repos/%s/branches", repo), "--jq", ".[].name")
@@ -155,6 +161,8 @@ func isBranchRef(repo, ref string) (bool, error) {
155161
}
156162

157163
// resolveBranchHeadViaGit gets the latest commit SHA for a branch using git ls-remote
164+
//
165+
//nolint:unused // Fallback implementation for when GitHub API is unavailable
158166
func resolveBranchHeadViaGit(repo, branch string, verbose bool) (string, error) {
159167
if verbose {
160168
fmt.Fprintln(os.Stderr, console.FormatVerboseMessage(fmt.Sprintf("Fetching latest commit for branch %s in %s via git ls-remote", branch, repo)))
@@ -189,6 +197,8 @@ func resolveBranchHeadViaGit(repo, branch string, verbose bool) (string, error)
189197
}
190198

191199
// resolveBranchHead gets the latest commit SHA for a branch
200+
//
201+
//nolint:unused // Reserved for future use
192202
func resolveBranchHead(repo, branch string, verbose bool) (string, error) {
193203
if verbose {
194204
fmt.Fprintln(os.Stderr, console.FormatVerboseMessage(fmt.Sprintf("Fetching latest commit for branch %s in %s", branch, repo)))
@@ -221,6 +231,8 @@ func resolveBranchHead(repo, branch string, verbose bool) (string, error) {
221231
}
222232

223233
// resolveDefaultBranchHeadViaGit gets the latest commit SHA for the default branch using git ls-remote
234+
//
235+
//nolint:unused // Fallback implementation for when GitHub API is unavailable
224236
func resolveDefaultBranchHeadViaGit(repo string, verbose bool) (string, error) {
225237
if verbose {
226238
fmt.Fprintln(os.Stderr, console.FormatVerboseMessage(fmt.Sprintf("Fetching default branch for %s via git ls-remote", repo)))
@@ -275,6 +287,8 @@ func resolveDefaultBranchHeadViaGit(repo string, verbose bool) (string, error) {
275287
}
276288

277289
// resolveDefaultBranchHead gets the latest commit SHA for the default branch
290+
//
291+
//nolint:unused // Reserved for future use
278292
func resolveDefaultBranchHead(repo string, verbose bool) (string, error) {
279293
if verbose {
280294
fmt.Fprintln(os.Stderr, console.FormatVerboseMessage(fmt.Sprintf("Fetching default branch for %s", repo)))

0 commit comments

Comments
 (0)