Closed silverwind closed 5 months ago
First, it's not a new behavior.
I have a minimal reproducible example:
package temp
import (
"fmt"
"os"
)
func foo() {
smoe, _ := os.Open("test") // Detected
defer smoe.Close() // Not detected
fmt.Println(smoe) // Detected
fmt.Println(smoe.Name()) // Not detected
}
$ go run ./cmd/misspell ./temp
temp/temp.go:9:1: "smoe" is a misspelling of "some"
temp/temp.go:12:13: "smoe" is a misspelling of "some"
It's a side effect/false negative of the host parsing.
Ah yes, then it's an existing bug that wasn't noticed so far.
This has been the same behavior for the past 8 years, the goal being to avoid false positives. Then those false negatives are expected.
I can improve a bit by following some basic domain name rules, but it's impossible to fully fix that without creating a regression.
Fine with me, those cases are easy enough to correct manually.
I improved hostname detection as I explained before.
Now, defer smoe.Close()
will be detected.
But defer smoe.close()
is still not detected.
I created a v0.5.1
As the problem cannot be fully fixed, I will close this issue.
Thanks, I can confirm it new replaced these missing cases, even without having reset the diff :)
Running with the
-dict
option and passingcommiter,committer
, I see the variable only got replaced once on the first occurence, instead of all occurences in go code. I think it should have replaced on line 248 too here:Is it expected?
Ref: https://github.com/go-gitea/gitea/pull/30573