diff options
author | mattn <mattn.jp@gmail.com> | 2018-02-02 21:40:21 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-02 21:40:21 +0900 |
commit | cf92a0c6c881ae9db15f8720a7be6439c24b4b7c (patch) | |
tree | 5cadb7a5ede1c8e938b62b2370de0fd5299e3a81 /static_mock.go | |
parent | Merge pull request #521 from mattn/fix520 (diff) | |
parent | Add static_mock.go to allow building with CGO_ENABLED=0 (diff) | |
download | golite-cf92a0c6c881ae9db15f8720a7be6439c24b4b7c.tar.gz golite-cf92a0c6c881ae9db15f8720a7be6439c24b4b7c.tar.xz |
Merge pull request #524 from jckimble/master
Add static_mock.go to allow building with CGO_ENABLED=0
Diffstat (limited to 'static_mock.go')
-rw-r--r-- | static_mock.go | 21 |
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 +} |