Files
beads/internal/storage/factory/factory_dolt.go
Bobby Johnson 55e733cf62 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
2026-01-15 19:23:02 -08:00

18 lines
424 B
Go

//go:build cgo
package factory
import (
"context"
"github.com/steveyegge/beads/internal/configfile"
"github.com/steveyegge/beads/internal/storage"
"github.com/steveyegge/beads/internal/storage/dolt"
)
func init() {
RegisterBackend(configfile.BackendDolt, func(ctx context.Context, path string, opts Options) (storage.Storage, error) {
return dolt.New(ctx, &dolt.Config{Path: path, ReadOnly: opts.ReadOnly})
})
}