为什么在进行构建时第一次发生“打开连接失败:sql:未知的驱动程序“ mssql”(忘记导入?)”?

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.