-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the nocgo build flag to enable a build without sqlite3 #129
base: main
Are you sure you want to change the base?
Conversation
) | ||
|
||
type Error = sq3.Error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushing these aliases here just means we can isolate the CGO requiring files and wont' need another _nocgo.go
file elsewhere
The double-negative tag of Edit: never mind... Somehow the commentary on the double-negative didn't show for me when I wrote this comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if only there were another option for the kind of minimum effort getting-started experience that i like.
does it make sense for this to build another build target in the Makefile? that might be a natural place to document what's happening.
} | ||
|
||
func (s *BlobStore) Clean(reporter ops.ErrorReporter) { | ||
panic("Cannot use sqlite3 BlobStore because building with nocgo build tag") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panic("Cannot use sqlite3 BlobStore because building with nocgo build tag") | |
panic("Cannot use sqlite3 BlobStore without cgo build") |
I'll add a makefile target. Would we prefer
|
i prefer |
This involves adding some stub files that panic if they are ever used on a nocgo build - i.e. one excluding sqlite3 but the default build will build with sqlite3 support using CGO. CGO is great if you need it, but can cause various types of failures and complexities particularly on on-standard toolcahins. As a library user I if I do not use sqlite3 I would rather not pay the prices of using CGO. In particular at the time of writing static CGO builds with go 1.13 do not work for me on musl-gcc or Arch Linux. Signed-off-by: Silas Davis <[email protected]>
I think about this one sometimes when I think about ARM builds. Do we have any particular requirements for SQLite? There is eg https://pkg.go.dev/modernc.org/sqlite offering a pure go driver, it might not be as performant but our SQL usage is really simplistic it might be enough. |
Sqlite is a good option for simple installs but is not necessary when Redis and either Postgres or MySQL are available. |
See description from commit below, but also:
-extldflags 'static'
) are broken on Go 1.13 on archs I use+build !nocgo
. I suspect maintenance of the stubs will be non-onerous.nocgo
to build without needing sqlite3 which is your only CGO dependency, but I could usenosqlite3
or similar if you prefer. We kind of need the double negative because I don't want the normal builds to need a special flag, which we can achieve if the normal files are annotated with negated flag!nocgo
This involves adding some stub files that panic if they are ever used on
a nocgo build - i.e. one excluding sqlite3 but the default build will
build with sqlite3 support using CGO.
CGO is great if you need it, but can cause various types of failures and
complexities particularly on on-standard toolcahins. As a library user I if I do not use sqlite3 I would rather not pay the prices of using CGO.
In particular at the time of writing static CGO builds with go 1.13 do
not work for me on musl-gcc or Arch Linux.
Signed-off-by: Silas Davis [email protected]