Skip to content

Conversation

erka
Copy link
Contributor

@erka erka commented Sep 15, 2025

This PR

  • upgrade golangci-lint to v2
  • address minor issues reported by updated linters

Related Issues

Notes

The motivation is to keep the same version and configuration of golangci-lint between the go-sdk and go-sdk-contrib repositories.

Some linters and rules have been temporarily disabled to simplify the upgrade process and will be re-enabled separately.

Blocked by #744

Signed-off-by: Roman Dmytrenko <[email protected]>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @erka, 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 focuses on a significant infrastructure update by upgrading the golangci-lint tool to its second major version. This upgrade ensures the project maintains up-to-date static analysis capabilities and promotes consistency with other related repositories. Beyond the linter upgrade, the changes encompass a series of code quality improvements, refactorings, and enhanced error handling practices across various provider implementations, contributing to a more robust and maintainable codebase.

Highlights

  • Linter Upgrade: Upgraded golangci-lint to version 2, including a complete rewrite of the .golangci.yaml configuration to align with the new version's structure and features. This involved enabling a curated set of linters and temporarily disabling others for a smoother transition.
  • Build Process Updates: Modified the Makefile to correctly install and execute the new golangci-lint version, utilizing new variables for version management and adjusting the execution path from GOPATH to GOROOT.
  • Code Quality & Readability Improvements: Addressed various linter-reported issues across multiple provider packages. This includes refactoring if-else chains into switch statements for enhanced readability, adding _ = to ignore return values from Close() methods to satisfy error-checking linters, and updating comments for improved clarity.
  • Error Handling Enhancements: Improved error handling in several areas, such as adding require.NoError(t, err) and require.Error(t, err) in test files, and logging errors when closing response bodies in HTTP-related utilities.
  • Code Cleanup: Removed unused functions (e.g., toStr in providers/prefab) and added //nolint unused comments to fields that are intentionally unused but kept for future functionality, reducing code clutter and suppressing linter warnings.
Using Gemini Code Assist

The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 successfully upgrades golangci-lint to v2 and addresses the linter issues found in the codebase. The changes are mostly small fixes, such as handling unchecked errors, removing unused code, and applying stylistic improvements, which enhance code quality. The refactoring of if-else chains to switch statements and the improvements to test files (e.g., using go:embed) are also positive changes.

I've identified one critical issue in the Makefile that will break the lint command, and a medium-severity suggestion to reduce code duplication. After addressing the critical issue, this PR will be in great shape.

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.