Skip to content

Commit

Permalink
Selecting from languages on startup shouldn't be a fatal error
Browse files Browse the repository at this point in the history
Fixes #570
  • Loading branch information
arp242 committed Feb 16, 2022
1 parent 8e27a7c commit d869938
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/goatcounter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,11 @@ func connectDB(connect string, migrate []string, create, dev bool) (zdb.DB, cont
// Load languages.
var c int
err = db.Get(context.Background(), &c, `select count(*) from languages`)
if err != nil {
return nil, nil, err
}
if c == 0 {
// Ignore the error intentionally; not being able to select from the
// languages table here to populate it (usually because it doesn't exist
// yet) shouldn't be a fatal error. If there's some other error then the
// query error will show that one anyway.
if err == nil && c == 0 {
langs, err := fs.ReadFile(goatcounter.DB, "db/languages.sql")
if err != nil {
return nil, nil, err
Expand Down

0 comments on commit d869938

Please sign in to comment.