Add missing err checks
This commit is contained in:
parent
7b8d3796bd
commit
0fa79abdfd
@ -47,6 +47,6 @@ func FormatAs(format string) (func(item Item) string, error) {
|
|||||||
case "short":
|
case "short":
|
||||||
return FormatAsShort, nil
|
return FormatAsShort, nil
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("error: invalid format %s", format)
|
return nil, fmt.Errorf("invalid format '%s'", format)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,10 @@ func InitDatabase(db *DB) error {
|
|||||||
|
|
||||||
var exists bool
|
var exists bool
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
rows.Scan(&exists)
|
err = rows.Scan(&exists)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if exists {
|
if exists {
|
||||||
@ -55,7 +58,10 @@ func GetPendingMigrations(db *DB) (map[string]bool, error) {
|
|||||||
}
|
}
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var name string
|
var name string
|
||||||
rows.Scan(&name)
|
err = rows.Scan(&name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
complete[name] = true
|
complete[name] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,10 @@ func GetAllActiveItems(db *DB) ([]Item, error) {
|
|||||||
var items []Item
|
var items []Item
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var item Item
|
var item Item
|
||||||
rows.Scan(&item.Source, &item.Id, &item.Created, &item.Active, &item.Title, &item.Author, &item.Body, &item.Link, &item.Time)
|
err = rows.Scan(&item.Source, &item.Id, &item.Created, &item.Active, &item.Title, &item.Author, &item.Body, &item.Link, &item.Time)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
items = append(items, item)
|
items = append(items, item)
|
||||||
}
|
}
|
||||||
return items, nil
|
return items, nil
|
||||||
@ -121,7 +124,10 @@ func GetActiveItemsForSource(db *DB, source string) ([]Item, error) {
|
|||||||
var items []Item
|
var items []Item
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var item Item
|
var item Item
|
||||||
rows.Scan(&item.Source, &item.Id, &item.Created, &item.Active, &item.Title, &item.Author, &item.Body, &item.Link, &item.Time)
|
err = rows.Scan(&item.Source, &item.Id, &item.Created, &item.Active, &item.Title, &item.Author, &item.Body, &item.Link, &item.Time)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
items = append(items, item)
|
items = append(items, item)
|
||||||
}
|
}
|
||||||
return items, nil
|
return items, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user