{"id":13564397,"url":"https://github.com/jfeliu007/goplantuml","last_synced_at":"2025-04-11T09:30:03.907Z","repository":{"id":37612046,"uuid":"188701937","full_name":"jfeliu007/goplantuml","owner":"jfeliu007","description":"PlantUML Class Diagram Generator for golang projects","archived":false,"fork":false,"pushed_at":"2024-08-08T09:51:19.000Z","size":663,"stargazers_count":1972,"open_issues_count":40,"forks_count":176,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-04-03T10:07:12.194Z","etag":null,"topics":["diagram","diagram-generator","go","golang","plantuml","uml-diagram"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jfeliu007.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-26T15:43:12.000Z","updated_at":"2025-04-02T11:23:42.000Z","dependencies_parsed_at":"2024-12-18T19:04:20.036Z","dependency_job_id":"87a80f57-1297-42cb-bc71-53354ee3dc25","html_url":"https://github.com/jfeliu007/goplantuml","commit_stats":{"total_commits":129,"total_committers":9,"mean_commits":"14.333333333333334","dds":0.3643410852713178,"last_synced_commit":"b5960c7507ea6208a0baf28762884329544b7090"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfeliu007%2Fgoplantuml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfeliu007%2Fgoplantuml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfeliu007%2Fgoplantuml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfeliu007%2Fgoplantuml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jfeliu007","download_url":"https://codeload.github.com/jfeliu007/goplantuml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248368068,"owners_count":21092301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diagram","diagram-generator","go","golang","plantuml","uml-diagram"],"created_at":"2024-08-01T13:01:30.684Z","updated_at":"2025-04-11T09:30:03.863Z","avatar_url":"https://github.com/jfeliu007.png","language":"Go","funding_links":[],"categories":["Code Analysis","开源类库","Go","Open source library","代码分析","Repositories","Libraries for creating HTTP middlewares","相关工具","others"],"sub_categories":["Routers","代码分析","Code Analysis","路由器"],"readme":"[![godoc reference](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/jfeliu007/goplantuml/parser) [![Go Report Card](https://goreportcard.com/badge/github.com/jfeliu007/goplantuml)](https://goreportcard.com/report/github.com/jfeliu007/goplantuml) [![codecov](https://codecov.io/gh/jfeliu007/goplantuml/branch/master/graph/badge.svg)](https://codecov.io/gh/jfeliu007/goplantuml) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n[![GitHub release](https://img.shields.io/github/release/jfeliu007/goplantuml.svg)](https://github.com/jfeliu007/goplantuml/releases/)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) \n[![DUMELS Diagram](https://www.dumels.com/api/v1/badge/23ff0222-e93b-4e9f-a4ef-4d5d9b7a5c7d)](https://www.dumels.com/diagram/23ff0222-e93b-4e9f-a4ef-4d5d9b7a5c7d) \n# GoPlantUML V2\n\nGoPlantUML is an open-source tool developed to streamline the process of generating PlantUML diagrams from Go source code. With GoPlantUML, developers can effortlessly visualize the structure and relationships within their Go projects, aiding in code comprehension and documentation. By parsing Go source code and producing PlantUML diagrams, GoPlantUML empowers developers to create clear and concise visual representations of their codebase architecture, package dependencies, and function interactions. This tool simplifies the documentation process and enhances collaboration among team members by providing a visual overview of complex Go projects. GoPlantUML is actively maintained and welcomes contributions from the Go community.\n\n## Want to try it on your code? \nTake a look at [www.dumels.com](https://www.dumels.com). We have created dumels using this library. \n\n## Code of Conduct\nPlease, review the code of conduct [here](https://github.com/jfeliu007/goplantuml/blob/master/CODE_OF_CONDUCT.md \"here\").\n\n### Prerequisites\ngolang 1.17 or above\n\n### Installing\n\n```\ngo get github.com/jfeliu007/goplantuml/parser\ngo install github.com/jfeliu007/goplantuml/cmd/goplantuml@latest\n```\n\nThis will install the command goplantuml in your GOPATH bin folder.\n\n### Usage\n\n```\ngoplantuml [-recursive] path/to/gofiles path/to/gofiles2\n```\n```\ngoplantuml [-recursive] path/to/gofiles path/to/gofiles2 \u003e diagram_file_name.puml\n```\n```\nUsage of goplantuml:\n  -aggregate-private-members\n        Show aggregations for private members. Ignored if -show-aggregations is not used.\n  -hide-connections\n        hides all connections in the diagram\n  -hide-fields\n        hides fields\n  -hide-methods\n        hides methods\n  -ignore string\n        comma separated list of folders to ignore\n  -notes string\n        Comma separated list of notes to be added to the diagram\n  -output string\n        output file path. If omitted, then this will default to standard output\n  -recursive\n        walk all directories recursively\n  -show-aggregations\n        renders public aggregations even when -hide-connections is used (do not render by default)\n  -show-aliases\n        Shows aliases even when -hide-connections is used\n  -show-compositions\n        Shows compositions even when -hide-connections is used\n  -show-connection-labels\n        Shows labels in the connections to identify the connections types (e.g. extends, implements, aggregates, alias of\n  -show-implementations\n        Shows implementations even when -hide-connections is used\n  -show-options-as-note\n        Show a note in the diagram with the none evident options ran with this CLI\n  -title string\n        Title of the generated diagram\n  -hide-private-members\n        Hides all private members (fields and methods)\n```\n\n#### Example\n```\ngoplantuml $GOPATH/src/github.com/jfeliu007/goplantuml/parser\n```\n```\n// echoes\n\n@startuml\nnamespace parser {\n    class Struct {\n        + Functions []*Function\n        + Fields []*Parameter\n        + Type string\n        + Composition []string\n        + Extends []string\n\n    }\n    class LineStringBuilder {\n        + WriteLineWithDepth(depth int, str string) \n\n    }\n    class ClassParser {\n        - structure \u003cfont color=blue\u003emap\u003c/font\u003e[string]\u003cfont color=blue\u003emap\u003c/font\u003e[string]*Struct\n        - currentPackageName string\n        - allInterfaces \u003cfont color=blue\u003emap\u003c/font\u003e[string]\u003cfont color=blue\u003estruct\u003c/font\u003e{}\n        - allStructs \u003cfont color=blue\u003emap\u003c/font\u003e[string]\u003cfont color=blue\u003estruct\u003c/font\u003e{}\n\n        - structImplementsInterface(st *Struct, inter *Struct) \n        - parsePackage(node ast.Node) \n        - parseFileDeclarations(node ast.Decl) \n        - addMethodToStruct(s *Struct, method *ast.Field) \n        - getFunction(f *ast.FuncType, name string) \n        - addFieldToStruct(s *Struct, field *ast.Field) \n        - addToComposition(s *Struct, fType string) \n        - addToExtends(s *Struct, fType string) \n        - getOrCreateStruct(name string) \n        - getStruct(structName string) \n        - getFieldType(exp ast.Expr, includePackageName bool) \n\n        + Render() \n\n    }\n    class Parameter {\n        + Name string\n        + Type string\n\n    }\n    class Function {\n        + Name string\n        + Parameters []*Parameter\n        + ReturnValues []string\n\n    }\n}\nstrings.Builder *-- parser.LineStringBuilder\n\n\n@enduml\n```\n```\ngoplantuml $GOPATH/src/github.com/jfeliu007/goplantuml/parser \u003e ClassDiagram.puml\n// Generates a file ClassDiagram.puml with the previous specifications\n```\n\nThere are two different relationships considered in goplantuml:\n- Interface implementation\n- Type Composition\n\nThe following example contains interface implementations and composition. Notice how the signature of the functions\n```golang\npackage testingsupport\n\n//MyInterface only has one method, notice the signature return value\ntype MyInterface interface {\n\tfoo() bool\n}\n\n//MyStruct1 will implement the foo() bool function so it will have an \"extends\" association with MyInterface\ntype MyStruct1 struct {\n}\n\nfunc (s1 *MyStruct1) foo() bool {\n\treturn true\n}\n\n//MyStruct2 will be directly composed of MyStruct1 so it will have a composition relationship with it\ntype MyStruct2 struct {\n\tMyStruct1\n}\n\n//MyStruct3 will have a foo() function but the return value is not a bool, so it will not have any relationship with MyInterface\ntype MyStruct3 struct {\n    Foo MyStruct1\n}\n\nfunc (s3 *MyStruct3) foo() {\n\n}\n```\nThis will be generated from the previous code\n```\n@startuml\nnamespace testingsupport {\n    interface MyInterface  {\n        - foo() bool\n\n    }\n    class MyStruct1 \u003c\u003c (S,Aquamarine) \u003e\u003e {\n        - foo() bool\n\n    }\n    class MyStruct2 \u003c\u003c (S,Aquamarine) \u003e\u003e {\n    }\n    class MyStruct3 \u003c\u003c (S,Aquamarine) \u003e\u003e {\n        - foo() \n\n        + Foo MyStruct1\n\n    }\n}\ntestingsupport.MyStruct1 *-- testingsupport.MyStruct2\n\ntestingsupport.MyInterface \u003c|-- testingsupport.MyStruct1\n\ntestingsupport.MyStruct3 o-- testingsupport.MyStruct1\n\n@enduml\n```\n\n![alt text](https://raw.githubusercontent.com/jfeliu007/goplantuml/master/example/example.png)\n\n### Diagram using www.dumels.com\n[UML Diagram](https://www.dumels.com/diagram/23ff0222-e93b-4e9f-a4ef-4d5d9b7a5c7d)\n\n### Diagram rendered in plantuml online server\n[UML Diagram](https://www.plantuml.com/plantuml/uml/SoWkIImgAStDuSfBp4qjBaXCJbKeIIqkoSnBBoujACWlAb6evb80WioyajIYD92qRwKdd0sIX09TXRJyV0rDXQJy_1mki6Wjc4pEIImk1ceABYagJIunLB2nKT08rd4iB4tCJIpAp4lLLB2p8zaO8np6uDHWJAozN70HRGMt_7o4ms6EgUL23HyzXDUqT7KLS4WQSM5gGmIZJGrkdOOOEX5-oiUhpI4rBmKOim00)\n\nFor instructions on how to render these diagrams locally using plantuml please visit [https://plantuml.com](https://plantuml.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfeliu007%2Fgoplantuml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjfeliu007%2Fgoplantuml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfeliu007%2Fgoplantuml/lists"}