11package update
22
33import (
4+ "bytes"
45 "context"
56 "encoding/json"
67 "fmt"
@@ -20,13 +21,13 @@ import (
2021 "github.com/stackitcloud/stackit-sdk-go/services/alb"
2122)
2223
23- const passwordEnv = "ALB_CREDENTIALS_PASSWORD"
24+ const passwordEnv = "ALB_CREDENTIALS_PASSWORD" //nolint:gosec // false alert, this are not valid credentials
2425
2526const (
2627 usernameFlag = "username"
2728 displaynameFlag = "displayname"
2829 passwordFlag = "password"
29- credentialRefArg = "CREDENTIAL_REF_ARG"
30+ credentialRefArg = "CREDENTIAL_REF_ARG" //nolint:gosec // false alert, this are not valid credentials
3031)
3132
3233type inputModel struct {
@@ -99,7 +100,6 @@ func configureFlags(cmd *cobra.Command) {
99100 cmd .Flags ().StringP (usernameFlag , "u" , "" , "the username for the credentials" )
100101 cmd .Flags ().StringP (displaynameFlag , "d" , "" , "the displayname for the credentials" )
101102 cmd .Flags ().BoolP (passwordFlag , "w" , false , "change the password for the credentials" )
102-
103103}
104104
105105func buildRequest (ctx context.Context , model * inputModel , apiClient * alb.APIClient , readPassword func () (string , error )) (req alb.ApiUpdateCredentialsRequest , err error ) {
@@ -138,14 +138,13 @@ func readPassword() (string, error) {
138138 return "" , fmt .Errorf ("cannot read password: %w" , err )
139139 }
140140 fmt .Println ()
141- if string (password ) != string ( confirmation ) {
141+ if bytes . Equal (password , confirmation ) {
142142 return "" , fmt .Errorf ("the password and the confirmation do not match" )
143143 }
144144
145145 return string (password ), nil
146146}
147147func parseInput (p * print.Printer , cmd * cobra.Command , inputArgs []string ) inputModel {
148-
149148 model := inputModel {
150149 GlobalFlagModel : globalflags .Parse (p , cmd ),
151150 Username : flags .FlagToStringPointer (p , cmd , usernameFlag ),
0 commit comments