1
0
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:
Kirill Motkov
2019-05-21 17:17:47 +03:00
parent c050292a8d
commit f0771cd013
46 changed files with 161 additions and 168 deletions

View File

@@ -46,8 +46,8 @@ func (widget *Widget) Create(jenkinsURL string, username string, apiKey string)
return view, nil
}
func ensureLastSlash(URL string) string {
return strings.TrimRight(URL, "/") + "/"
func ensureLastSlash(url string) string {
return strings.TrimRight(url, "/") + "/"
}
/* -------------------- Unexported Functions -------------------- */

View File

@@ -75,7 +75,7 @@ func (widget *Widget) contentFrom(view *View) string {
var validID = regexp.MustCompile(widget.settings.jobNameRegex)
if validID.MatchString(job.Name) {
str = str + fmt.Sprintf(
str += fmt.Sprintf(
`["%d"][%s] [%s]%-6s[white][""]`,
idx,
widget.RowColor(idx),
@@ -83,7 +83,7 @@ func (widget *Widget) contentFrom(view *View) string {
job.Name,
)
str = str + "\n"
str += "\n"
}
}