Skip to content

Add PR checks for test, lint, and format#7

Merged
melonattacker merged 2 commits into
mainfrom
ci/test-workflow
May 11, 2026
Merged

Add PR checks for test, lint, and format#7
melonattacker merged 2 commits into
mainfrom
ci/test-workflow

Conversation

@melonattacker
Copy link
Copy Markdown
Owner

@melonattacker melonattacker commented May 10, 2026

This pull request introduces several improvements focused on code safety, resource management, and developer tooling. The most significant changes are the addition of GitHub Actions workflows for CI checks, stricter error handling and resource cleanup, and enhanced static analysis and linting. These updates help ensure code reliability, maintainability, and adherence to Go best practices.

CI/CD and Developer Tooling:

  • Added a new GitHub Actions workflow (.github/workflows/pr-checks.yml) to automatically check Go formatting, run tests, and perform linting on pull requests to main. This helps catch issues early in the development process.
  • Introduced a .golangci.yml configuration to enable and configure a strict set of linters, improving code quality and consistency.

Resource Management and Error Handling:

  • Replaced direct resource closing (e.g., Close()) with error-checked or ignored closures (e.g., _ = rdr.Close(), or using defer func() { _ = f.Close() }()) across multiple files, ensuring potential errors are handled or intentionally ignored as appropriate. [1] [2] [3] [4] [5] [6] [7] [8] [9]
  • Updated error formatting and handling, such as using %w for error wrapping, checking errors with errors.Is, and consistent error returns. [1] [2]

Security and Code Quality:

  • Added //nolint:gosec annotations with justifications at specific lines to document intentional exceptions to security linter warnings. [1] [2] [3] [4] [5] [6] [7] [8]
  • Improved help and usage output functions to consistently check for errors when writing to output streams.

CLI Output Consistency:

  • Refactored CLI output in internal/cli/explain.go to use helper functions (stdoutf, stdoutln) instead of direct fmt calls, improving output handling and testability. [1] [2] [3]

These changes collectively improve the robustness, maintainability, and developer experience of the project.

@melonattacker melonattacker merged commit 30cfc47 into main May 11, 2026
3 checks passed
@melonattacker melonattacker deleted the ci/test-workflow branch May 11, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant