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

Duplicate package names will affect the diagram #166

Open
yapinxxx opened this issue May 28, 2024 · 5 comments
Open

Duplicate package names will affect the diagram #166

yapinxxx opened this issue May 28, 2024 · 5 comments

Comments

@yapinxxx
Copy link

I think this is a bug.

Different packages should have different paths.

We could use a hash checksum to distinguish between packages with the same name or add the upper-level folder name to the namespace until the paths are different.

Otherwise, it will create an incorrect UML diagram.

@githoober
Copy link

Is this what's happening right now?

@ryo-arima
Copy link

ryo-arima commented Aug 23, 2024

Hello!
I just started using this great tool a short while ago.

I am developing a tool like this,
https://github.com/ryo-arima/mark1

I think the UML is being output as the same package, when in fact it is a different package, because the package names under client and server are the same. However, it is possible that my design is bad.....
I am checking the details now.

This is the command I executed.

$ goplantuml -show-aggregations -recursive pkg/ > {path}/{filename}.plantuml

<Sample of output>
plantuml: https://gist.github.com/ryo-arima/b46ae172e295441e6be96397e083edfb
image: https://github.com/user-attachments/assets/16657449-8015-4a5d-a84d-aa65930cb07c

Sorry if this is a different topic....

@yapinxxx
Copy link
Author

Hello! I just started using this great tool a short while ago.

I am developing a tool like this, https://github.com/ryo-arima/mark1

I think the UML is being output as the same package, when in fact it is a different package, because the package names under client and server are the same. However, it is possible that my design is bad..... I am checking the details now.

This is the command I executed.

$ goplantuml -show-aggregations -recursive pkg/ > {path}/{filename}.plantuml

<Sample of output> plantuml: https://gist.github.com/ryo-arima/b46ae172e295441e6be96397e083edfb image: https://github.com/user-attachments/assets/16657449-8015-4a5d-a84d-aa65930cb07c

Sorry if this is a different topic....

Thanks for your reply!

I think you're encountering the same issue as I did. I don't believe this structure design is inherently bad, as it follows the Golang package architecture. However, when we have more packages and use short names, this problem inevitably arises.

In my case, when my system has multiple different services with packages named "server," the UML creates incorrect relationship diagrams.

@yapinxxx
Copy link
Author

Is this what's happening right now?

Unfortunately, I think this issue is still occurring. I just tested it on my project, and it caused the same problem.
I have two sub-packages with the same name, and both contain a struct with the same name.

This leads to an ambiguity in the graph, where the two different structs are merged into one nonexistent struct.

@ryo-arima
Copy link

Thanks for your reply!

I think you're encountering the same issue as I did. I don't believe this structure design is inherently bad, as it follows the Golang package architecture. However, when we have more packages and use short names, this problem inevitably arises.

In my case, when my system has multiple different services with packages named "server," the UML creates incorrect relationship diagrams.

Thank you for your reply too!

Yes, I think it is.
I think the GO naming convention favors short and simple names, so I too think it is fine as it is.

However, in larger implementations, I think there is room for improvement, as care must be taken when using goplantuml.

For example, “pkg/server/controller” is identified as “pkg.server.controller” and display.
pkg/client/controller” should be identified as ‘pkg.client.controller’ and display.
But I think there are various ways of displaying...

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

No branches or pull requests

3 participants