cachix / git-hooks.nix

Seamless integration of https://pre-commit.com git hooks with Nix.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gotest fails because go-sqlite3 is unable to be compiled

shackra opened this issue · comments

gotest...................................................................Failed
- hook id: gotest
- exit code: 1

--- FAIL: TestCreateFixture (0.00s)
    data_test.go:11:
                Error Trace:    /build/src/cmd/db-creator/data_test.go:11
                Error:          Received unexpected error:
                                sqlite: check foreign_keys pragma: reading schema information Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
                Test:           TestCreateFixture
FAIL
FAIL    github.com/shackra/keisy-ian/cmd/db-creator     0.006s
FAIL

Since flakes do not admit environment variables, not even with --impure flag passed, it seems impossible to let this check pass without setting CGO_ENABLED=1.

My best workaround was to use github.com/ncruces/go-sqlite3

_ "github.com/ncruces/go-sqlite3/driver"
_ "github.com/ncruces/go-sqlite3/embed"