Skip to content

fix: lint and tests#6

Merged
krakenhavoc merged 1 commit intomainfrom
bugfix/lint-and-test
Mar 20, 2026
Merged

fix: lint and tests#6
krakenhavoc merged 1 commit intomainfrom
bugfix/lint-and-test

Conversation

@krakenhavoc
Copy link
Contributor

This pull request focuses on improving error handling and code quality throughout the codebase, especially in test files and server shutdown logic. It also introduces a pre-commit configuration to enforce code linting and testing standards. The main themes are enhanced error checking, better resource cleanup, and improved maintainability.

Error handling improvements:

  • Added error checks for os.WriteFile in multiple test cases in internal/config/config_test.go and internal/state/state_test.go, causing tests to fail if file writing fails. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]
  • Wrapped JSON encoding/decoding and HTTP write operations with error handling or ignored errors where appropriate to prevent unhandled errors in both application and test code (internal/health/health.go, internal/health/health_test.go, internal/reporter/reporter_test.go, internal/scanner/scanner_test.go, internal/scheduler/scheduler_test.go). [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
  • Improved server shutdown logic in cmd/probe/main.go by logging errors if the health server fails to shut down cleanly.

Pre-commit hooks and code quality:

  • Added a .pre-commit-config.yaml file to enforce Go linting with golangci-lint and to run tests automatically before commits, helping maintain code quality and catch issues early.

@krakenhavoc krakenhavoc merged commit 7382d86 into main Mar 20, 2026
6 checks passed
@krakenhavoc krakenhavoc deleted the bugfix/lint-and-test branch March 20, 2026 18:06
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