Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider GitHub repositories where the Go module isn't at the root #5

Closed
mvdan opened this issue Jan 3, 2021 · 0 comments
Closed

Comments

@mvdan
Copy link
Owner

mvdan commented Jan 3, 2021

We use GitHub's GraphQL API, which is great for querying 100 repositories at a time while getting the contents of HEAD:go.mod at the same time. This is great because it lets us do the work we need in fewer API calls. GitHub limits API calls to 5k/hr, so one extra API call per repository would be very limiting.

This brings us a problem, though - HEAD:go.mod simply looks for the go.mod file in the root directory of the default branch. If a repository has the go.mod file elsewhere, such as pkg/go.mod or projectname/go.mod, we won't find it and we'll discard the repository as not being a Go module.

The solution might be to do an extra API call to do a file search for go.mod files in the repositories which do not contain a root go.mod file. If that results in exactly one go.mod file and it's not part of a vendored module, we use it. This might be okay, given that only a small portion of Go repositories lack a root go.mod file.

@mvdan mvdan closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant