mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
20191215 code improvements (#790)
* Upgrade godo to latest * Fix a bunch of issues found by * Running staticcheck on a codebase for the first time is a sobering experience * go mod tidy * More static improvements Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
@@ -52,6 +52,9 @@ var (
|
||||
|
||||
func apiRequest(path string) (*http.Response, error) {
|
||||
req, err := http.NewRequest("GET", apiEndpoint+path+".json", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
httpClient := &http.Client{}
|
||||
resp, err := httpClient.Do(req)
|
||||
|
||||
@@ -77,13 +77,12 @@ func (widget *Widget) content() (string, string, bool) {
|
||||
return title, widget.err.Error(), true
|
||||
}
|
||||
|
||||
stories := widget.stories
|
||||
if stories == nil || len(stories) == 0 {
|
||||
if len(widget.stories) == 0 {
|
||||
return title, "No stories to display", false
|
||||
}
|
||||
var str string
|
||||
|
||||
for idx, story := range stories {
|
||||
var str string
|
||||
for idx, story := range widget.stories {
|
||||
u, _ := url.Parse(story.URL)
|
||||
|
||||
row := fmt.Sprintf(
|
||||
|
||||
Reference in New Issue
Block a user