Conversation
Member
appleboy
commented
Feb 24, 2026
- Update linter configuration with new linters and settings, and remove deprecated ones
- Add detailed linter rules and formatter settings to the configuration
- Change error creation from fmt.Errorf to errors.New throughout the codebase
- Replace map[string]interface{} with map[string]any for improved type clarity
- Replace for loops of the form for i := 0; i < n; i++ with for i := range n for better idiomatic Go
- Simplify timer and polling interval calculations using min/max functions
- Use strconv.Itoa instead of fmt.Sprintf for integer to string conversion
- Use t.Setenv in tests to manage environment variables instead of os.Setenv
- Remove manual environment restoration in tests for improved reliability
- Concatenate strings directly instead of using fmt.Sprintf where possible
- Minor improvements to test comments for clarity
…dates
- Update linter configuration with new linters and settings, and remove deprecated ones
- Add detailed linter rules and formatter settings to the configuration
- Change error creation from fmt.Errorf to errors.New throughout the codebase
- Replace map[string]interface{} with map[string]any for improved type clarity
- Replace for loops of the form for i := 0; i < n; i++ with for i := range n for better idiomatic Go
- Simplify timer and polling interval calculations using min/max functions
- Use strconv.Itoa instead of fmt.Sprintf for integer to string conversion
- Use t.Setenv in tests to manage environment variables instead of os.Setenv
- Remove manual environment restoration in tests for improved reliability
- Concatenate strings directly instead of using fmt.Sprintf where possible
- Minor improvements to test comments for clarity
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR modernizes the codebase to follow idiomatic Go patterns and updates the linter configuration with new rules. The changes include replacing verbose constructs with cleaner alternatives introduced in recent Go versions, improving error handling consistency, and enhancing test reliability through better environment variable management.
Changes:
- Updated linter configuration with modern linters and removed deprecated ones, adding detailed rules and formatter settings
- Replaced
fmt.Errorfwitherrors.Newfor static error messages throughout the codebase - Replaced
map[string]interface{}withmap[string]anyfor improved type clarity - Modernized for loops using Go 1.22+ range-over-integer syntax
- Simplified timer and polling calculations using
min/maxfunctions - Used
strconv.Itoainstead offmt.Sprintffor integer-to-string conversion - Improved test reliability by using
t.Setenvinstead of manual environment variable management - Enhanced code clarity with direct string concatenation
- Added explanatory comments to nolint directives
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| .golangci.yml | Added modern linters (modernize, perfsprint, testifylint, etc.), removed deprecated ones, and added detailed configuration for linter rules and formatters |
| Makefile | Added unset GOROOT && before golangci-lint run to avoid environment conflicts |
| userinfo.go | Replaced fmt.Errorf with errors.New for static error message |
| tokens.go | Replaced fmt.Errorf with errors.New for static error messages and error variable declarations |
| device_flow.go | Replaced fmt.Errorf with errors.New for static errors, replaced map[string]interface{} with map[string]any, and used min for polling interval calculation |
| config.go | Replaced fmt.Errorf with errors.New for validation errors and used strconv.Itoa for integer conversion |
| callback.go | Replaced fmt.Errorf with errors.New for error variable declaration |
| callback_test.go | Replaced fmt.Errorf with errors.New for static errors and added explanatory nolint comments |
| tui/messages.go | Replaced map[string]interface{} with map[string]any |
| tui/manager.go | Replaced interface{} with any |
| tui/manager_test.go | Used t.Setenv instead of manual environment variable management and replaced map[string]interface{} with map[string]any |
| tui/device_view.go | Used direct string concatenation instead of fmt.Sprintf |
| tui/device_model.go | Used direct string concatenation instead of fmt.Sprintf |
| tui/browser_view.go | Used direct string concatenation instead of fmt.Sprintf |
| tui/components/timer.go | Used max function for cleaner countdown calculation and direct string concatenation |
| polling_test.go | Replaced map[string]interface{} with map[string]any |
| main_test.go | Replaced map[string]interface{} with map[string]any, modernized for loops using range syntax, and added explanatory nolint comment |
| pkce_test.go | Modernized for loops using Go 1.22+ range-over-integer syntax |
| filelock_test.go | Modernized for loop using range syntax |
| filelock.go | Modernized for loop using range syntax when loop variable is unused |
| browser_flow.go | Replaced map[string]interface{} with map[string]any |
💡 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.