-
Notifications
You must be signed in to change notification settings - Fork 109
Fix build failure on Go 1.24.6 #1007
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 `fmt.Errorf` with `errors.New` in multiple files for error returns - Fix incorrect string concatenation in `fmt.Errorf` within service_trigger/service.go; use proper formatting parameters instead --- fix: 修复go 1.24.6 版本编译失败问题 - 将多个文件中错误返回由 fmt.Errorf 改为 errors.New - 修正 service_trigger/service.go 中 fmt.Errorf 格式化字符串拼接错误,改为正确的格式化参数传入 Log: 修复go 1.24.6 版本编译失败问题 Influence: 无
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR fixes Go 1.24.6 build issues by replacing inappropriate uses of fmt.Errorf with errors.New where no formatting is needed, and by correcting a misconstructed fmt.Errorf call in the service trigger logic. Flow diagram for doAction command execution and error handlingflowchart TD
A[doAction cmd] --> B[exec.Command /bin/sh -c cmd]
B --> C[CombinedOutput]
C --> D{err != nil}
D -- yes --> E[Create error with errors.New using command output]
E --> F[Return error]
D -- no --> G[Return nil]
Flow diagram for Service.check monitor type validationflowchart TD
A[Service.check] --> B{service.Monitor.Type != DBus}
B -- yes --> C[Return error using fmt.Errorf with format string and Monitor.Type]
B -- no --> D{service.Monitor.Type == DBus}
D -- yes --> E[Continue DBus-specific checks]
D -- no --> F[End]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review这段代码diff主要涉及了Go语言中错误处理方式的调整以及字符串格式化的问题。以下是对每个文件的详细审查和改进建议: 1.
|
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.
Hey - I've left some high level feedback:
- In both
doActionhelpers, consider including the originalerrfromexec.Command(e.g., viafmt.Errorf("%s: %w", out, err)) so callers get both the command output and the underlying failure cause instead of losing that context. - In
Service.check, since theMonitor.Type != "DBus"branch already returns, the subsequentif service.Monitor.Type == "DBus"can be simplified to anelsefor slightly clearer control flow.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In both `doAction` helpers, consider including the original `err` from `exec.Command` (e.g., via `fmt.Errorf("%s: %w", out, err)`) so callers get both the command output and the underlying failure cause instead of losing that context.
- In `Service.check`, since the `Monitor.Type != "DBus"` branch already returns, the subsequent `if service.Monitor.Type == "DBus"` can be simplified to an `else` for slightly clearer control flow.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: electricface, fly602 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
fmt.Errorfwitherrors.Newin multiple files forerror returns
fmt.Errorfwithinservice_trigger/service.go; use proper formatting parameters instead
fix: 修复go 1.24.6 版本编译失败问题
格式化字符串拼接错误,改为正确的格式化参数传入
Log: 修复go 1.24.6 版本编译失败问题
Influence: 无
Summary by Sourcery
Fix error construction and formatting to resolve compilation issues with newer Go versions.
Bug Fixes: