sql-migrate
sql-migrate copied to clipboard
Unable to build with CGO_ENABLED=0
In my docker file:
FROM golang:1.13-alpine
RUN apk update && apk add postgresql git gcc libc-dev
ENV CGO_ENABLED=0
RUN go get github.com/rubenv/sql-migrate/...
This fails with the error:
# github.com/mattn/go-sqlite3
src/github.com/mattn/go-sqlite3/sqlite3_opt_preupdate.go:12:16: undefined: SQLiteConn
Also, see https://github.com/mattn/go-sqlite3/issues/327
Well, I'm fairly certain that CGO is required as sqlite3 is written in C
Correct!
Note: that only applies to the command-line utility. No database driver is included if you use it as a library, so it works perfectly well without CGO.
327 states CGO_ENABLED=1
is required in order to compile properly.