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: panic on latest compiler version #56162

Closed
jba opened this issue Oct 11, 2022 · 11 comments
Closed

x/exp/apidiff: panic on latest compiler version #56162

jba opened this issue Oct 11, 2022 · 11 comments
Assignees
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@jba
Copy link
Contributor

jba commented Oct 11, 2022

apidiff does not understand something about how go/types represents things in the latest version (pre 1.20).
Its test needs a "go 1.18" directive in the go.mod file; after that, apidiff panics.

@jba jba added this to the Go1.20 milestone Oct 11, 2022
@jba jba self-assigned this Oct 11, 2022
@dmitshur dmitshur changed the title exp/apidiff: panic on latest compiler version x/exp/apidiff: panic on latest compiler version Oct 12, 2022
@joedian joedian added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 12, 2022
@dmitshur dmitshur added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Oct 12, 2022
@joedian
Copy link

joedian commented Oct 12, 2022

@jba can you please add further details to this issue? It's not clear in terms of the potential impact, and why it could be a release blocker.

@jba
Copy link
Contributor Author

jba commented Oct 12, 2022

This is a problem with a tool that is not part of the main toolchain, and is explicitly labeled experimental (because it's in the exp repo). So it should not affect the actual Go release. But some people do rely on it (it is part of their release process, for instance).

@gopherbot
Copy link

Change https://go.dev/cl/443856 mentions this issue: apidiff: account for receivers that are not named types

@findleyr
Copy link
Contributor

I think this changed with the unified IR importer. If apidiff broke, it is safe to assume that other tools will break too.

It's also somewhat problematic that go/types (AFAIK) still sets a named receiver, but there are other examples of where imported packages are not-quite-identical to type-checked packages, for example they don't have function scopes.

@mdempsky @adonovan @griesemer are we comfortable with the breakage here?

@adonovan
Copy link
Member

(At first I thought this was a discussion about throwing away Var names from receivers, parameters, and results, which is fair game. But we're really talking about using the underlying unnamed interface type for interface methods.)

This seems to be a regression of #13829, and I think it should be fixed again.

@mdempsky
Copy link
Member

mdempsky commented Oct 19, 2022

Can we first confirm this issue is still present and get further details on what's failing? I've never used apidiff. I don't know how to begin to reproduce this issue.

go/internal/gcimporter does set named interface receivers. I forget if that CL was ported to the x/tools importer though; maybe not.

@findleyr
Copy link
Contributor

Looks like it was fixed in https://go.dev/cl/421255, but I am guessing the apidiff module does not yet see that commit.

@findleyr
Copy link
Contributor

In case this CL isn't yet in x/tools@latest, I believe the new release automation is about to tag the next version of x/tools. @jba you may need to upgrade to a pseudoversion, or wait ~days to upgrade to x/tools@v0.2.0.

@jba
Copy link
Contributor Author

jba commented Oct 19, 2022

apidiff is not its own module; it is part of golang.org/x/exp.
Should I make it its own module? Other subdirectories of exp are.
But there is also cmd/apidiff, which unfortunately is not under apidiff. It is a small binary, but it's what uses golang.org/x/tools/go/gcexportdata and .../go/packages.
Upgrading all of exp is also a reasonable choice, so one alternative is to do nothing.

@findleyr
Copy link
Contributor

I think we should upgrade x/exp once x/tools is tagged.

@golang/release are working on automated tagging, but I believe x/exp is excluded.

@gopherbot
Copy link

Change https://go.dev/cl/445576 mentions this issue: go.mod: upgrade golang.org/x/tools to v0.2.0

@golang golang locked and limited conversation to collaborators Oct 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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

8 participants