Daily Lint Remediation
Custom linter identified 85 instances where map[string]bool is used as a set but should use map[string]struct{} to reduce memory overhead.
Distribution
Performance Impact
- Each
bool entry allocates memory unnecessarily (1 byte minimum)
map[string]struct{} uses 0 bytes per value, only key memory
- Recommended change is low-risk, high-signal fix
- No behavior changes, only memory layout optimization
Affected Patterns
Search pattern: map[string]bool "<name>" used as a set
Common variable names:
- Tracking:
seen, visited, processed, handledPaths
- Allowlists/denylists:
allowed, enabled, valid, existing
- Registries:
knownTools, knownFields, enabledSet
Remediation Strategy
-
Identify all map[string]bool variable declarations used exclusively with:
m[key] = true assignments
delete(m, key) deletions
if m[key] checks
-
Replace with map[string]struct{}
- Update declarations:
map[string]struct{}{}
- Update assignments:
m[key] = struct{}{}
- Keep checks unchanged:
if m[key]
-
Validate linting passes: make golint-custom
Codemod Candidate
This refactoring is ideal for automated codemods. Consider implementing if this becomes a recurring pattern.
Current finding count: 85 instances
Generated by 🧌 LintMonster · 151.7 AIC · ⌖ 4.43 AIC · ⊞ 20.3K · ◷
Daily Lint Remediation
Custom linter identified 85 instances where
map[string]boolis used as a set but should usemap[string]struct{}to reduce memory overhead.Distribution
pkg/workflow/ (45+ instances)
safe_update_manifest.go: 3 instancesshell.go: 1 instancetools_parser.go: 2 instancespkg/cli/ (35+ instances)
engine_secrets.go: 1 instancecodemod_*.go: Multiple instancespkg/linters/ (5 instances)
ssljson.go: 2 instancesPerformance Impact
boolentry allocates memory unnecessarily (1 byte minimum)map[string]struct{}uses 0 bytes per value, only key memoryAffected Patterns
Search pattern:
map[string]bool "<name>" used as a setCommon variable names:
seen,visited,processed,handledPathsallowed,enabled,valid,existingknownTools,knownFields,enabledSetRemediation Strategy
Identify all
map[string]boolvariable declarations used exclusively with:m[key] = trueassignmentsdelete(m, key)deletionsif m[key]checksReplace with
map[string]struct{}map[string]struct{}{}m[key] = struct{}{}if m[key]Validate linting passes:
make golint-customCodemod Candidate
This refactoring is ideal for automated codemods. Consider implementing if this becomes a recurring pattern.
Current finding count: 85 instances