flaglint-go validate
flaglint-go validate checks whether a Go codebase complies with a flag-usage policy. It’s the only flaglint-go command that ever exits 1.
Options
Section titled “Options”| Flag | Description |
|---|---|
--no-direct-launchdarkly | Fail if any direct LaunchDarkly Go SDK evaluation calls are found |
--bootstrap-exclude stringArray | Glob pattern for files allowed to use the LaunchDarkly SDK directly (repeatable) |
-f, --format string | Output format: text | sarif (default text) |
-o, --output string | Write report to a file instead of stdout |
--config string | Path to config file |
--baseline string | Baseline file for comparing against known debt |
--fail-on-new | Exit 1 if any findings are not in the baseline |
Blocking Policy Command
Section titled “Blocking Policy Command”flaglint-go validate ./services --no-direct-launchdarkly✗ validate --no-direct-launchdarkly: 2 direct LaunchDarkly Go SDK call(s) found.
checkout.go:13:16 — BoolVariation("checkout-v2") checkout.go:20:12 — IntVariation("discount-percentage")
These call sites must migrate to OpenFeature before this rule passes.Pass output once no direct calls remain:
✓ validate --no-direct-launchdarkly: no direct LaunchDarkly Go SDK calls found. Scanned 2 file(s).Baseline Mode
Section titled “Baseline Mode”--baseline/--fail-on-new runs independently of --no-direct-launchdarkly — use it alone to adopt CI enforcement before existing debt is resolved:
flaglint-go audit ./services --write-baseline .flaglint-baseline.jsonflaglint-go validate ./services --baseline .flaglint-baseline.json --fail-on-newScanned 2 file(s). Found 2 LaunchDarkly Go SDK usage(s).✓ No new findings beyond baselineOnce new debt is introduced:
Scanned 2 file(s). Found 3 LaunchDarkly Go SDK usage(s).Error: 1 new finding(s) not in baseline: - launchdarkly:BoolVariation:new-feature-flag:checkout.goRe-run --write-baseline whenever you accept new debt on purpose.
flaglint-go validate ./services --no-direct-launchdarkly --format sarif --output flaglint.sarifSARIF findings use rule ID flaglint.go.direct-launchdarkly (Go-namespaced — distinct from flaglint-js’s flaglint.direct-launchdarkly, per the cross-tool contract). Note: unlike flaglint-js’s 0-based ESTree columns, Go’s token.Position.Column is already 1-based, so flaglint-go does not add 1 to column numbers.
Bootstrap Exclusions
Section titled “Bootstrap Exclusions”Use --bootstrap-exclude for files allowed to use the SDK directly (a provider-wiring package, for example):
flaglint-go validate ./services --no-direct-launchdarkly --bootstrap-exclude "internal/openfeature-bootstrap/**"Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | Success — no policy violations |
| 1 | Policy failure — direct calls found (--no-direct-launchdarkly) or new findings beyond baseline (--fail-on-new) |
| 2 | Invalid input — bad directory, bad --format, malformed config/baseline |
| 3 | Internal error |
| 130 | Interrupted (Ctrl-C) |
scan and audit never exit anything but 0 (barring a tool error) — validate is the only policy gate.