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

chore(internal/apidiff): fix incompat check retry #4094

Merged
merged 2 commits into from
May 12, 2021
Merged
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
8 changes: 7 additions & 1 deletion internal/apidiff/apidiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ const rootMod = "cloud.google.com/go"

var repoMetadataPath string
var verbose bool
var gapic string

func init() {
flag.StringVar(&repoMetadataPath, "repo-metadata", "", "path to a repo-metadata-full JSON file [required]")
flag.StringVar(&gapic, "gapic", "", "import path of a specific GAPIC to diff")
flag.BoolVar(&verbose, "verbose", false, "enable verbose command logging")
}

Expand Down Expand Up @@ -126,6 +128,10 @@ func diffModules(root, baseDir string, m manifest) (map[string]string, map[strin
issues := map[string]error{}

for imp, entry := range m {
if gapic != "" && imp != gapic {
continue
}

// Prepare module directory paths relative to the repo root.
pkg := strings.TrimPrefix(imp, rootMod+"/")
baseModDir := baseDir
Expand Down Expand Up @@ -205,7 +211,7 @@ func diff(m manifest, modDir, imp, pkg, base string) (string, error) {
if err := cd(parent); err != nil {
return "", err
}
out, err = exec("apidiff", "-w", base, imp)
out, err = exec("apidiff", "-incompatible", base, imp)
if err != nil {
return "", fmt.Errorf("%s: %s", err, out)
}
Expand Down