fix: Fix wrong package name in domain ids#4973
Merged
keon94 merged 1 commit intoapache:mainfrom Apr 19, 2023
Merged
Conversation
RootPkgPath is used by DomainIdGenerator to find the name of the plugin that defines a given type. While remote plugins do not use the DomainIdGenerator, we still need to implement this function. Indeed, DomainIdGenerator uses FindPluginNameBySubPkgPath that returns the name of the first plugin whose RootPkgPath is a prefix of the type package path. So remote plugin must not return an empty string as RootPkgPath, but a string that is not a prefix of any go plugin package path.
keon94
reviewed
Apr 19, 2023
| // This in turn is only used by DomainIdGenerator. | ||
| // Remote plugins define tool layer types in another language, | ||
| // so the reflective implementation of NewDomainIdGenerator cannot work. | ||
| return "" |
Contributor
There was a problem hiding this comment.
how was this causing wrong plugin-names to end up in the domain ID?
Contributor
Author
There was a problem hiding this comment.
DomainIdGenerator uses FindPluginNameBySubPkgPath that returns the name of the first plugin whose RootPkgPath is a prefix of the type package path. So this empty string makes FindPluginNameBySubPkgPath believe all types belong to any remote plugin.
3 tasks
keon94
approved these changes
Apr 19, 2023
Contributor
|
Lgtm |
chenggui53
pushed a commit
to chenggui53/incubator-devlake
that referenced
this pull request
May 5, 2023
RootPkgPath is used by DomainIdGenerator to find the name of the plugin that defines a given type. While remote plugins do not use the DomainIdGenerator, we still need to implement this function. Indeed, DomainIdGenerator uses FindPluginNameBySubPkgPath that returns the name of the first plugin whose RootPkgPath is a prefix of the type package path. So remote plugin must not return an empty string as RootPkgPath, but a string that is not a prefix of any go plugin package path. Co-authored-by: Camille Teruel <camille.teruel@meri.co>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix remotePluginImpl.RootPkgPath that caused the domain id generator to generate wrong plugin names in domain ids..
Does this close any open issues?
Closes #4970