refactor(cli): Update terminal package import and usage in admin CLI

- Replace deprecated `golang.org/x/crypto/ssh/terminal` with `golang.org/x/term`
- Update `terminal.ReadPassword()` calls to use `term.ReadPassword()`
- Remove unnecessary version of `golang.org/x/sys` in go.sum
- Ensure compatibility with latest terminal package recommendations
This commit is contained in:
ats-tech25 2025-11-06 09:15:59 +00:00
parent df39550eb1
commit 34ee29c26e
2 changed files with 3 additions and 5 deletions

2
go.sum
View File

@ -107,8 +107,6 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=

View File

@ -14,7 +14,7 @@ import (
"github.com/joho/godotenv"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
)
var adminCmd = &cobra.Command{
@ -122,7 +122,7 @@ func getAdminDetailsInteractively() error {
// Get password securely
if adminPassword == "" {
fmt.Print("Enter admin password: ")
passwordBytes, err := terminal.ReadPassword(int(syscall.Stdin))
passwordBytes, err := term.ReadPassword(int(syscall.Stdin))
if err != nil {
return fmt.Errorf("failed to read password: %w", err)
}
@ -131,7 +131,7 @@ func getAdminDetailsInteractively() error {
// Confirm password
fmt.Print("Confirm admin password: ")
confirmPasswordBytes, err := terminal.ReadPassword(int(syscall.Stdin))
confirmPasswordBytes, err := term.ReadPassword(int(syscall.Stdin))
if err != nil {
return fmt.Errorf("failed to read password confirmation: %w", err)
}