Skip to content

Error in database example #15

@codegangsta

Description

@codegangsta

If you run the example code in the Databases section as-is, the request throws a "Panic" error because QueryRow has to return a row, and the newly-initialized database table of course has no rows in it.

http://codegangsta.gitbooks.io/building-web-apps-with-go/content/databases/README.html

Again, very easy to figure out if you're not a total beginner, but maybe it would be better to either populate the db in the NewDB() function or remind the reader that the database must have data in order for QueryRow to work.

(Totally off-topic, but having worked with Perl's DBI for years I find the Golang database libraries really, really primitive. But maybe that's just me, I'm new to it...)

cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions