From 107278bcd497501475435d9a36f0aa91d1f2e1f9 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Mon, 31 Jan 2022 17:18:48 -0700 Subject: [PATCH] clean up a bit --- README.md | 2 +- go.mod | 9 +++++++-- go.sum | 20 ++++++++++++++++---- main.go | 25 +++++++++++++++++++------ 4 files changed, 43 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 06ce00c..1dbe2f0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # [gqrss](https://github.com/qbit/gqrss) -A tool to query and display GitHub issues relating to OpenBSD. +A tool to query and display GitHub issues relating to anything you want. ## Libraries used diff --git a/go.mod b/go.mod index 5c84a7d..b39e348 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,13 @@ module suah.dev/gqrss -go 1.15 +go 1.17 require ( github.com/gorilla/feeds v1.1.1 - suah.dev/protect v1.0.0 + suah.dev/protect v1.2.0 +) + +require ( + github.com/kr/pretty v0.3.0 // indirect + golang.org/x/sys v0.0.0-20210917161153-d61c044b1678 // indirect ) diff --git a/go.sum b/go.sum index 40cac60..28ecafb 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,18 @@ +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/gorilla/feeds v1.1.1 h1:HwKXxqzcRNg9to+BbvJog4+f3s/xzvtZXICcQGutYfY= github.com/gorilla/feeds v1.1.1/go.mod h1:Nk0jZrvPFZX1OBe5NPiddPw7CfwF6Q9eqzaBbaightA= -golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3 h1:5B6i6EAiSYyejWfvc5Rc9BbI3rzIsrrXfAQBWnYfn+w= -golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -suah.dev/protect v1.0.0 h1:X8pzDvDIZIiugmkmr6DES6JFO1XUdJWi34Ffmk6CMZY= -suah.dev/protect v1.0.0/go.mod h1:ZSgyBM30JUwhVPWJzVHh0jlu5W6Qz1VR6tIhAzqJZ9Y= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +golang.org/x/sys v0.0.0-20210917161153-d61c044b1678 h1:J27LZFQBFoihqXoegpscI10HpjZ7B5WQLLKL2FZXQKw= +golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +suah.dev/protect v1.2.0 h1:4G4V43yVYXCjLFzaE9QJR0fLo3rf5vNBS9YxyoI19DU= +suah.dev/protect v1.2.0/go.mod h1:Ocn1yqUskqe/is6N2bxQxtT+fegbvQsOFyHbJAQu9XE= diff --git a/main.go b/main.go index 34f2c08..ebc1f92 100644 --- a/main.go +++ b/main.go @@ -177,19 +177,32 @@ func makeRSS(q *GHResp) { log.Fatal(err) } - feed.WriteAtom(atomFile) - feed.WriteRss(rssFile) + err = feed.WriteAtom(atomFile) + if err != nil { + log.Fatal(err) + } + err = feed.WriteRss(rssFile) + if err != nil { + log.Fatal(err) + } +} + +func dieOnErr(err error) { + if err != nil { + log.Fatalln(err) + } } func main() { flag.StringVar(&search, "search", "OpenBSD", "thing to search GitHub for") flag.StringVar(&prefix, "prefix", "", "prefix to prepend to file names") flag.Parse() - protect.Unveil("./", "rwc") - protect.Unveil("/etc/ssl/cert.pem", "r") - protect.Pledge("stdio unveil rpath wpath cpath flock dns inet") - protect.UnveilBlock() + dieOnErr(protect.Unveil("./", "rwc")) + dieOnErr(protect.Unveil("/etc/ssl/cert.pem", "r")) + dieOnErr(protect.Pledge("stdio unveil rpath wpath cpath flock dns inet")) + + dieOnErr(protect.UnveilBlock()) var q GQLQuery q.Query = fmt.Sprintf(ghQuery, search)