aboutsummaryrefslogtreecommitdiff
path: root/static_mock.go
diff options
context:
space:
mode:
authorJames C Kimble <jckimble601@gmail.com>2018-01-31 22:24:37 -0600
committerJames C Kimble <jckimble601@gmail.com>2018-01-31 22:24:37 -0600
commit614d7c1fdab4a85687ef72e5e0a35c8c1e1de071 (patch)
tree5cadb7a5ede1c8e938b62b2370de0fd5299e3a81 /static_mock.go
parentMerge pull request #521 from mattn/fix520 (diff)
downloadgolite-614d7c1fdab4a85687ef72e5e0a35c8c1e1de071.tar.gz
golite-614d7c1fdab4a85687ef72e5e0a35c8c1e1de071.tar.xz
Add static_mock.go to allow building with CGO_ENABLED=0
Diffstat (limited to 'static_mock.go')
-rw-r--r--static_mock.go21
1 files changed, 21 insertions, 0 deletions
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
+}