Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Can't scan directory starting with a underscore #32

Open
irotem opened this issue Aug 31, 2021 · 2 comments
Open

Can't scan directory starting with a underscore #32

irotem opened this issue Aug 31, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@irotem
Copy link

irotem commented Aug 31, 2021

In our cicd environment we dump the src code into /_src

When trying to scan with gokart on /_src it fails

@michaelweber michaelweber added the bug Something isn't working label Aug 31, 2021
@michaelweber
Copy link
Collaborator

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

@irotem
Copy link
Author

irotem commented Sep 30, 2021

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 :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants