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

Recursively check unique pkg names against existing imports #186

Merged
merged 1 commit into from
Nov 20, 2022

Conversation

sudo-suhas
Copy link
Collaborator

When we generate a unique name for pkg a on conflict with pkg b, the new name could already be in use for pkg c. So recursively check each unique name against existing imports before setting it.

Closes #184

/cc @cldmstr

When we generate a unique name for pkg a on conflict with pkg b, the new
name could already be in use for pkg c. So recursively check each unique
name against existing imports before setting it.
@sudo-suhas
Copy link
Collaborator Author

@matryer @breml will wait for your review until this weekend to merge this change. Will tag and release v0.3.0 post that.

Copy link
Contributor

@breml breml left a comment

Choose a reason for hiding this comment

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

LGTM, but I think the algorithm for selecting an alias could be simplified. Because we are talking about generated code, I would argue, that this might be worth the price for the reduced readability of the generated code (see my inline comment for details).

internal/registry/registry.go Show resolved Hide resolved
@sudo-suhas sudo-suhas merged commit a464ccc into main Nov 20, 2022
@sudo-suhas sudo-suhas deleted the recursive-conflict-resolution branch November 20, 2022 05:57
@sudo-suhas
Copy link
Collaborator Author

Released in v0.3.0 🎉

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.

Moq creates non-unique import aliases
2 participants