From 8a249d2910f97bcffb12c7de334968e2782a41d6 Mon Sep 17 00:00:00 2001 From: Mike Mondragon Date: Fri, 12 Jul 2024 09:18:01 -0700 Subject: [PATCH] Formatting code: `gofumpt -w -extra .` --- cmd/root/profileslist/profiles-list.go | 2 +- cmd/root/root.go | 3 ++- internal/config/config.go | 2 +- internal/output/aws_credentials_file.go | 10 +++++----- internal/paginator/paginator.go | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cmd/root/profileslist/profiles-list.go b/cmd/root/profileslist/profiles-list.go index 8328b59..8194f22 100644 --- a/cmd/root/profileslist/profiles-list.go +++ b/cmd/root/profileslist/profiles-list.go @@ -18,6 +18,7 @@ package profileslist import ( "fmt" + "github.com/spf13/cobra" "github.com/okta/okta-aws-cli/internal/config" @@ -37,7 +38,6 @@ func NewProfilesListCommand() *cobra.Command { fmt.Println("Profiles:") keys, err := config.ReadConfigProfileKeys() - if err != nil { return err } diff --git a/cmd/root/root.go b/cmd/root/root.go index 4d8eaf5..3936d57 100644 --- a/cmd/root/root.go +++ b/cmd/root/root.go @@ -18,10 +18,11 @@ package root import ( "fmt" - "github.com/okta/okta-aws-cli/cmd/root/profileslist" "os" "path/filepath" + "github.com/okta/okta-aws-cli/cmd/root/profileslist" + "github.com/spf13/cobra" debugCmd "github.com/okta/okta-aws-cli/cmd/root/debug" diff --git a/internal/config/config.go b/internal/config/config.go index 1c8f608..2b6a447 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -370,7 +370,7 @@ func NewConfig(attrs *Attributes) (*Config, error) { return cfg, nil } -func getFlagNameFromProfile(awsProfile string, flag string) string { +func getFlagNameFromProfile(awsProfile, flag string) string { profileKey := fmt.Sprintf("%s.%s", awsProfile, flag) if awsProfile != "" && viper.IsSet(profileKey) && viper.Get(profileKey) != "" { // NOTE: If the flag was from a multiple profiles keyed by aws profile diff --git a/internal/output/aws_credentials_file.go b/internal/output/aws_credentials_file.go index 69c08e8..7363574 100644 --- a/internal/output/aws_credentials_file.go +++ b/internal/output/aws_credentials_file.go @@ -41,7 +41,7 @@ const ( ) // ensureConfigExists verify that the config file exists -func ensureConfigExists(filename string, profile string) error { +func ensureConfigExists(filename, profile string) error { if _, err := os.Stat(filename); err != nil { if errors.Is(err, os.ErrNotExist) { dir := filepath.Dir(filename) @@ -65,7 +65,7 @@ func ensureConfigExists(filename string, profile string) error { return nil } -func saveProfile(filename, profile string, cfc *oaws.CredsFileCredential, legacyVars, expiryVars bool, expiry string, regionVar string) error { +func saveProfile(filename, profile string, cfc *oaws.CredsFileCredential, legacyVars, expiryVars bool, expiry, regionVar string) error { config, err := updateConfig(filename, profile, cfc, legacyVars, expiryVars, expiry, regionVar) if err != nil { return err @@ -80,7 +80,7 @@ func saveProfile(filename, profile string, cfc *oaws.CredsFileCredential, legacy return nil } -func updateConfig(filename, profile string, cfc *oaws.CredsFileCredential, legacyVars, expiryVars bool, expiry string, region string) (config *ini.File, err error) { +func updateConfig(filename, profile string, cfc *oaws.CredsFileCredential, legacyVars, expiryVars bool, expiry, region string) (config *ini.File, err error) { config, err = ini.Load(filename) if err != nil { return @@ -131,7 +131,7 @@ func updateConfig(filename, profile string, cfc *oaws.CredsFileCredential, legac // updateIni will comment out any keys that are not "aws_access_key_id", // "aws_secret_access_key", "aws_session_token", "credential_process" -func updateINI(config *ini.File, profile string, legacyVars bool, expiryVars bool, region string) (*ini.File, error) { +func updateINI(config *ini.File, profile string, legacyVars, expiryVars bool, region string) (*ini.File, error) { ignore := []string{ "aws_access_key_id", "aws_secret_access_key", @@ -184,7 +184,7 @@ type AWSCredentialsFile struct { } // NewAWSCredentialsFile Creates a new -func NewAWSCredentialsFile(legacyVars bool, expiryVars bool, expiry string) *AWSCredentialsFile { +func NewAWSCredentialsFile(legacyVars, expiryVars bool, expiry string) *AWSCredentialsFile { return &AWSCredentialsFile{ LegacyAWSVariables: legacyVars, ExpiryAWSVariables: expiryVars, diff --git a/internal/paginator/paginator.go b/internal/paginator/paginator.go index c80d858..3b156fc 100644 --- a/internal/paginator/paginator.go +++ b/internal/paginator/paginator.go @@ -59,7 +59,7 @@ type Paginator struct { } // NewPaginator Paginator constructor -func NewPaginator(httpClient *http.Client, url *url.URL, headers *map[string]string, params *map[string]string) *Paginator { +func NewPaginator(httpClient *http.Client, url *url.URL, headers, params *map[string]string) *Paginator { pgntr := Paginator{ httpClient: httpClient, url: url,