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

S1009: treats shadowed "len" function like it's the builtin #1181

Closed
dominikh opened this issue Feb 7, 2022 · 1 comment
Closed

S1009: treats shadowed "len" function like it's the builtin #1181

dominikh opened this issue Feb 7, 2022 · 1 comment

Comments

@dominikh
Copy link
Owner

dominikh commented Feb 7, 2022

package foo

func _() {
	var x []int
	len := func([]int) int { return 10 }

	if x == nil || len(x) == 0 {
	}
}

triggers S1009:

bar.go:7:5: should omit nil check; len() for nil slices is defined as zero (S1009)

It shouldn't.

@Jayesh2411

This comment was marked as duplicate.

dominikh added a commit that referenced this issue May 16, 2022
Closes gh-1181

(cherry picked from commit e3efe9b)
dominikh added a commit that referenced this issue May 16, 2022
Closes gh-1181

(cherry picked from commit e3efe9b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants