Skip to content

[lint-monster] Lint: Fix parameter count, context.Background, and os.Exit violations (12 findings) #33445

@github-actions

Description

@github-actions

Summary

12 findings across 3 categories:

  • 8 functions with >8 parameters (should use options struct)
  • 2 context.Background() calls (should use passed context parameter)
  • 2 os.Exit() calls in library package (should move to cmd/ entry-point)

Detailed Findings

Functions with >8 Parameters (8 findings)

Each should use an options struct:

/home/runner/work/gh-aw/gh-aw/pkg/workflow/compiler_safe_outputs_job.go:382: buildSafeOutputsJobFromParts has 9 parameters
/home/runner/work/gh-aw/gh-aw/pkg/workflow/maintenance_workflow.go:120: GenerateMaintenanceWorkflow has 9 parameters
/home/runner/work/gh-aw/gh-aw/pkg/workflow/maintenance_workflow_yaml.go:16: buildMaintenanceWorkflowYAML has 12 parameters
/home/runner/work/gh-aw/gh-aw/pkg/workflow/mcp_rendering.go:94: renderStandardJSONMCPConfig has 9 parameters
/home/runner/work/gh-aw/gh-aw/pkg/workflow/mcp_setup_generator.go:618: writeMCPGatewayExports has 12 parameters
/home/runner/work/gh-aw/gh-aw/pkg/workflow/mcp_setup_generator.go:668: buildMCPGatewayContainerCommand has 9 parameters
/home/runner/work/gh-aw/gh-aw/pkg/workflow/side_repo_maintenance.go:93: generateAllSideRepoMaintenanceWorkflows has 10 parameters
/home/runner/work/gh-aw/gh-aw/pkg/workflow/side_repo_maintenance.go:157: generateSideRepoMaintenanceWorkflow has 10 parameters

context.Background() Violations (2 findings)

Should use the passed context parameter instead:

/home/runner/work/gh-aw/gh-aw/pkg/workflow/action_resolver.go:33: use the context.Context parameter instead of context.Background()
/home/runner/work/gh-aw/gh-aw/pkg/cli/docker_images.go:55: use the context.Context parameter instead of context.Background()

os.Exit() in Library Package (2 findings)

Should be moved to cmd/ entry-point or wrapped in a way that allows testing:

/home/runner/work/gh-aw/gh-aw/pkg/cli/upgrade_command.go:201: os.Exit called in library package github.com/github/gh-aw/pkg/cli
/home/runner/work/gh-aw/gh-aw/pkg/cli/upgrade_command.go:399: os.Exit called in library package github.com/github/gh-aw/pkg/cli

Expected Outcome

All 12 findings resolved:

  • Parameter count violations use options structs
  • context.Background() replaced with context parameter
  • os.Exit() violations removed from library packages

Remediation Checklist

For Parameter Count Issues

  • Create an options struct for each function (e.g., BuildSafeOutputsJobOptions)
  • Move all parameters into struct fields
  • Update function signature to accept the options struct
  • Update all call sites to use new signature
  • Run build: make build
  • Run tests for affected modules

For context.Background() Issues

  • Review function signature to find ctx parameter
  • Replace context.Background() with ctx
  • Ensure all context calls use the passed parameter
  • Test that context cancellation works properly

For os.Exit() Issues

  • Refactor to return error instead of calling os.Exit()
  • Move os.Exit() call to cmd/ entry-point or main wrapper
  • Ensure error propagation works correctly
  • Test error handling paths

Final Validation

  • Run: make golint-custom 2>&1 | grep -E 'parameters|context.Background|os.Exit' (should be empty)
  • Run: make build
  • Run: go test -v ./pkg/workflow ./pkg/cli ./pkg/... (selective tests)

Notes

  • Options struct pattern is already used in codebase; follow existing conventions
  • Context parameter should always be the first parameter of a function
  • Library packages should not call os.Exit() - let callers decide on exit codes

Generated by 🧌 LintMonster · ● 413.8K ·

  • expires on May 27, 2026, 3:49 AM UTC

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions