cachix / git-hooks.nix

Seamless integration of https://pre-commit.com git hooks with Nix.
Apache License 2.0
531 stars 155 forks source link

gotest fails because go-sqlite3 is unable to be compiled #465

Open shackra opened 4 months ago

shackra commented 4 months ago
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.

shackra commented 4 months ago

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

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