multi: fix staticcheck flags#1058
Conversation
Summary of ChangesHello @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 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.
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.
184a6c6 to
f1dd6fb
Compare
swap_server_client.go
Outdated
| case insec: | ||
| opts = append(opts, grpc.WithTransportCredentials( | ||
| insecure.NewCredentials(), | ||
| ), |
swap_server_client.go
Outdated
| // proxyAddr indicates that a SOCKS proxy found at the address should be used to | ||
| // establish the connection. | ||
| func getSwapServerConn(address, proxyAddress string, insecure bool, | ||
| func getSwapServerConn(address, proxyAddress string, insec bool, |
| ctx.errChan <- err | ||
| }() | ||
| return cfg, err, inSwap | ||
| return cfg, inSwap, err |
There was a problem hiding this comment.
Add an empty line before return
loopd/daemon.go
Outdated
|
|
||
| err := depositManager.Run(d.mainCtx, initChan) | ||
| if err != nil && !errors.Is(context.Canceled, err) { | ||
| if err != nil && !errors.Is(err, context.Canceled) { |
There was a problem hiding this comment.
Great catch! Can you add tests capturing errors.Is regressions in the file?
|
|
||
| // Dial the gRPC server. | ||
| conn, err := grpc.Dial(config.Host, opts...) | ||
| conn, err := grpc.NewClient(config.Host, opts...) |
There was a problem hiding this comment.
Some grpc.Dial calls still live in looprpc/client.pb.gw.go
We can bump protobuf deps and run make rpc to fix that.
There was a problem hiding this comment.
That's a great catch!
There was a problem hiding this comment.
updated the protobuf dependency, but a single occurrence remains, due to backward-compat issues.
43c8aa7 to
1754b52
Compare
- Update assets/client.go to use grpc.NewClient - Update swap_server_client.go to use grpc.NewClient - Replace grpc.WithInsecure() with insecure.NewCredentials()
- 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
fixes issues found with staticcheck