From 614d7c1fdab4a85687ef72e5e0a35c8c1e1de071 Mon Sep 17 00:00:00 2001 From: James C Kimble Date: Wed, 31 Jan 2018 22:24:37 -0600 Subject: Add static_mock.go to allow building with CGO_ENABLED=0 --- static_mock.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 static_mock.go (limited to 'static_mock.go') diff --git a/static_mock.go b/static_mock.go new file mode 100644 index 0000000..48629d1 --- /dev/null +++ b/static_mock.go @@ -0,0 +1,21 @@ +// +build !cgo + +package sqlite3 + +import ( + "database/sql" + "database/sql/driver" + "errors" +) + +func init() { + sql.Register("sqlite3", &SQLiteDriverMock{}) +} + +type SQLiteDriverMock struct{} + +var errorMsg = errors.New("Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub") + +func (SQLiteDriverMock) Open(s string) (driver.Conn, error) { + return nil, errorMsg +} -- cgit v1.2.3