Files
beads/cmd/bd/dolt_server_nocgo.go
emma f91bbf3a03 fix(build): add CGO build constraints for Dolt-dependent files
The dolthub/gozstd dependency requires CGO. Several files were importing
the dolt package without build constraints, causing CI failures when
building with CGO_ENABLED=0 for Linux, FreeBSD, and Android.

Changes:
- Add //go:build cgo to federation.go and doctor/federation.go
- Create dolt_server_cgo.go/nocgo.go to abstract dolt.Server usage
- Create federation_nocgo.go with stub command explaining CGO requirement
- Create doctor/federation_nocgo.go with stub health checks
- Update daemon.go to use the dolt server abstraction

Federation and Dolt-specific features are unavailable in non-CGO builds.
Users are directed to pre-built binaries from GitHub releases.

Fixes v0.49.0 CI failure.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 00:01:37 -08:00

51 lines
1.2 KiB
Go

//go:build !cgo
package main
import (
"context"
"errors"
)
// DoltServerHandle is a stub for non-CGO builds
type DoltServerHandle struct{}
// DoltDefaultSQLPort is the default SQL port for dolt server
const DoltDefaultSQLPort = 3306
// DoltDefaultRemotesAPIPort is the default remotesapi port for dolt server
const DoltDefaultRemotesAPIPort = 50051
// ErrDoltRequiresCGO is returned when dolt features are requested without CGO
var ErrDoltRequiresCGO = errors.New("dolt backend requires CGO; use pre-built binaries from GitHub releases or enable CGO")
// StartDoltServer returns an error in non-CGO builds
func StartDoltServer(ctx context.Context, dataDir, logFile string, sqlPort, remotePort int) (*DoltServerHandle, error) {
return nil, ErrDoltRequiresCGO
}
// Stop is a no-op stub
func (h *DoltServerHandle) Stop() error {
return nil
}
// SQLPort returns 0 in non-CGO builds
func (h *DoltServerHandle) SQLPort() int {
return 0
}
// RemotesAPIPort returns 0 in non-CGO builds
func (h *DoltServerHandle) RemotesAPIPort() int {
return 0
}
// Host returns empty string in non-CGO builds
func (h *DoltServerHandle) Host() string {
return ""
}
// DoltServerAvailable returns false when CGO is not available
func DoltServerAvailable() bool {
return false
}