1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Fix errors found by staticcheck

Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
Chris Cummer 2020-05-06 22:52:09 -07:00
parent 10a8d27462
commit d45c02251d
3 changed files with 6 additions and 24 deletions

View File

@ -85,21 +85,3 @@ func (widget *Widget) displayStatus() string {
}
return content
}
func getStatusColor(status string) string {
switch status {
case sdk.StatusSuccess:
return "green"
case sdk.StatusBuilding, sdk.StatusWaiting:
return "blue"
case sdk.StatusFail:
return "red"
case sdk.StatusStopped:
return "red"
case sdk.StatusSkipped:
return "grey"
case sdk.StatusDisabled:
return "grey"
}
return "red"
}

View File

@ -72,7 +72,7 @@ func getStatus(c http.Client, apiURL string) (status Status, err error) {
var rBody []byte
if rBody, err = ioutil.ReadAll(resp.Body); err != nil {
return status, fmt.Errorf(" failed to read status response\n")
return status, fmt.Errorf(" failed to read status response")
}
if err = json.Unmarshal(rBody, &status); err != nil {
@ -220,13 +220,13 @@ func getQueryTypes(c http.Client, settings *Settings) (qt QueryTypes, err error)
var url *url2.URL
if url, err = url2.Parse(settings.apiUrl); err != nil {
return qt, fmt.Errorf(" failed to parse API URL\n %s\n", parseError(err))
return qt, fmt.Errorf(" failed to parse API URL\n %s", parseError(err))
}
var query url2.Values
if query, err = url2.ParseQuery(url.RawQuery); err != nil {
return qt, fmt.Errorf(" failed to parse query\n %s\n", parseError(err))
return qt, fmt.Errorf(" failed to parse query\n %s", parseError(err))
}
query.Add("getQueryTypes", strconv.Itoa(settings.showTopClients))
@ -285,7 +285,7 @@ func checkServer(c http.Client, apiURL string) error {
if req, err = http.NewRequest("GET", fmt.Sprintf("%s?version",
url.String()), nil); err != nil {
return fmt.Errorf("invalid request: %s\n", parseError(err))
return fmt.Errorf("invalid request: %s", parseError(err))
}
var resp *http.Response

View File

@ -2,17 +2,17 @@ package spacex
import (
"fmt"
"time"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
"time"
)
type Widget struct {
view.TextWidget
settings *Settings
err error
launch Launch
}
func NewWidget(app *tview.Application, settings *Settings) *Widget {