Skip to content

Recursively check unique pkg names against existing imports#186

Merged
sudo-suhas merged 1 commit intomainfrom
recursive-conflict-resolution
Nov 20, 2022
Merged

Recursively check unique pkg names against existing imports#186
sudo-suhas merged 1 commit intomainfrom
recursive-conflict-resolution

Conversation

@sudo-suhas
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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).

Comment thread internal/registry/registry.go
@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
Copy Markdown
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