From 0b1ec9654518fcde3236dddd74bb33b81042b015 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Thu, 28 Jun 2018 17:40:36 -0700 Subject: [PATCH] Formatting fixes --- cfg/config_files.go | 5 ++--- cryptoexchanges/blockfolio/widget.go | 12 ++++++------ jenkins/client.go | 3 +-- jenkins/view.go | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/cfg/config_files.go b/cfg/config_files.go index 21eb1a67..5bce14f3 100644 --- a/cfg/config_files.go +++ b/cfg/config_files.go @@ -81,11 +81,10 @@ func CreateConfigFile() { } // If the file is empty, write to it - file, err := os.Stat(filePath) + file, _ := os.Stat(filePath) if file.Size() == 0 { - err = ioutil.WriteFile(filePath, []byte(simpleConfig), 0644) - if err != nil { + if ioutil.WriteFile(filePath, []byte(simpleConfig), 0644) != nil { panic(err) } } diff --git a/cryptoexchanges/blockfolio/widget.go b/cryptoexchanges/blockfolio/widget.go index 72349738..cb6906c6 100644 --- a/cryptoexchanges/blockfolio/widget.go +++ b/cryptoexchanges/blockfolio/widget.go @@ -73,15 +73,15 @@ func contentFrom(positions *AllPositionsResponse) string { const magic = "edtopjhgn2345piuty89whqejfiobh89-2q453" type Position struct { - Coin string `json:coin` - LastPriceFiat float32 `json:lastPriceFiat` - TwentyFourHourPercentChangeFiat float32 `json:twentyFourHourPercentChangeFiat` - Quantity float32 `json:quantity` - HoldingValueFiat float32 `json:holdingValueFiat` + Coin string `json:"coin"` + LastPriceFiat float32 `json:"lastPriceFiat"` + TwentyFourHourPercentChangeFiat float32 `json:"twentyFourHourPercentChangeFiat"` + Quantity float32 `json:"quantity"` + HoldingValueFiat float32 `json:"holdingValueFiat"` } type AllPositionsResponse struct { - PositionList []Position `json:positionList` + PositionList []Position `json:"positionList"` } func MakeApiRequest(token string, method string) ([]byte, error) { diff --git a/jenkins/client.go b/jenkins/client.go index e599b9f7..ddad50d6 100644 --- a/jenkins/client.go +++ b/jenkins/client.go @@ -23,7 +23,7 @@ func Create(jenkinsURL string, username string, apiKey string) (*View, error) { } jenkinsAPIURL := parsedJenkinsURL.ResolveReference(parsedSuffix) - req, err := http.NewRequest("GET", jenkinsAPIURL.String(), nil) + req, _ := http.NewRequest("GET", jenkinsAPIURL.String(), nil) req.SetBasicAuth(username, apiKey) httpClient := &http.Client{} @@ -45,7 +45,6 @@ func ensureLastSlash(URL string) string { /* -------------------- Unexported Functions -------------------- */ - func parseJson(obj interface{}, text io.Reader) { jsonStream, err := ioutil.ReadAll(text) if err != nil { diff --git a/jenkins/view.go b/jenkins/view.go index 03a7f6ed..11c079ad 100644 --- a/jenkins/view.go +++ b/jenkins/view.go @@ -6,5 +6,5 @@ type View struct { Jobs []Job `json:"jobs"` Name string `json:"name"` Property []string `json:"property"` - url string `json:"url"` + Url string `json:"url"` }