Lint Group 3: Type Assertion Safety and Function Parameter Issues
Finding Count: 33 issues
Subgroup A: Unchecked Type Assertions (31 issues)
Representative Examples:
pkg/parser/virtual_fs.go:76:9: type assertion x.(*FrontmatterResult) is unchecked
pkg/workflow/dispatch_repository.go:164:3: type assertion x.(map[string]any) is unchecked
pkg/cli/jsonworkflow_to_markdown.go:455:76: type assertion x.(string) is unchecked
pkg/linters/excessivefuncparams/excessivefuncparams.go:41:9: type assertion x.(*go/ast.FuncDecl) is unchecked
- Multiple unchecked assertions in pkg/linters/* analyzer code
Fix: Replace all unchecked assertions with two-value form:
// ❌ BEFORE
value := x.(SomeType)
// ✅ AFTER
value, ok := x.(SomeType)
if !ok {
return fmt.Errorf("expected type SomeType, got %T", x)
}
Subgroup B: Function Parameter Limits
Issue:
pkg/cli/update_manifest.go:174:6: updateManifestManagedWorkflow has 9 parameters (limit: 8)
Fix: Refactor function signature to use an options struct or config parameter:
// ❌ BEFORE: 9+ parameters
func updateManifestManagedWorkflow(a, b, c, d, e, f, g, h, i string) { ... }
// ✅ AFTER: Single config struct
type UpdateConfig struct {
Param1 string
Param2 string
// ... other fields
}
func updateManifestManagedWorkflow(cfg UpdateConfig) { ... }
Subgroup C: Resource Management
Issue:
pkg/cli/workflows.go:403:13: file Close() should be deferred immediately after successful open
Fix: Add defer close immediately after successful file open:
// ❌ BEFORE
file, err := os.Open(filename)
if err != nil { ... }
// ... other code ...
file.Close()
// ✅ AFTER
file, err := os.Open(filename)
if err != nil { ... }
defer file.Close()
// ... other code ...
Remediation Checklist
Reference: See .github/skills/error-recovery-patterns/SKILL.md for error handling patterns.
Files to Edit:
- pkg/parser/virtual_fs.go
- pkg/workflow/dispatch_repository.go, compiler_jobs.go, etc.
- pkg/cli/jsonworkflow_to_markdown.go, workflows.go, update_manifest.go
- pkg/linters//.go (14 analyzer files with assertion issues)
Generated by 🧌 LintMonster · haiku45 104.8K · ◷
Lint Group 3: Type Assertion Safety and Function Parameter Issues
Finding Count: 33 issues
Subgroup A: Unchecked Type Assertions (31 issues)
Representative Examples:
pkg/parser/virtual_fs.go:76:9: type assertion x.(*FrontmatterResult) is uncheckedpkg/workflow/dispatch_repository.go:164:3: type assertion x.(map[string]any) is uncheckedpkg/cli/jsonworkflow_to_markdown.go:455:76: type assertion x.(string) is uncheckedpkg/linters/excessivefuncparams/excessivefuncparams.go:41:9: type assertion x.(*go/ast.FuncDecl) is uncheckedFix: Replace all unchecked assertions with two-value form:
Subgroup B: Function Parameter Limits
Issue:
pkg/cli/update_manifest.go:174:6: updateManifestManagedWorkflow has 9 parameters (limit: 8)Fix: Refactor function signature to use an options struct or config parameter:
Subgroup C: Resource Management
Issue:
pkg/cli/workflows.go:403:13: file Close() should be deferred immediately after successful openFix: Add defer close immediately after successful file open:
Remediation Checklist
grep 'type assertion.*is unchecked' lint-diagnostics.txtto identify all 31 assertion issuesv, ok := x.(Type)patterndefer file.Close()afteros.Open()in workflows.gomake golint-customto verify all 33 issues are resolvedReference: See
.github/skills/error-recovery-patterns/SKILL.mdfor error handling patterns.Files to Edit: