fix: enable building on Windows without CGO (#1117)
The dolt storage backend requires CGO due to its gozstd dependency. This change makes the dolt backend optional using build tags, allowing `go install` to work on Windows where CGO is disabled by default. Changes: - Add BackendFactory registration pattern to factory package - Create factory_dolt.go with `//go:build cgo` constraint that registers the dolt backend only when CGO is available - Update init.go to use factory instead of direct dolt import - When dolt backend is requested without CGO, provide helpful error message directing users to pre-built binaries The sqlite backend (default) works without CGO and covers the majority of use cases. Users who need dolt can either: 1. Use pre-built binaries from GitHub releases 2. Enable CGO by installing a C compiler Fixes #1116
This commit is contained in:
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/steveyegge/beads/internal/configfile"
|
||||
"github.com/steveyegge/beads/internal/git"
|
||||
"github.com/steveyegge/beads/internal/storage"
|
||||
"github.com/steveyegge/beads/internal/storage/dolt"
|
||||
"github.com/steveyegge/beads/internal/storage/factory"
|
||||
"github.com/steveyegge/beads/internal/storage/sqlite"
|
||||
"github.com/steveyegge/beads/internal/syncbranch"
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
@@ -299,7 +299,7 @@ With --stealth: configures per-repository git settings for invisible beads usage
|
||||
if backend == configfile.BackendDolt {
|
||||
// Dolt uses a directory, not a file
|
||||
storagePath = filepath.Join(beadsDir, "dolt")
|
||||
store, err = dolt.New(ctx, &dolt.Config{Path: storagePath})
|
||||
store, err = factory.New(ctx, backend, storagePath)
|
||||
} else {
|
||||
storagePath = initDBPath
|
||||
store, err = sqlite.New(ctx, storagePath)
|
||||
|
||||
Reference in New Issue
Block a user