-
Notifications
You must be signed in to change notification settings - Fork 4
test issue 3 #150
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
test issue 3 #150
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,6 +8,14 @@ import ( | |||||||||
| "github.com/voedger/voedger/pkg/goutils/logger" | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| type badStruct struct { | ||||||||||
| ar []int | ||||||||||
| } | ||||||||||
|
|
||||||||||
| func (bs badStruct) add( i int) { | ||||||||||
| bs.ar = append(bs.ar, i) | ||||||||||
|
Comment on lines
+15
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correctness bug: value receiver makes
Also, Minimal fix — switch to a pointer receiver and remove the extra space:
Suggested change
(If the type is removed per the other comment, this one becomes moot.) |
||||||||||
| } | ||||||||||
|
Comment on lines
+11
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dead code — will fail CI (
If this was added for demonstration/testing purposes, please remove it before merging; otherwise the lint job will block the PR. If it is meant to be used, please add the call site in the same PR so the symbols stop being dead.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. explain more |
||||||||||
|
|
||||||||||
| func main() { | ||||||||||
| if _, err := cmdproc.ExecRootCmd(context.Background(), os.Args); err != nil { | ||||||||||
| logger.Verbose(err) | ||||||||||
|
|
||||||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
addhas a value receiver, so updatingbs.arwon’t update the caller’s slice header (the appended element may be lost or only show up via subtle backing-array mutation). Consider making the receiver a pointer (or otherwise returning the updated value) if the intent is to mutate the originalbadStruct.Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.