gokart
gokart copied to clipboard
Can't scan directory starting with a underscore
In our cicd environment we dump the src code into /_src
When trying to scan with gokart on /_src it fails
Hey @irotem!
I dug into this one a bit, initially I thought it might have been some of our directory identification logic that was causing the issue but apparently invoking Package.Load
(the built-in Golang package loader code which we use for Gokart) with a _
at the start of your directory results in 0 packages being found. This is likely related to https://pkg.go.dev/go/build#Context.Import - which explicitly mentions that go build
will ignore certain file name patterns:
- .go files in package documentation
- files starting with _ or . (likely editor temporary files)
- files with build constraints not satisfied by the context
I just tested locally with a directory starting with .
and that also doesn't appear to scan. We intend to add more support later on that won’t have these restrictions, but for now we have to suggest using a different directory name for the base of your package when scanning.
Sorry for the inconvenience. -Mike
Thanks @michaelweber for the detailed response.. For now I am doing some black magic and linking the directory to another directory to make it work.
I guess the scanner assumes I am in a go packaging scheme. Also can make scanning monorepos problems I assume, but I need to play more with it :)