Skip to content

Conversation

@hieblmi
Copy link
Collaborator

@hieblmi hieblmi commented Dec 11, 2025

fixes issues found with staticcheck

- Update assets/client.go to use grpc.NewClient
- Update swap_server_client.go to use grpc.NewClient
- Replace grpc.WithInsecure() with insecure.NewCredentials()
@hieblmi hieblmi self-assigned this Dec 11, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @hieblmi, 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 systematically addresses and resolves various issues flagged by the staticcheck linter across multiple packages. The changes primarily focus on modernizing Go code by updating deprecated functions, ensuring consistent error handling patterns, aligning with Go's naming conventions, and refactoring function signatures for improved clarity and adherence to best practices. Additionally, an obsolete file has been removed to streamline the codebase.

Highlights

  • gRPC Client Modernization: Updated gRPC client creation calls from grpc.Dial to the newer grpc.NewClient function in assets/client.go and swap_server_client.go.
  • File I/O Updates: Replaced deprecated io/ioutil functions like ioutil.ReadFile and ioutil.TempDir with their modern equivalents from the os package, such as os.ReadFile and os.TempDir().
  • Error Handling Consistency: Corrected the argument order for errors.Is calls to conform to staticcheck recommendations, changing errors.Is(context.Canceled, err) to errors.Is(err, context.Canceled).
  • Go Naming Conventions: Renamed an error variable from testPublishError to errTestPublish to align with standard Go error naming conventions (ST1012).
  • Insecure gRPC Transport: Updated the method for specifying insecure gRPC transport from grpc.WithInsecure() to grpc.WithTransportCredentials(insecure.NewCredentials()).
  • Function Signature Refactoring: Adjusted the return order of the startNewLoopIn function in loopin_test.go to place the error as the last return value, following common Go practices.
  • File Removal: Removed the uncharge_state.go file, indicating it is no longer needed.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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

@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 addresses several issues found by the staticcheck tool, including usage of deprecated functions and incorrect error handling patterns. The changes are mostly correct and improve code quality. However, I've found a critical issue where ioutil.TempDir is incorrectly replaced with os.TempDir. This could lead to the deletion of the system's temporary directory during tests, which is a significant bug. I've provided suggestions to fix this using os.MkdirTemp instead.

@hieblmi hieblmi force-pushed the minor-fixes branch 2 times, most recently from 0694cbb to 7463a3c Compare December 12, 2025 10:12
- Change return signature of startNewLoopIn from (*swapConfig, error, *loopInSwap) to (*swapConfig, *loopInSwap, error)
- Fixes ST1008: error should be returned as the last argument
- Rename testPublishError to errTestPublish (ST1012)
- Add explicit type to all constants in const groups (SA9004)
- Fixes staticcheck style warnings
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.

1 participant