Open ccoVeille opened 5 hours ago
I already think about that.
The approach that just detects all os.CreateTemp
will lead to false positives.
So the cases should be exact to be accurate.
I have some ideas around that, but not for this first version.
You could check for
os.CreateTemp
using empty string as first parameter, will lead to callos.TempDir()
, so it can be replaced by t.TmpDirhttps://cs.opensource.google/go/go/+/refs/tags/go1.23.3:src/os/tempfile.go;l=35-38
I identified it by working on
I added myself a TODO to check if I could do it later, but I didn't. And your linter is a perfect candidate.
The pattern is widely used
https://github.com/search?q=language%3Ago+%22os.CreateTemp%28%5C%22%5C%22%22+path%3A_test.go&type=code