Loading...
Go's switch statements pair naturally with Split.io's multi-treatment model, but they also make it easy to accumulate dead treatment branches. FlagShark scans your Go AST to find every `Treatment` call and maps it against your Split definitions.
FlagShark generates a PR that removes the dead branch and keeps only the winning code path
func searchHandler(c *gin.Context) {
client := splitClient()
treatment := client.Treatment(c.GetString("userId"), "search-version", nil)
switch treatment {
case "v3":
results := searchV3(c.Query("q"))
c.JSON(200, results)
case "v2":
results := searchV2(c.Query("q"))
c.JSON(200, results)
default:
results := searchV1(c.Query("q"))
c.JSON(200, results)
}
}func searchHandler(c *gin.Context) {
results := searchV3(c.Query("q"))
c.JSON(200, results)
}FlagShark uses go/ast package for type-safe detection of SDK usage patterns to find every call to getTreatment(), getTreatments(), track()across your Gin, Echo, standard library codebase.
Each detected flag key is matched against your Split.io 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.
Go's strict unused-import rule means removing the Split SDK calls may trigger a compile error if `splitio` is no longer imported anywhere — FlagShark automatically cleans up orphaned imports in its generated diffs.
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.
getTreatment()getTreatments()track()Plus custom patterns you define in .flagshark.yaml
FlagShark walks your Go AST looking for method calls on the Split client (`.Treatment()`, `.Treatments()`, `.Track()`) and follows the client through function parameters and struct fields.
Yes — switch/case is the idiomatic Go pattern for multi-treatment flags and FlagShark specifically optimizes for it. It identifies the winning case, removes the dead cases, and simplifies the switch into a direct call when only one treatment remains.
FlagShark tracks the Split factory and client lifecycle. When all flags from a Split environment are removed, it flags the factory initialization and `client.Destroy()` calls for cleanup too.
Connect your repo, see stale flags in minutes, and get cleanup PRs automatically.
Free tier available • No credit card required • 5-minute setup
Detect and remove abandoned Split.io treatments from your TypeScript frontend and Node.js backend.
Find and clean up stale Split.io feature flag treatments in Django, FastAPI, and Flask projects.
Systematically find and remove stale Split.io treatments from Spring Boot and Micronaut applications.
Detect and clean up stale Split.io feature flags in Rails and Sinatra applications.
How to find, evaluate, and remove unused LaunchDarkly feature flags from Go microservices and CLI tools.
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.
Find and remove dead Flagsmith feature flags from Go web services and CLI applications.