The first time I ran https://github.com/denisenkom/go-mssqldb/blob/master/examples/simple.go I got the error 'Open connection failed:sql: unknown driver "mssql" (forgotten import?)'
I resolved this by changing import _ "github.com/denisenkom/go-mssqldb" to import "github.com/denisenkom/go-mssqldb"
Which gave a different error of 'imported and not used: "github.com/denisenkom/go-mssqldb" as mssql'.
However ... after changing back to import _ "github.com/denisenkom/go-mssqldb" and building again the first error went away.
I also had to change the main function name from 'simplemain' to 'main' for some reason before it would compile.
Why would the error 'Open connection failed:sql: unknown driver "mssql" (forgotten import?)' happen on the first build?
Intended way of use seems to be
import _ "github.com/denisenkom/go-mssqldb"
which purpose is to run package's init() functions
func init() {
sql.Register("mssql", &MssqlDriver{})
}
most likely it's a some typo cause the error.