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

x/exp/apidiff: does not include package path in apidiff messages #61387

Closed
maxb opened this issue Jul 16, 2023 · 2 comments
Closed

x/exp/apidiff: does not include package path in apidiff messages #61387

maxb opened this issue Jul 16, 2023 · 2 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@maxb
Copy link

maxb commented Jul 16, 2023

What did you do?

I used apidiff -m to compare the APIs of two versions of a module that contains several packages (github.com/hashicorp/vault/sdk as it happens, but this issue is not specific to any one module)

What did you expect to see?

Messages clearly identifying what had changed.

What did you see instead?

Each type or function that had changed was listed, but without the package path within the module. It was necessary to see the base name, and then go hunting within the code of the module to figure out which package it was in. When used on a large module containing many packages, this greatly decreases the value of the apidiff report.

Proposal to fix

When apidiff is used in single package mode, it is reasonable for it to continue as before, and just display type base names.

When apidiff is used in module mode, and is displaying diffs for types in the root package of the module (i.e. package-path == module-path), it is also reasonable for it to continue as before.

When apidiff is used in module mode and is displaying diffs for a type in a sub-package within the module, it should display them with a ./relative/path/to/package. prefix on the type name.

example:

When using apidiff -m to compare versions of github.com/hashicorp/vault/sdk, and the field DisplayNavigation has been removed from the struct OASPathItem in package github.com/hashicorp/vault/sdk/framework, the displayed output should change from:

- OASPathItem.DisplayNavigation: removed

to

- ./framework.OASPathItem.DisplayNavigation: removed

I have code to implement this ready to upload once I figure out CLA & Gerrit, but meanwhile would appreciate comments on the idea.

@gopherbot gopherbot added this to the Unreleased milestone Jul 16, 2023
@seankhliao seankhliao changed the title x/exp/apidiff: Does not include package path in apidiff messages x/exp/apidiff: does not include package path in apidiff messages Jul 17, 2023
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 17, 2023
@gopherbot
Copy link

Change https://go.dev/cl/512295 mentions this issue: x/exp/apidiff: add package path to change messages

@maxb
Copy link
Author

maxb commented Jul 23, 2023

I have code to implement this ready to upload once I figure out CLA & Gerrit

Now uploaded, per gopherbot's link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants