使用SQL驱动程序交叉编译Go程序

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
    }
}

Most ( / all?) SQL drivers are just wrappers for the actual C library.

Your only option is to use a virtual machine with the OS you want to compile for.

Oh, wait, is this because github.com/mattn/go-oci8 actually requires CGo and can't be cross-compiled?