depguard cannot blacklist toplevel imports (clearify what includeGoRoot does)
howardjohn opened this issue · comments
I want the following config:
{
"type": "blacklist",
"packages": [
"testing"
]
}
To block users from importing testing packages into our main code, which bloats the flags we have in our binaries. However depguard seems to ignore these blacklists. If I put any builtins like testing
or strings
, depguard will not reject them, but other packages like github.com/davecgh/go-spew/spew
are accepted
Nevermind I misunderstood includeGoRoot
Thanks for responding back with the solution. Just for interest of making it better, is there a better term/config I could use as an alias to help clarify what it does?
I somehow thought that this meant it would be running against the actual standard lib code (not sure why that would ever make sense 🙂) rather than including the std lib as part of the imports. includeGoStdLib
maybe slightly more understandable (to me, at least), but probably not worth it.
I wonder if its possible to just fail if they provide something in the stdlib and have includeGoRoot
set to false?
I don't like the failing bit, but a warning message may be nice. I'll change this to a feature request then. And adding an alias for includeGoStdLib
to do what includeGoRoot
should not be too hard to do.