It depends on how many rows you want:
If you are only interested in if there is a result, you should do this with SQL in the query and not with client code.
If you only want 1 row or no result, you could use QueryRow:
if err := db.QueryRow("SELECT id, name FROM users").Scan(&user); err == nil { // 1 row
} else if err == sql.ErrNoRows {
// empty result
} else {
// error
}
If you want multiple rows, you could do something like this (but nor really more elegant):
rows, err := db.Query("SELECT id, name FROM users")
if err != nil {
// error
}
if rows.Next() {
// first row
rows.Scan(&user)
...
} else {
// empty result
}
for rows.Next() {
// additional rows
rows.Scan(&user)
}