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

Is it possible to have an option to only show "added" APIs? #21

Open
tonglil opened this issue Dec 6, 2022 · 5 comments
Open

Is it possible to have an option to only show "added" APIs? #21

tonglil opened this issue Dec 6, 2022 · 5 comments

Comments

@tonglil
Copy link

tonglil commented Dec 6, 2022

Right now it's possible to show:

  1. removed apis
  2. removed and added apis

Is it possible to only show added apis?

The use case is to print 2 separate sections, one for added and one for removed, instead of mixing them together in one.

@joelanford
Copy link
Owner

I'm having trouble understanding what you're going for. Would you be able to provide an example?

@tonglil
Copy link
Author

tonglil commented Dec 19, 2022

Right now it shows:

golang.org/x/exp/apidiff
  Incompatible changes:
  - Report.Compatible: removed
  - Report.Incompatible: removed
golang.org/x/exp/apidiff
  Incompatible changes:
  - Report.Compatible: removed
  - Report.Incompatible: removed
  Compatible changes:
  - Change: added
  - Report.Changes: added

I am looking for:

golang.org/x/exp/apidiff
  Compatible changes:
  - Change: added
  - Report.Changes: added

@joelanford
Copy link
Owner

What about changed APIs (which would show up under incompatible changes)?

I'm trying to think of a use case where it makes sense to ignore the incompatible changes. Can you explain that part?

@tonglil
Copy link
Author

tonglil commented Jan 10, 2023

I'm just trying to get them to show up separately so they can be printed into different reports - the request here is for formatting purposes. I'm not trying to "ignore" anything or remove the existing functionality - in my use case I would be calling:

go-apidiff --removed > changelog
# some other commands..
go-apidiff --changed > changelog
go-apidiff --added > changelog

Currently it's nearly impossible to grep out these sections to generate my own reporting and changelogs.

For example, I want to show:

# APIs removed

golang.org/x/exp/apidiff
  Incompatible changes:
  - Report.Compatible: removed
  - Report.Incompatible: removed

# APIs changed

golang.org/x/exp/apidiff
  Incompatible changes:
  - Report.Rename: changed from ... to ...

# APIs added

golang.org/x/exp/apidiff
  Compatible changes:
  - Change: added
  - Report.Changes: added

What about changed APIs

I am not sure if "readers" of the output is able to identify "changes" easily, or what that means to them, since removed APIs are still breaking changes. For example, the tool cannot detect "renamed" functions. coming back to this, I realized what you mean by changed now. I updated the example here to show that, and to show the display of only changed APIs.

@joelanford
Copy link
Owner

The actual change reports are coming from golang.org/x/exp/apidiff. The Change type provides only compatible vs not-compatible and an opaque message describing the change.

Perhaps I could look into a parsable JSON output format that would make it a bit easier to generate a changelog section. But even then I think changes and removals would be intermingled. If you really want to separate removals and changes, then you may have to parse the message looking for removed and changed.

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

2 participants