mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Some code improvements
* Some assignments simplified by using assignment operators * Rewrite switch statement with only one case as if. * Rewrite if-else chain as a switch statement. * go fmt `modules/todoist/project.go` file.
This commit is contained in:
@@ -60,7 +60,7 @@ func (widget *Widget) contentFrom(positions *AllPositionsResponse) string {
|
||||
totalFiat += positions.PositionList[i].HoldingValueFiat
|
||||
|
||||
if widget.settings.displayHoldings {
|
||||
res = res + fmt.Sprintf(
|
||||
res += fmt.Sprintf(
|
||||
"[%s]%-6s - %5.2f ([%s]%.3fk [%s]%.2f%s)\n",
|
||||
widget.settings.colors.name,
|
||||
positions.PositionList[i].Coin,
|
||||
@@ -72,7 +72,7 @@ func (widget *Widget) contentFrom(positions *AllPositionsResponse) string {
|
||||
"%",
|
||||
)
|
||||
} else {
|
||||
res = res + fmt.Sprintf(
|
||||
res += fmt.Sprintf(
|
||||
"[%s]%-6s - %5.2f ([%s]%.2f%s)\n",
|
||||
widget.settings.colors.name,
|
||||
positions.PositionList[i].Coin,
|
||||
@@ -85,7 +85,7 @@ func (widget *Widget) contentFrom(positions *AllPositionsResponse) string {
|
||||
}
|
||||
|
||||
if widget.settings.displayHoldings {
|
||||
res = res + fmt.Sprintf("\n[%s]Total value: $%.3fk", "green", totalFiat/1000)
|
||||
res += fmt.Sprintf("\n[%s]Total value: $%.3fk", "green", totalFiat/1000)
|
||||
}
|
||||
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user