feat: Eliminate CGO dependency by switching to pure Go SQLite

Replaced github.com/mattn/go-sqlite3 (CGO-based) with modernc.org/sqlite
(pure Go implementation) to enable CGO-free builds while maintaining
full SQLite functionality.

Benefits:
-  Cross-compilation without C compiler requirements
-  Simplified build environment (no CGO_ENABLED=1)
-  Reduced deployment dependencies
-  Easier container builds and static linking
-  Full SQLite compatibility maintained

Changes:
- Updated go.mod to use modernc.org/sqlite v1.34.4
- Updated database import to use pure Go SQLite driver
- Removed CGO_ENABLED=1 from all Makefile build targets
- Verified all binaries (skyview, beast-dump, skyview-data) build successfully

The modernc.org/sqlite package is a cgo-free port of SQLite that transpiles
the original C code to Go, providing identical functionality without CGO.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2025-09-01 19:53:07 +02:00
commit 41c7758f69
4 changed files with 70 additions and 7 deletions

View file

@ -9,19 +9,19 @@ LDFLAGS=-w -s -X main.version=$(VERSION)
build:
@echo "Building skyview..."
@mkdir -p $(BUILD_DIR)
CGO_ENABLED=1 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/skyview ./cmd/skyview
go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/skyview ./cmd/skyview
# Build beast-dump utility binary
build-beast-dump:
@echo "Building beast-dump..."
@mkdir -p $(BUILD_DIR)
CGO_ENABLED=1 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/beast-dump ./cmd/beast-dump
go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/beast-dump ./cmd/beast-dump
# Build skyview-data database management binary
build-skyview-data:
@echo "Building skyview-data..."
@mkdir -p $(BUILD_DIR)
CGO_ENABLED=1 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/skyview-data ./cmd/skyview-data
go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/skyview-data ./cmd/skyview-data
# Build all binaries
build-all: build build-beast-dump build-skyview-data