Skip to content

Commit 4d88f2c

Browse files
committed
Cache profileEnvVar() result to avoid duplicate deprecation warning
1 parent 2e4f054 commit 4d88f2c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

internal/commands/root.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,16 +678,17 @@ func resolveProfile() error {
678678
return nil
679679
}
680680

681+
envProfile := profileEnvVar()
681682
resolved, err := profile.Resolve(profile.ResolveOptions{
682683
FlagValue: cfgProfile,
683-
EnvVar: profileEnvVar(),
684+
EnvVar: envProfile,
684685
DefaultProfile: defaultName,
685686
Profiles: allProfiles,
686687
})
687688
if err != nil {
688689
// If the user explicitly specified a profile (flag or env), that's a
689690
// hard error — don't silently fall back to a different account.
690-
if cfgProfile != "" || profileEnvVar() != "" {
691+
if cfgProfile != "" || envProfile != "" {
691692
return err
692693
}
693694
// Otherwise (ambiguous default, etc.) — not fatal, just skip profile

0 commit comments

Comments
 (0)