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

False positive when populating a slice through a counting for loop #138

Open
sonalmahajan15 opened this issue Nov 27, 2023 · 0 comments
Open
Labels
false positive Requires more analysis and support

Comments

@sonalmahajan15
Copy link
Contributor

NilAway reports a false positive for the below case.

func test() {
	var sl []*int
	for i := 0; i < 100; i++ {
		sl = append(sl, &i)
	}
	print(sl[:10]) // error: "unassigned variable `sl` sliced into"
}
@sonalmahajan15 sonalmahajan15 added the false positive Requires more analysis and support label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false positive Requires more analysis and support
Projects
None yet
Development

No branches or pull requests

1 participant