Skip to content

test issue 3#150

Closed
host6 wants to merge 1 commit into
untillpro:mainfrom
host6:test-issue-3-pr
Closed

test issue 3#150
host6 wants to merge 1 commit into
untillpro:mainfrom
host6:test-issue-3-pr

Conversation

@host6

@host6 host6 commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

test issue 3

@augmentcode

augmentcode Bot commented Jun 10, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Adds a new badStruct type with an add helper that appends integers to an internal slice.
Context: No changes to the existing main() command execution path; this looks like a small test/demo change.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread qs.go
}

func (bs badStruct) add( i int) {
bs.ar = append(bs.ar, i)

@augmentcode augmentcode Bot Jun 10, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

add has a value receiver, so updating bs.ar won’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 original badStruct.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Deep Reviewer summary

Findings on this diff (1 file, +8/-0):

  • 1 × correctness (high): value-receiver append is a no-op for callers.
  • 1 × formatting (low): stray space inside parameter list — gofmt violation.
  • 1 × dead code (medium): unused type/method will fail unused/revive/staticcheck per .golangci.yml.

Overall verdict: request changes recommended before merge. CI (golangci-lint) will fail on the unused symbols and on the gofmt issue, and the method as written is silently broken even if it ever gets called.

Comment thread qs.go
Comment on lines +11 to +17
type badStruct struct {
ar []int
}

func (bs badStruct) add( i int) {
bs.ar = append(bs.ar, i)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Dead code — will fail CI (unused / revive / staticcheck).

badStruct and its method add are not referenced anywhere in the package (this file is the package main entrypoint and only calls cmdproc.ExecRootCmd). The repository's .golangci.yml enables unused, revive, and staticcheck (with all checks), all of which will flag this as U1000/unused-parameter/etc.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

explain more

Comment thread qs.go
Comment on lines +15 to +16
func (bs badStruct) add( i int) {
bs.ar = append(bs.ar, i)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Correctness bug: value receiver makes append invisible to the caller.

add has a value receiver (bs badStruct), so bs is a copy of the caller's struct. append may return a slice with a new length (and potentially a new backing array); assigning it to bs.ar only mutates the local copy. The caller's badStruct.ar is never updated — the method is a silent no-op from the caller's perspective.

Also, add( i int) has a stray space after (, which gofmt will reject (and the repo's formatter check enforces this).

Minimal fix — switch to a pointer receiver and remove the extra space:

Suggested change
func (bs badStruct) add( i int) {
bs.ar = append(bs.ar, i)
func (bs *badStruct) add(i int) {
bs.ar = append(bs.ar, i)

(If the type is removed per the other comment, this one becomes moot.)

@host6

host6 commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

explain more

@host6 host6 closed this Jun 10, 2026
@host6
host6 deleted the test-issue-3-pr branch June 11, 2026 07:23
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