Conversation
Member
appleboy
commented
Feb 27, 2026
- Refactor file locking parameters into top-level constants in filelock.go for improved maintainability.
- Replace duplicated error handling durations and retry settings with reusable constants in file locking logic.
- Update for-loops to use range-based iteration on integer variables for better Go style in tests and concurrency code.
- Replace usage of fmt.Errorf with errors.New for static error strings.
- Prefer named http.Method* constants over string literals for HTTP methods in main.go and tests.
- Use map[string]any instead of map[string]interface{} for type declarations.
- Add and fine-tune multiple linters and their configurations in .golangci.yml; introduce new linter settings and rules, improve output formatting, and remove several linters no longer used.
- Update comments or linter ignore statements for greater clarity.
- Use a min() helper rather than manual interval capping in polling logic.
- Refactor file locking parameters into top-level constants in filelock.go for improved maintainability.
- Replace duplicated error handling durations and retry settings with reusable constants in file locking logic.
- Update for-loops to use range-based iteration on integer variables for better Go style in tests and concurrency code.
- Replace usage of fmt.Errorf with errors.New for static error strings.
- Prefer named http.Method* constants over string literals for HTTP methods in main.go and tests.
- Use map[string]any instead of map[string]interface{} for type declarations.
- Add and fine-tune multiple linters and their configurations in .golangci.yml; introduce new linter settings and rules, improve output formatting, and remove several linters no longer used.
- Update comments or linter ignore statements for greater clarity.
- Use a min() helper rather than manual interval capping in polling logic.
Signed-off-by: appleboy <appleboy.tw@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR applies comprehensive code style and linter improvements across the Go codebase, modernizing the code to use Go 1.22+ features and enforcing consistent patterns through enhanced linter configuration.
Changes:
- Extracted magic numbers and durations in file locking logic into top-level constants for better maintainability
- Replaced fmt.Errorf with errors.New for static error strings to improve efficiency and semantic clarity
- Updated HTTP method calls to use named http.Method* constants instead of string literals
- Modernized for-loops to use Go 1.22+ range-based iteration over integers
- Replaced map[string]interface{} with map[string]any throughout test files
- Replaced manual interval capping logic with the builtin min() helper function
- Enhanced .golangci.yml with additional linters (modernize, usestdlibvars, revive, etc.) and stricter nolint requirements
- Added explanation to nolint directive for improved documentation
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| filelock.go | Extracted lock retry and timeout parameters into top-level constants; converted loop to use range-based iteration |
| main.go | Replaced fmt.Errorf with errors.New for static strings; updated HTTP methods to use constants; simplified interval capping with min() |
| main_test.go | Replaced map[string]interface{} with map[string]any; converted loops to range-based iteration; added explanation to nolint comment |
| polling_test.go | Replaced map[string]interface{} with map[string]any; updated HTTP method check to use constant |
| filelock_test.go | Converted loop to use range-based iteration |
| .golangci.yml | Added multiple linters (bidichk, modernize, usestdlibvars, revive, etc.); configured stricter nolint rules requiring explanations; removed unused linters; added timeout configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.