Documentation
README
Feature Flags
Feature flags gate experimental functionality behind user-configurable settings, enabling safe rollout (default off), user opt-in, and easy rollback.
Checking Feature State
import "github.com/marcus/sidecar/internal/features"
if features.IsEnabled("tmux_interactive_input") {
// Feature-gated code
}
Adding a New Feature Flag
- Define the feature in
internal/features/features.go:
var MyNewFeature = Feature{
Name: "my_new_feature",
Default: false,
Description: "Description of what this enables",
}
- Add to the
allFeaturesslice:
var allFeatures = []Feature{
TmuxInteractiveInput,
MyNewFeature, // Add here
}
- Use the feature check in your code:
This is the opening of the README. Read the full README on GitHub.