Skip to content

Commit

Permalink
Make linter happy by changing if-else chain to a switch.
Browse files Browse the repository at this point in the history
More background on this can be found in [1]. In short: Go's switch
statement is kinda different to C's (or Java's, f.e.) and can (or
should, as it is idiomatic Go) be used instead of if-else chains.

[1] https://golang.org/doc/effective_go.html#switch
  • Loading branch information
verbit committed Mar 17, 2020
1 parent e264b28 commit 0645122
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/aws-cli-oidc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,18 @@ Options:
log.Fatalf("%v\n", err)
}

if conf.GetCred {
switch {
case conf.GetCred:
err := internal.GetCred(conf.ProviderName, conf.RoleARN)
if err != nil {
log.Fatalf("Error during get-cred: %v\n", err)
}
} else if conf.Setup {
case conf.Setup:
err := internal.RunSetup(conf.ProviderName)
if err != nil {
log.Fatalf("Error during setup: %v\n", err)
}
} else if conf.Cache {
case conf.Cache:
if conf.Show {
output, err := internal.CacheShow()
if err != nil {
Expand Down

0 comments on commit 0645122

Please sign in to comment.