x/tools/go/analysis/singlechecker: don't use flag.CommandLine #30231
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Using package
flag
's global flagset is convenient, but shouldn't happen in packages likesinglechecker
andunitchecker
which may be used in many different ways.In particular, lots of packages like to abuse the same global flagset, such as
testing
andnet/http/pprof
, among many others outside the standard library.Granted that a linter should generally not import those packages to begin with. But sometimes you just can't control your dependencies. And there's the case which I hit - I'm running my tool as part of a test, so
testing
is in the build import graph. So one of my tests is failing as the testing flags are getting mixed into the usage output.I presume we could have
unitchecker
export a global flagset, andsinglechecker
could use it too.The text was updated successfully, but these errors were encountered: