Closed cespare closed 1 month ago
I wonder if that first example should be flagged. Intuitively I would say that it should silence these kind of errors if you explicitly do _ = x
.
The _ = x
wasn't the important part there. You can substitute fmt.Println(x)
if you want.
This is probably #191.
Yep, looks like a duplicate of #191.
I'm on 2024.1.1 but I also checked on master.
I'm on linux/amd64 but I don't think it matters.
Here's a small program that yields no warnings in staticcheck:
I've noted two lines where a variable is written that is later unconditionally clobbered (case 1) or just never read (case 2). ISTM that SA4006 could be made to recognize these situations. Feels like it shouldn't be too difficult in an SSA-based analysis but I haven't tried implementing it so maybe it's harder than I think.