Proposal Details
Similar in spirit to proposal #20803 (for the go compiler), and related to #63689, #14972, and #20148.
I recently lost time on a subtle bug where I forgot to use the result of a function. I tried to simplify the issue to a minimal example:
func f(x float64) float64 {
math.Sqrt(16.0) // No warning!?
return x + 1.0
}
Currently, go vet will only catch this if I list -unusedfuncs=math.Sqrt. But I would only add math.Sqrt if I already knew about the bug, which defies the go vet purpose. I would like to pass all my projects functions/methods and its dependencies (including standard library) to -unusedfuncs.
Instead, can we have an alternative flag -unusedignorefuncs (or something else) where one can pass a "blacklist", and every other function whose results are unused are reported back ? (maybe with some defaults, like fmt.Printf) ?
I understand a similar point is being made for the compiler (and extra syntax?) in proposal #20803.
Having a "blacklist" option to go vet could also be an intermediary solution for that proposal -- for those using go vet systematically.
Proposal Details
Similar in spirit to proposal #20803 (for the go compiler), and related to #63689, #14972, and #20148.
I recently lost time on a subtle bug where I forgot to use the result of a function. I tried to simplify the issue to a minimal example:
Currently,
go vetwill only catch this if I list-unusedfuncs=math.Sqrt. But I would only addmath.Sqrtif I already knew about the bug, which defies thego vetpurpose. I would like to pass all my projects functions/methods and its dependencies (including standard library) to-unusedfuncs.Instead, can we have an alternative flag
-unusedignorefuncs(or something else) where one can pass a "blacklist", and every other function whose results are unused are reported back ? (maybe with some defaults, likefmt.Printf) ?I understand a similar point is being made for the compiler (and extra syntax?) in proposal #20803.
Having a "blacklist" option to
go vetcould also be an intermediary solution for that proposal -- for those usinggo vetsystematically.