Skip to content

allow adding ssh key directly to instance#40

Closed
brianmodel wants to merge 319 commits intomainfrom
brian/add-ssh-key
Closed

allow adding ssh key directly to instance#40
brianmodel wants to merge 319 commits intomainfrom
brian/add-ssh-key

Conversation

@brianmodel
Copy link
Contributor

No description provided.

dependabot bot and others added 27 commits January 19, 2026 00:48
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.46.0 to 0.47.0.
- [Commits](golang/crypto@v0.46.0...v0.47.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.47.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
…ang.org/x/crypto-0.47.0

chore(deps): bump golang.org/x/crypto from 0.46.0 to 0.47.0
…ang.org/x/sys-0.40.0

chore(deps): bump golang.org/x/sys from 0.39.0 to 0.40.0
Resolved conflicts:
- api/types.go: Kept HttpPorts from main and ProvisioningTime from feature branch
- tui/status.go: Kept UUID column width, updated Status width to 14

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
}
return err
}
instanceID = selectedInstance.ID

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

This definition of instanceID is never used.

Copilot Autofix

AI 11 days ago

In general, to fix a useless assignment, either remove the assignment if the variable’s value is not needed, or, if the value should be used, update the code to actually read it instead of another source. Here, in the interactive path (len(args) == 0), the logic already works entirely through selectedInstance and the interactive TUI flow, and there is no read of instanceID after we set it to selectedInstance.ID. The non-interactive path still assigns instanceID = args[0] and uses it in error messages; that behavior should remain unchanged.

The best minimal fix without changing functionality is to remove the line instanceID = selectedInstance.ID at line 99. This eliminates the useless assignment and potential confusion, while preserving the rest of the logic: for the interactive path, we rely solely on selectedInstance returned from tui.RunAddKeyInteractive; for the non-interactive path, we keep using instanceID derived from args[0]. No new imports, functions, or definitions are required.

Concretely: in cmd/add_key.go, within the if len(args) == 0 { ... } block, delete the line that sets instanceID = selectedInstance.ID. Leave the rest of the branches as they are.

Suggested changeset 1
cmd/add_key.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/cmd/add_key.go b/cmd/add_key.go
--- a/cmd/add_key.go
+++ b/cmd/add_key.go
@@ -96,7 +96,6 @@
 			}
 			return err
 		}
-		instanceID = selectedInstance.ID
 	} else {
 		instanceID = args[0]
 
EOF
@@ -96,7 +96,6 @@
}
return err
}
instanceID = selectedInstance.ID
} else {
instanceID = args[0]

Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants