Fix nonamedreturns findings

chubin/logging
Igor Chubin 2 years ago
parent 5b80bf417b
commit 232637db11

@ -60,8 +60,11 @@ type resp struct {
} `json:"data"`
}
func getDataFromAPI() (ret resp) {
var params []string
func getDataFromAPI() resp {
var (
ret resp
params []string
)
if len(config.APIKey) == 0 {
log.Fatal("No API key specified. Setup instructions are in the README.")
@ -118,7 +121,7 @@ func getDataFromAPI() (ret resp) {
}
}
return
return ret
}
func unmarshalLang(body []byte, r *resp) error {

@ -167,6 +167,7 @@ func formatTemp(c cond) string {
unitTemp[config.Imperial]),
15)
}
return pad(fmt.Sprintf("%s °%s", color(c.FeelsLikeC, false), unitTemp[config.Imperial]), 15)
}
@ -247,7 +248,7 @@ func formatVisibility(c cond) string {
}
func formatRain(c cond) string {
rainUnit := float32(c.PrecipMM)
rainUnit := c.PrecipMM
if config.Imperial {
rainUnit = c.PrecipMM * 0.039
}
@ -262,8 +263,12 @@ func formatRain(c cond) string {
return pad(fmt.Sprintf("%.1f %s", rainUnit, unitRain(config.Imperial, config.Lang)), 15)
}
func formatCond(cur []string, c cond, current bool) (ret []string) {
var icon []string
func formatCond(cur []string, c cond, current bool) []string {
var (
ret []string
icon []string
)
if i, ok := codes[c.WeatherCode]; !ok {
icon = getIcon("iconUnknown")
} else {
@ -344,7 +349,7 @@ func formatCond(cur []string, c cond, current bool) (ret []string) {
fmt.Sprintf("%v %v %v", cur[4], icon[4], formatRain(c)))
}
return
return ret
}
func justifyCenter(s string, width int) string {
@ -371,7 +376,8 @@ func reverse(s string) string {
return string(r)
}
func pad(s string, mustLen int) (ret string) {
func pad(s string, mustLen int) string {
var ret string
ret = s
realLen := utf8.RuneCountInString(ansiEsc.ReplaceAllLiteralString(s, ""))
delta := mustLen - realLen
@ -392,5 +398,5 @@ func pad(s string, mustLen int) (ret string) {
}
}
return
return ret
}

@ -148,6 +148,7 @@ var (
"mg": "Vinavina toetr'andro hoan'ny:",
}
//nolint:misspell
daytimeTranslation = map[string][]string{
"af": {"Oggend", "Middag", "Vroegaand", "Laatnag"},
"am": {"ጠዋት", "ከሰዓት በኋላ", "ምሽት", "ሌሊት"},

@ -9,8 +9,9 @@ import (
var slotTimes = [slotcount]int{9 * 60, 12 * 60, 18 * 60, 22 * 60}
func printDay(w weather) (ret []string) {
func printDay(w weather) []string {
var (
ret []string
dateName string
names string
)

Loading…
Cancel
Save