From 91387ca2472aac07440b542b80fb1f070f63a624 Mon Sep 17 00:00:00 2001 From: daniel <15257433+kslamph@users.noreply.github.com> Date: Mon, 30 Mar 2026 20:07:02 +0800 Subject: [PATCH] refactor(gemini-cli): simplify redundant if/else in project ID assignment Both branches assign finalProjectID = responseProjectID, so move the assignment outside the conditional and keep only the logging inside. --- internal/api/handlers/management/auth_files.go | 4 +--- internal/cmd/login.go | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/internal/api/handlers/management/auth_files.go b/internal/api/handlers/management/auth_files.go index a7916e79..63b1d62d 100644 --- a/internal/api/handlers/management/auth_files.go +++ b/internal/api/handlers/management/auth_files.go @@ -2568,10 +2568,8 @@ func performGeminiCLISetup(ctx context.Context, httpClient *http.Client, storage if explicitProject && !strings.EqualFold(responseProjectID, projectID) { log.Infof("Gemini onboarding: requested project %s maps to backend project %s", projectID, responseProjectID) log.Infof("Using backend project ID: %s", responseProjectID) - finalProjectID = responseProjectID - } else { - finalProjectID = responseProjectID } + finalProjectID = responseProjectID } storage.ProjectID = strings.TrimSpace(finalProjectID) diff --git a/internal/cmd/login.go b/internal/cmd/login.go index 298e9546..22404dac 100644 --- a/internal/cmd/login.go +++ b/internal/cmd/login.go @@ -335,10 +335,8 @@ func performGeminiCLISetup(ctx context.Context, httpClient *http.Client, storage if explicitProject && !strings.EqualFold(responseProjectID, projectID) { log.Infof("Gemini onboarding: requested project %s maps to backend project %s", projectID, responseProjectID) log.Infof("Using backend project ID: %s", responseProjectID) - finalProjectID = responseProjectID - } else { - finalProjectID = responseProjectID } + finalProjectID = responseProjectID } storage.ProjectID = strings.TrimSpace(finalProjectID)