Skip to content

estimate: ignore some modules based on a blocklist #274

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions estimate.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ import (
// majorVersionRegexp checks if an import path contains a major version suffix.
var majorVersionRegexp = regexp.MustCompile(`([/.])v([0-9]+)$`)

// moduleBlocklist is a map of modules that we want to exclude from the estimate
// output, associated with the reason why.
var moduleBlocklist = map[string]string{
"github.com/arduino/go-win32-utils": "Windows only",
"github.com/Microsoft/go-winio": "Windows only",
}

func get(gopath, repodir, repo, rev string) error {
done := make(chan struct{})
defer close(done)
Expand Down Expand Up @@ -230,6 +237,11 @@ func estimate(importpath, revision string) error {
return
}
}
// Ignore modules from the blocklist.
if reason, found := moduleBlocklist[mod]; found {
log.Printf("Ignoring module %s: %s", mod, reason)
return
}
line := strings.Repeat(" ", indent)
if rrseen[repoRoot] {
line += fmt.Sprintf("\033[90m%s\033[0m", mod)
Expand Down