Avoid unnecessary import of SQLite driver. #801
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Avoids unnecessarily importing the modernc SQLite driver.
The package is still imported by the main and test packages that need it.
Motivation and Context
Library users (such as the VFS) don't need to import the driver, which registers it on
init.See #772 (comment)
For example, the package used by the current prototype
vfs.gois meant to work withcgodrivers, notmodernc:litestream/vfs.go
Line 15 in 2ee408b
In fact, I'm not sure a VFS can be implemented for
modernc. My reading of theirvfspackage says no, but I'm sure with some effort, dropping down to the lower level allows it.How Has This Been Tested?
I've tested the
litestreamcommand, and it works, which is expected, as it importsmoderncand thus registers the driver (i.e., no change):litestream/cmd/litestream/main.go
Line 24 in 2ee408b
All tests pass, as both the
litestream_testpackage, andtestingutilimport the driver.Library clients will have themselves to import
modernc: AFAICT if they uselitestream.DB,litestream.Replicaorlitestream.Store.Types of changes
This may break library users. It's a simple fix, though, just add this somewhere in their code:
Checklist
go fmt,go vet)go test ./...)I haven't updated docs. Where would docs for library users be? This should probably me mentioned in release notes.