Skip to content
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

Collect 10 Real World Bugs #1

Closed
alingse opened this issue Mar 16, 2024 · 1 comment
Closed

Collect 10 Real World Bugs #1

alingse opened this issue Mar 16, 2024 · 1 comment

Comments

@ldez
Copy link

ldez commented Jul 9, 2024

FYI the example you are using:

for _, n := range ns {
   rs = append(rs, n)   
   rs = append(rs, ns...)
}

The 2 lines are wrong, in this context the right code is to remove the for:

rs = append(rs, ns...)

A better example could be:

for _, n := range ns {
	if v == "value" {
		rs = append(rs, n)     // OK
		rs = append(rs, ns...) // Bug
	}
}

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

No branches or pull requests

2 participants