gofmt
j3s j3s@c3f.net
Mon, 15 Feb 2021 15:12:51 -0600
1 files changed,
15 insertions(+),
15 deletions(-)
jump to
M
main.go
→
main.go
@@ -1,16 +1,16 @@
package main import ( + "encoding/csv" "fmt" + "github.com/mmcdole/gofeed" "io" - "strings" "io/ioutil" "log" "net/http" - "encoding/csv" - "github.com/mmcdole/gofeed" - "sort" "os" + "sort" + "strings" ) func rootHandler(w http.ResponseWriter, r *http.Request) {@@ -19,15 +19,15 @@ if err != nil {
log.Fatal(err) } posts := make([]gofeed.Feed, 0) - var gottenFeed gofeed.Feed + var gottenFeed gofeed.Feed for _, f := range feeds { - gottenFeed, err = getFeed(f) - if err != nil { - // break loop in case of - // feed fetching failure - log.Println(err) - continue - } + gottenFeed, err = getFeed(f) + if err != nil { + // break loop in case of + // feed fetching failure + log.Println(err) + continue + } posts = append(posts, gottenFeed) } beegFeed := gofeed.Feed{}@@ -56,8 +56,8 @@
func getFeedList(url string) ([]string, error) { res, err := http.Get(url) if err != nil { - err = fmt.Errorf("getFeedList http.Get: %w", err) - log.Fatal(err) + err = fmt.Errorf("getFeedList http.Get: %w", err) + log.Fatal(err) } robots, err := ioutil.ReadAll(res.Body) if err != nil {@@ -81,7 +81,7 @@ return feeds, err
} func main() { - // TODO: check whether ARG1 exists + // TODO: check whether ARG1 exists http.HandleFunc("/", rootHandler) log.Fatal(http.ListenAndServe(":8080", nil)) }