Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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.

Signed-off-by: Roman Dmytrenko <rdmytrenko@gmail.com>
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.

logger *slog.Logger
publishEvents bool
metadata *of.Metadata
metadata *of.Metadata //nolint unused
Copy link
Member

Choose a reason for hiding this comment

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

if it is unused should we keep the configuration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That’s a good point. Since the multi-provider has been re-implemented in the go-sdk, it probably doesn’t matter much now as it will be removed soon.

Comment on lines 8 to +11
// EnvironmentNames []string
// ProjectEnvID int64
// InitializationTimeoutSeconds float64
// OnInitializationFailure OnInitializationFailure
//nolint OnInitializationFailure OnInitializationFailure
Copy link
Member

Choose a reason for hiding this comment

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

Should we keep this if it is unused ?

Copy link
Contributor Author

@erka erka Oct 15, 2025

Choose a reason for hiding this comment

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

this is dupword. I don't want to remove it as I have no idea why those comments are there.

err = of.SetProviderAndWait(provider)
if err != nil {
fmt.Printf("Error during provider set: %v\n", err)
os.Exit(1)
Copy link
Member

@thomaspoignant thomaspoignant Oct 15, 2025

Choose a reason for hiding this comment

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

Do we really want to crash the test with os.Exit ?
It will probably better to assert here rather than crashing the full test suite.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is TestMain(m *testing.M) and from docs

m.Run will return an exit code that may be passed to os.Exit

Copy link
Member

Choose a reason for hiding this comment

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

Ya we are also exiting above already.

Copy link
Member

@thomaspoignant thomaspoignant left a comment

Choose a reason for hiding this comment

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

It looks good to me, I am just wondering if we want to os.Exit in the tests.

if err != nil {
fmt.Printf("Error during removing backup directory: %v\n", err)
}
os.Exit(exitCode)
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is TestMain(m *testing.M).

Comment on lines +261 to +262
//go:embed demo_app_toggles.json
var appToggles []byte
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious if the linter recommended this or if you just found it.

Copy link
Contributor Author

@erka erka Oct 17, 2025

Choose a reason for hiding this comment

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

My crime 😅 I didn't want to call os.Exit.

Copy link
Member

@toddbaert toddbaert left a comment

Choose a reason for hiding this comment

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

I'll merge this tomorrow unless I hear objections.

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.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.