feat(audit): replace mattn/go-sqlite3 with modernc.org/sqlite to remove CGO dependency#152
Merged
Merged
Conversation
…e and DSN Prepare for CGO-free SQLite driver migration by updating the pre-migration test to use the "sqlite" driver name and pragma() DSN syntax expected by modernc.org/sqlite. This test intentionally fails until the driver is swapped. Resolves #150 Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
Switch to the pure-Go SQLite driver, eliminating the CGO build requirement. The driver name changes from "sqlite3" to "sqlite" and DSN pragmas use function-call syntax (_pragma=key(value)). Existing virtwork.db files remain compatible — same SQLite format. Resolves #150 Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
With modernc.org/sqlite (pure Go), CGO is no longer needed. - .goreleaser.yaml: CGO_ENABLED=0 - Dockerfile: switch to alpine builder, drop gcc/libsqlite3-dev/sqlite-libs - Dockerfile.ci: drop sqlite-libs runtime dependency - testutil/binary.go: build E2E binary with CGO_ENABLED=0 Resolves #150 Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mrhillsman The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
mattn/go-sqlite3) with the pure-Go driver (modernc.org/sqlite), eliminating the need for a C compiler at build time"sqlite3"?"sqlite"), DSN pragma syntax (_key=value?_pragma=key(value)), and all build files to setCGO_ENABLED=0golang:1.26-bookwormwith gcc/libsqlite3-dev togolang:1.26-alpine, and removesqlite-libsruntime dependency from both DockerfilesMotivation
This is a prerequisite for #151 (multi-platform builds). With CGO eliminated, GoReleaser can cross-compile to Linux ARM64, macOS amd64, and macOS ARM64 without C cross-compilers or osxcross.
What changed
internal/audit/audit.gomodernc.org/sqlite, driver name"sqlite",_pragma=DSN syntaxinternal/audit/migrate_test.go.goreleaser.yamlCGO_ENABLED=0DockerfileDockerfile.ciinternal/testutil/binary.goCGO_ENABLED=0for E2E test binary buildExisting
virtwork.dbfiles remain compatible ? same SQLite file format.Resolves #150