x/tools/go/analysis/passes/nilness: detect wrapping of nil errors #32808
Comments
Currently the I don't know if any of this is a good idea or not. @matloob, @ianthehat, @alandonovan, your thoughts? |
The nilness check could be made to return a result value to other analyses through which they could query whether a function call argument is nil. The Printf checker (and others) could then use it to refine their heuristics. However, that would make the printf check depend on nilness, and the standard vet contains only the watered-down nilfunc check, not full nilness, because the latter depends on golang.org/x/tools/go/ssa, which is more expensive to compute. We could evaluate whether the benefit of better checks exceeds the cost of computing full SSA. |
As of
4874f863
, thenilness
check doesn't seem to trigger onfmt.Errorf
calls with an error that is proven nil. Example:Same with the
%v
verb. I feel like most people would not want to actually produce anothing: <nil>
or anothing: %!w(<nil>)
message here.Inspired by dominikh/go-tools#529.
The text was updated successfully, but these errors were encountered: