Add and enforce golangci-lint (#16)

This commit is contained in:
Dave Gallant
2020-07-05 22:44:05 -04:00
committed by GitHub
parent 2ec9bca107
commit d9474be233
13 changed files with 141 additions and 59 deletions

View File

@@ -4,8 +4,6 @@ import (
"fmt"
"log"
"os/exec"
"os/user"
"path"
"github.com/davegallant/srv/controller"
"github.com/davegallant/srv/utils"
@@ -37,7 +35,10 @@ func openFeed(g *gocui.Gui, v *gocui.View) error {
for _, item := range feed.Items {
fmt.Fprintln(ov, "-", item.Title)
}
nextView(g, ov)
err := nextView(g, ov)
if err != nil {
log.Printf("Unable to get next view: %s", err)
}
displayDescription(g, ov)
return nil
@@ -48,17 +49,15 @@ func getCurrentFeedItem(v *gocui.View) *gofeed.Item {
return Controller.Rss.Feeds[Controller.CurrentFeed].Items[oy]
}
// displayDescription displays feed descriptin if it exists
func displayDescription(g *gocui.Gui, v *gocui.View) error {
// displayDescription displays feed description if it exists
func displayDescription(g *gocui.Gui, v *gocui.View) {
ov, _ := g.View("Description")
ov.Clear()
item := getCurrentFeedItem(v)
description := utils.StripHtmlTags(item.Description)
description := utils.StripHTMLTags(item.Description)
fmt.Fprintln(ov, description)
return nil
}
// openItem opens the feed in an external browser
@@ -157,14 +156,8 @@ func quit(g *gocui.Gui, v *gocui.View) error {
// Start initializes the application
func Start() {
usr, err := user.Current()
if err != nil {
log.Fatal(err)
}
configPath := path.Join(usr.HomeDir, ".config", "srv", "config.yaml")
Controller = &controller.Controller{}
Controller.Init(configPath)
Controller.Init()
g, err := gocui.NewGui(gocui.Output256)
if err != nil {