sql.Open() expects 2 things 'driverName' and 'dataSourceName'. In case of sqlhooks example, they used sqlite as database. Apart from that, they have used go-sqlite3 and if you look closely to file sqlite3.go at line number 886. You would see datasourcename ':memory:' that means we are opting for in-memory utilization of sqlite db.
'dataSourceName' will vary as per the database opted. Its basically means connection string in Data Source Name format.
Reason why this worked fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable", host, port, user, password, dbname)