Skip to content

chore: automate sqlite driver selection via build tags (#805)#806

Open
tejasva-vardhan wants to merge 1 commit intoOneBusAway:mainfrom
tejasva-vardhan:chore/windows-pure-go-sqlite
Open

chore: automate sqlite driver selection via build tags (#805)#806
tejasva-vardhan wants to merge 1 commit intoOneBusAway:mainfrom
tejasva-vardhan:chore/windows-pure-go-sqlite

Conversation

@tejasva-vardhan
Copy link
Copy Markdown
Contributor

Overview

This PR automates the SQLite driver selection for Maglev using Go build tags, directly addressing and resolving #805. It removes the friction for Windows developers who previously had to manually pass the -tags purego flag to build or run the project.

Changes Made

  • Added driver_pure.go: Uses the //go:build windows && !cgo tag to automatically load modernc.org/sqlite on Windows machines without CGO.
  • Added driver_cgo.go: Uses the //go:build !windows || cgo tag to preserve the high-performance mattn/go-sqlite3 driver for Linux/macOS and explicit CGO builds.
  • Updated Dependencies: Ensured go.mod and go.sum correctly track both drivers.
  • (Optional: If you included helpers.go) Refactoring: Replaced hardcoded "sqlite3"/"sqlite" strings with a cross-platform DriverName constant.

Verification

  • Windows (No CGO): Verified that running go run ./cmd/api works out-of-the-box without GCC/MinGW toolchains.
  • Linux/CGO Default: Verified that the build still defaults to the CGO driver for non-Windows environments to prevent any performance regressions.

Closes #805

@tejasva-vardhan
Copy link
Copy Markdown
Contributor Author

@aaronbrethorst
i will update README in a follow-up after merge so this PR stays only about the driver change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: add pure-Go SQLite support via build tags for Windows compatibility

1 participant