Loading...
Flagsmith's Go SDK provides a clean API for flag checks and remote config retrieval. But in production Go services, flag evaluations end up in middleware chains, handler functions, and background goroutines. FlagShark uses `go/ast` to find them all.
FlagShark generates a PR that removes the dead branch and keeps only the winning code path
func uploadHandler(w http.ResponseWriter, r *http.Request) {
flags, _ := flagsmithClient.GetEnvironmentFlags()
isEnabled, _ := flags.IsFeatureEnabled("chunked-upload")
chunkSize, _ := flags.GetFeatureValue("chunked-upload")
if isEnabled {
size, _ := strconv.Atoi(chunkSize.(string))
handleChunkedUpload(w, r, size)
} else {
handleSimpleUpload(w, r)
}
}func uploadHandler(w http.ResponseWriter, r *http.Request) {
handleChunkedUpload(w, r, 8192)
}FlagShark uses go/ast package for type-safe detection of SDK usage patterns to find every call to has_feature(), get_value(), get_trait()across your Gin, Echo, standard library codebase.
Each detected flag key is matched against your Flagsmith project to check rollout status, last evaluation date, and whether the flag is archived or still active.
For each stale flag, FlagShark creates a pull request that removes the SDK call, eliminates the dead code branch, and preserves the winning path. Every PR includes a before/after diff you can review.
Flagsmith's Go client returns feature values as `interface{}`, requiring type assertions — when you inline the value during cleanup, make sure to use the correctly typed literal so the Go compiler doesn't reject the diff.
Grep misses flags behind abstractions. AST-level scanning catches SDK calls that regex can't.
Every cleanup goes through code review. No surprises, no broken builds.
Only flags at 100% rollout for your configured threshold are suggested for removal.
New stale flags are detected automatically. Your codebase stays clean without manual audits.
has_feature()get_value()get_trait()Plus custom patterns you define in .flagshark.yaml
FlagShark walks your Go AST looking for calls to `IsFeatureEnabled`, `GetFeatureValue`, and `HasFeature` on the Flagsmith client. It follows the flags object returned by `GetEnvironmentFlags()` through variable assignments.
Yes. FlagShark reads the current remote config value from your Flagsmith environment and inlines the correctly-typed Go literal in the cleanup diff, handling the type assertion removal automatically.
FlagShark detects `GetIdentityFlags` calls and identity-specific overrides. It warns when per-identity values differ from the default environment value.
Connect your repo, see stale flags in minutes, and get cleanup PRs automatically.
Free tier available • No credit card required • 5-minute setup
How to find, evaluate, and remove unused LaunchDarkly feature flags from Go microservices and CLI tools.
Identify and safely remove stale Split.io treatments from Go services using AST-based analysis.
Systematically identify and remove stale Unleash toggles from Go services and CLI applications.
Identify and remove unused PostHog feature flags from Go HTTP services and background workers.