-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(tests): min go 1.23, golangci-lint 2.5.0, linter advices #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Replace all instances of `context.Background()` with `t.Context()` within the test files. This change aligns with modern Go (1.20+) testing best practices. The `t.Context()` function provides a context that is automatically canceled when the test or subtest completes. Using this context for operations like API calls ensures that they are properly terminated if the test finishes, is skipped, or times out. This improves test hygiene by preventing potential resource leaks from dangling goroutines and makes test execution more robust, especially when running with a timeout.
Summary of ChangesHello @FranciscoKurpiel, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request updates various test files to utilize Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly refactors the test files to use t.Context() instead of context.Background(). This is a good change that aligns with modern Go testing practices, improving test robustness by ensuring contexts are canceled when tests complete. The implementation is correct across all modified files. While reviewing, I noticed a pre-existing issue in one of the modified tests that could be improved, and I've left a comment with the details.
This commit updates the versions of Go and golangci-lint used in the GitHub Actions CI workflow. The Go version is bumped from 1.22 to 1.23 for both the test and linting jobs. The version of golangci-lint is also upgraded from v2.1.6 to v2.5.0. These changes ensure the project is tested and linted against the latest stable toolchain, leveraging new language features, performance improvements, and updated static analysis rules.
This pull request introduces a series of updates and improvements to the codebase, focusing on dependency updates, testing enhancements, and general code hygiene.
CI/CD
1.22to1.23. This allows us to leverage the latest features and improvements in the Go language.golangci-linthas been updated fromv2.1.6tov2.5.0. This brings in new linting rules and bug fixes, helping to improve code quality.Testing
context.Background()have been replaced witht.Context(). This is a significant improvement in our testing practices.t.Context()provides a context that is automatically canceled when the test or subtest completes, preventing resource leaks from dangling goroutines and making the tests more robust.TestUpdatefunction withinclient_test.gohas been resolved. Previously, theoriginalCommentandchangedCommentvariables were identical, meaning the test was not correctly verifying the update functionality. This has been corrected to ensure the test is effective.//nolint:copyloopvardirective has been removed from theTestConflictfunction. This is now possible due to the improved handling of loop variables in Go1.22and later.Other Changes
go.modfile has been updated to reflect the new Go version (1.23.0) and thetoolchaindirective has been removed.listzones.gohas been corrected.