Comments (3)
To be honest I am inclined to remove the check. It does catch some unnecessary allocations, but so do go test
and pprof... staticcheck, on the other hand, is a bit zealous about it, and has no way of telling if the allocations are really an issue or not (and we will not add annotations to teach it).
/cc @bradleyfalzon who implemented the check
/cc @dgryski who has experience with the check on an internal code base and could tell us how useful the check was
from go-tools.
Certainly if there's false positive, IMHO staticcheck should not continue the check, especially if it doesn't catch a major bug.
However, as the check is already marked as dubious, and if it's just a matter of excluding interfaces from the check, it looks straight forward to add an if condition (or add to the existing) checking the argument is not an interface using !types.IsInterface(arg.Value.Value.Type())
or similar, I'd be happy to PR that.
But it's then up to @dominikh if he wants to continue maintaining this.
For the record, implemented via dominikh/go-staticcheck#11 and discussed in dominikh/go-staticcheck#10 but the go vet inclusion discussion has more information golang/go#16311.
from go-tools.
I'll close this issue. The reported bug has been fixed, and we'll keep the check for now.
from go-tools.
Related Issues (20)
- Merging results doesn't propagate the same exit status HOT 2
- `net.IP(req.RemoteAddr)` instead of `net.ParseIP(req.RemoteAddr)`
- panic in quickfix.CheckDeMorgan
- Detect struct fields that should be local variables
- Struct field that gets set but never read should be marked unused HOT 2
- simple: S1008 suggests to remove comments from if()s that are specifically written to make a comment stand out
- confusing error message with SA5001
- Issue with StyleCheck HOT 1
- Question about SA9001 HOT 3
- new check: Err from initialization statement not used HOT 1
- Support GOEXPERIMENT=rangefunc HOT 3
- `go test` fails with go `1.22.0` HOT 3
- latest release binaries panic with Go 1.22.0 HOT 13
- S1005 should not suggest changing a channel receive expression HOT 2
- Nil pointer dereference panic in go/ir/create.go:54 HOT 8
- Unused function parameters HOT 2
- False SA6000 when regex inside switch inside range HOT 2
- aggressive: []byte from netip.Addr.AsSlice should not be printed with %s
- SA1029 not reporting when using empty struct as context key.
- Support Go 1.22.1 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-tools.