some linter suggested renamings

This commit is contained in:
Andrew Davidson 2018-01-01 09:35:54 -05:00
parent de597f2f0d
commit 59dda11344

View file

@ -3,13 +3,14 @@ package main
import (
"database/sql"
"encoding/xml"
"errors"
"fmt"
_ "github.com/mattn/go-sqlite3"
"io/ioutil"
"net/http"
)
func checkUrl(url string, db *sql.DB) bool {
func checkURL(url string, db *sql.DB) bool {
row := db.QueryRow(`SELECT COUNT(url) FROM bookmarks where URL="%s"`, url)
if row != nil {
@ -19,9 +20,9 @@ func checkUrl(url string, db *sql.DB) bool {
return false
}
func addNewUrl(url string, db *sql.DB) sql.Row {
func addNewURL(url string, db *sql.DB) sql.Row {
return nil
panic(errors.New("Could not add URL to database"))
}
func main() {
@ -30,9 +31,9 @@ func main() {
fmt.Println("Getting archive data from Pocket...")
// Pull data from RSS feed.
archiveUrl := "https://getpocket.com/users/amdavidson/feed/read"
archiveURL := "https://getpocket.com/users/amdavidson/feed/read"
resp, err := http.Get(archiveUrl)
resp, err := http.Get(archiveURL)
if err != nil {
fmt.Println("Could not get archived urls")
panic(err)
@ -46,7 +47,7 @@ func main() {
// Required
Title string `xml:"title"`
Link string `xml:"link"`
Guid string `xml:"guid"`
GUID string `xml:"guid"`
// Optional
PubDate string `xml:"pubDate"`
Comments string `xml:"comments"`
@ -81,10 +82,10 @@ func main() {
defer db.Close()
for _, bookmark := range f.BookmarkList {
if checkUrl(bookmark.Guid, db) == true {
fmt.Println("New bookmark url %s", bookmark.Guid)
if checkURL(bookmark.GUID, db) == true {
fmt.Printf("New bookmark url %s\n", bookmark.GUID)
} else {
fmt.Println("Already know about %s", bookmark.Guid)
fmt.Printf("Already know about %s\n", bookmark.GUID)
}
}