A mySQL Query function returns an array of rows witch is defined as
type Row []interface{}
I would like to check if the returned array is empty, but I get a runtime panic:
s := fmt.Sprintf("select id, secret, shortname from beehives where shortname = '%s'", beehive)
rows, res, err := database.Query(s)
if err == nil {
if len(rows) != 1 {
The expression len(rows) seems to cause the runtime panic if rows is empty.
How can I check for an empty array? I tried also rows == nil, which also panics.