I have a very simple working Go test program which uses Oracle SQL driver ("github.com/mattn/go-oci8"). I build and test it on OS X and it works. Now I want to cross-compile and run it on Linux. I compiled it like this:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go install github.com/mattn/go-oci8
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build myoracle.go
but when I try to run it, I get
$ ./myoracle
sql: unknown driver "oci8" (forgotten import?)
The code looks like this::
import (
"database/sql"
"fmt"
_ "github.com/mattn/go-oci8"
"os"
)
func main() {
os.Setenv("NLS_LANG", "")
db, err := sql.Open("oci8", "user/pass@dbserver:1521/SVC")
if err != nil {
fmt.Println(err)
return
}
}