bwag
bwag copied to clipboard
Error in database example
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