Skip to content

Commit

Permalink
Omit unnecessary else statements when if does not flow into the nex…
Browse files Browse the repository at this point in the history
…t statement (thrasher-corp#293)

* Removing unnecessary else

* Fix go fmt issues
  • Loading branch information
leilaes authored and thrasher- committed May 9, 2019
1 parent 8be0682 commit ee28d18
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 219 deletions.
1 change: 1 addition & 0 deletions codelingo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ tenets:
- import: codelingo/effective-go/good-package-name
- import: codelingo/effective-go/single-method-interface-name
- import: codelingo/effective-go/underscores-in-name
- import: codelingo/effective-go/unnecessary-else

# Overwrite one tenet with custom logic
# - import: codelingo/effective-go/comment-first-word-when-empty
Expand Down
23 changes: 11 additions & 12 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1217,20 +1217,19 @@ func GetFilePath(file string) (string, error) {
_, err := os.Stat(oldDirs[x])
if os.IsNotExist(err) {
continue
}
if filepath.Ext(oldDirs[x]) == ".json" {
err = os.Rename(oldDirs[x], newDirs[0])
if err != nil {
return "", err
}
log.Debugf("Renamed old config file %s to %s", oldDirs[x], newDirs[0])
} else {
if filepath.Ext(oldDirs[x]) == ".json" {
err = os.Rename(oldDirs[x], newDirs[0])
if err != nil {
return "", err
}
log.Debugf("Renamed old config file %s to %s", oldDirs[x], newDirs[0])
} else {
err = os.Rename(oldDirs[x], newDirs[1])
if err != nil {
return "", err
}
log.Debugf("Renamed old config file %s to %s", oldDirs[x], newDirs[1])
err = os.Rename(oldDirs[x], newDirs[1])
if err != nil {
return "", err
}
log.Debugf("Renamed old config file %s to %s", oldDirs[x], newDirs[1])
}
}

Expand Down
4 changes: 1 addition & 3 deletions config/config_encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,8 @@ func PromptForConfigKey(initialSetup bool) ([]byte, error) {
if bytes.Equal(p1, p2) {
cryptoKey = p1
break
} else {
log.Printf("Passwords did not match, please try again.")
continue
}
log.Printf("Passwords did not match, please try again.")
}
return cryptoKey, nil
}
Expand Down
11 changes: 5 additions & 6 deletions exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,11 @@ func SetupExchanges() {
if !exch.Enabled {
log.Debugf("%s: Exchange support: Disabled", exch.Name)
continue
} else {
err := LoadExchange(exch.Name, true, &wg)
if err != nil {
log.Errorf("LoadExchange %s failed: %s", exch.Name, err)
continue
}
}
err := LoadExchange(exch.Name, true, &wg)
if err != nil {
log.Errorf("LoadExchange %s failed: %s", exch.Name, err)
continue
}
log.Debugf(
"%s: Exchange support: Enabled (Authenticated API support: %s - Verbose mode: %s).\n",
Expand Down
3 changes: 1 addition & 2 deletions exchanges/bitfinex/bitfinex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,8 @@ func TestGetSymbols(t *testing.T) {
for _, explicitSymbol := range expectedCurrencies {
if common.StringDataCompare(expectedCurrencies, explicitSymbol) {
break
} else {
t.Error("BitfinexGetSymbols currency mismatch with: ", explicitSymbol)
}
t.Error("BitfinexGetSymbols currency mismatch with: ", explicitSymbol)
}
} else {
t.Error("BitfinexGetSymbols currency mismatch, Expected Currencies < Exchange Currencies")
Expand Down
Loading

0 comments on commit ee28d18

Please sign in to comment.