Skip to content

[checkapi] support diffs #738

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

Closed
wants to merge 6 commits into from
Closed

Conversation

atoulme
Copy link
Contributor

@atoulme atoulme commented Apr 7, 2025

Add ability to check if the Golang API of a module has changed

@atoulme atoulme requested review from a team as code owners April 7, 2025 04:51
@atoulme atoulme requested a review from codeboten April 7, 2025 04:51
Copy link

codecov bot commented Apr 7, 2025

Codecov Report

Attention: Patch coverage is 71.97802% with 51 lines in your changes missing coverage. Please review.

Project coverage is 54.82%. Comparing base (7b18318) to head (1488433).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
checkapi/internal/diff.go 64.28% 32 Missing and 13 partials ⚠️
checkapi/main.go 50.00% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #738      +/-   ##
==========================================
+ Coverage   54.01%   54.82%   +0.80%     
==========================================
  Files          62       64       +2     
  Lines        3806     3987     +181     
==========================================
+ Hits         2056     2186     +130     
- Misses       1555     1591      +36     
- Partials      195      210      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we do an example PR where we see this output?

Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about type parameters (generics)?

@atoulme
Copy link
Contributor Author

atoulme commented Apr 8, 2025

What about type parameters (generics)?

I can add a test using generics, that's not come up yet but should be fun to support.

@atoulme atoulme force-pushed the apidiff branch 3 times, most recently from cac6b6e to 008b141 Compare April 9, 2025 00:52
@atoulme
Copy link
Contributor Author

atoulme commented Apr 9, 2025

@pellared generics peeled off in their own PR here: #739

@atoulme
Copy link
Contributor Author

atoulme commented Apr 10, 2025

Peeling off returning by value in #741

@atoulme atoulme force-pushed the apidiff branch 2 times, most recently from c44ac93 to bcd04f0 Compare April 11, 2025 01:12
@atoulme atoulme requested a review from a team as a code owner April 18, 2025 06:59
@atoulme atoulme force-pushed the apidiff branch 3 times, most recently from fd9c669 to f831a76 Compare April 19, 2025 04:52
@pellared
Copy link
Member

@atoulme, there are some lint failures. Besides, I guess this should be reviewed by OTel Collector approvers. Have you considered using https://pkg.go.dev/golang.org/x/exp/cmd/gorelease?

@atoulme atoulme marked this pull request as draft May 1, 2025 22:59
@atoulme
Copy link
Contributor Author

atoulme commented May 1, 2025

Have you considered using https://pkg.go.dev/golang.org/x/exp/cmd/gorelease?

I think we looked at it and it didn't really meet the requirements.

@atoulme atoulme marked this pull request as ready for review May 2, 2025 05:29
@atoulme
Copy link
Contributor Author

atoulme commented May 2, 2025

@open-telemetry/collector-approvers and @open-telemetry/collector-contrib-approvers please review

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this functionality is welcome but I would like to understand why we want to have a custom solution instead of relying in https://pkg.go.dev/golang.org/x/exp/apidiff as Kubernetes does

@atoulme
Copy link
Contributor Author

atoulme commented May 7, 2025

I didn't look at that tool. I don't have an opinion on it. Should we prefer it?

@pellared
Copy link
Member

pellared commented May 7, 2025

I didn't look at that tool. I don't have an opinion on it. Should we prefer it?

This is something which the Go team uses as well. https://pkg.go.dev/golang.org/x/exp/cmd/gorelease uses this package as well. There are still some issues, but I think we should prefer it.

@mx-psi
Copy link
Member

mx-psi commented May 7, 2025

I didn't look at that tool. I don't have an opinion on it. Should we prefer it?

I thought it was unmaintained, but talking at KubeCon with someone from Kubernetes they mentioned they use this (see https://github.com/kubernetes/kubernetes/blob/master/hack/apidiff.sh and https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/129125/pull-kubernetes-apidiff-client-go/1887847435644964864 as a concrete example), and that the Go team has been responsive in adding features like support for generics. So I think it's less maintenance work if we leverage it (possibly wrapping it within checkapi)

@pellared
Copy link
Member

pellared commented May 7, 2025

I would also consider contributing to https://pkg.go.dev/golang.org/x/exp/cmd/gorelease. AFAIK the main issue is lack of support for multiple Go modules.

@atoulme
Copy link
Contributor Author

atoulme commented May 7, 2025

OK, I will close this PR and maybe we can discuss this from the need perspective a bit more in the collector repository, and try any of the two tools you mention. The branch is still there if anyone wants to revisit.

@atoulme atoulme closed this May 7, 2025
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

Successfully merging this pull request may close these issues.

3 participants