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

plugin/populate: avoid loops on non top-level packages #357

Merged
merged 1 commit into from
Nov 30, 2017
Merged

plugin/populate: avoid loops on non top-level packages #357

merged 1 commit into from
Nov 30, 2017

Conversation

benesch
Copy link
Contributor

@benesch benesch commented Nov 30, 2017

The previous scheme for detecting when a type belonged to a different
package only considered the topmost component of the type name, when it
in fact needs to consider all but the last component of the type name.

Fix #207 (again).

@tbg
Copy link

tbg commented Nov 30, 2017

💛

@awalterschulze
Copy link
Member

Beautiful :)

Could you just regenerate the code, because the diff check is failing.
I usually do this by simply running make in the root of the project.

@benesch
Copy link
Contributor Author

benesch commented Nov 30, 2017

Heh, turns out that one-line diff was actually pointing out that my new approach was (still) wrong. Type names can include the names of other types, so simply stripping off the last component isn't sufficient to determine the package either.

Updated with a new approach which plumbs the package name from the file descriptor. I'm hopeful that's bulletproof.

@awalterschulze
Copy link
Member

awalterschulze commented Nov 30, 2017 via email

The previous scheme for detecting when a type belonged to a different
package only considered the topmost component of the type name, but this
is not a sufficiently general means of determining a type's package, as
package names can themselves contain dots. Get the package name from the
file descriptor instead, which is guaranteed to be correct.

Also add a test to ensure this doesn't break in the future.

Fix #207 (again).
@benesch
Copy link
Contributor Author

benesch commented Nov 30, 2017

Indeed, the ref I just pushed does exactly that :)

@awalterschulze
Copy link
Member

awalterschulze commented Nov 30, 2017 via email

@benesch
Copy link
Contributor Author

benesch commented Nov 30, 2017

Whew, it's green! Thanks for the crazy fast response time, @awalterschulze.

@awalterschulze
Copy link
Member

Perfect :)
Thank you very much.

@awalterschulze awalterschulze merged commit fd9a479 into gogo:master Nov 30, 2017
@awalterschulze
Copy link
Member

Any time :)
Well ... not any time unfortunately :(
, but I try my best.

@benesch benesch deleted the populate-recursion branch November 30, 2017 20:22
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.

None yet

3 participants