Giter Site home page Giter Site logo

gouml's Introduction

Build Status

Automatically generate PlantUML from Go Code.

example (self-reference):
self-ref

Note that the interface of this library is still ALPHA level quality.
Breaking changes will be introduced frequently.

Usage

$ go get -u github.com/kazukousen/gouml/cmd/gouml
$ gouml --version

Run gouml init (or gouml i) . This will parse .go files and generate the plantUML file.

$ gouml i -f /path/to/package/subpackage1/ -f /path/to/package/subpackage2/foo.go

Fire or Directory you want to parse, you can use -f flag.

Ignore a target directory or file

You can use --ignore Flag.

$ gouml i -f /path/to/package/ --ignore /path/to/package/ignorepackage/

License

Copyright (c) 2019-present Kazuki Nitta

Licensed under MIT License

gouml's People

Contributors

kazukousen avatar nelsw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gouml's Issues

FEATURE: Ignore directories cli flag.

Also be great to be able to pass in list of directories that also need to be ignored too.

I'm using this on a project that has a number of support tools build in ./cmd/* that I dont want to generate the uml for as they aren't part of the primary business domain I need the uml for.

Thanks.

Install gouml with error

I am trying to install gouml, but get this error.

go get -u github.com/kazukousen/gouml/cmd/gouml
# github.com/kazukousen/gouml/cmd/gouml
../../../github.com/kazukousen/gouml/cmd/gouml/main.go:17:22: cannot use cli.StringSliceFlag literal (type cli.StringSliceFlag) as type cli.Flag in array or slice literal:
	cli.StringSliceFlag does not implement cli.Flag (Apply method has pointer receiver)
../../../github.com/kazukousen/gouml/cmd/gouml/main.go:21:22: cannot use cli.StringSliceFlag literal (type cli.StringSliceFlag) as type cli.Flag in array or slice literal:
	cli.StringSliceFlag does not implement cli.Flag (Apply method has pointer receiver)
../../../github.com/kazukousen/gouml/cmd/gouml/main.go:25:15: cannot use cli.BoolFlag literal (type cli.BoolFlag) as type cli.Flag in array or slice literal:
	cli.BoolFlag does not implement cli.Flag (Apply method has pointer receiver)
../../../github.com/kazukousen/gouml/cmd/gouml/main.go:33:15: cannot use []cli.Command literal (type []cli.Command) as type []*cli.Command in assignment
../../../github.com/kazukousen/gouml/cmd/gouml/main.go:58:19: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
	cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)

implement `interface` type

type Foo interface {
    GetBar() Bar
}

type Bar string
interface "Foo" as f {
}

class "Bar" as b <<V,orchid>> {
}

f : GetBar() : Bar
f ..> b : <<use>>

multiple references to unresolved methods

steps to reproduce:

go get -u github.com/kazukousen/gouml/cmd/gouml

expected outcome:

gouml --version
gouml version 0.2

actual outcome:

# github.com/kazukousen/gouml/internal/gouml/plantuml
../github.com/kazukousen/gouml/internal/gouml/plantuml/parser.go:33:62: elapsed.Milliseconds undefined (type time.Duration has no field or method Milliseconds)
../github.com/kazukousen/gouml/internal/gouml/plantuml/parser.go:71:66: elapsed.Milliseconds undefined (type time.Duration has no field or method Milliseconds)

Can not convert inline struct correctly

Issue

I would like to convert the code below.

package foo

type foo struct{
	id int `json:"id"`
	bar struct{
		id int `json:"bar_id"`
	} `json:"bar"`
}

However, the output contains struct tag data.

package "foo" {
	class "foo" as foo.foo <<V,Orchid>> {
		-id: int
		-bar: struct{id int "json:\"bar_id\""}
	}
}

スクリーンショット 2019-04-15 13 48 05

I think this is because that types.Struct has not only field data, but also tag data like,

&types.Struct{
    fields:[]*types.Var{(*types.Var)(0xc0000ee3c0)},
    tags:[]string{"json:\"bar_id\""}
}

Therefore, when we use types.Struct.String(), unnecessary information is showed.

Document ability to init several files or directories at once

From what I understand the StringSliceFlag allows multiple files to be initialized

gouml --file somedirectory/ --file someotherdirectory/

Currently the help documentation for gouml init does not make this behavior clear:

   --file value, -f value    File or Directory you want to parse

Ignore *_test.go files

Just giving this tool a spin and its taking forever to parse some of my *_test.go files. Be great if these could be ignored either by a cli flag or even by default.

allow diagram filtering on some dimensions

Let me say first that this is a freaking awesome tool.

I let it loose on a complicated model, it took 5 minutes but did a stellar job. Of course, since the
model was so complicated, it generated something really complex as well.

When navigating large graphs, it would be useful to offer the following filters.

  • omit private members
  • omit <<return>> relationships
  • omit <<use>> relationships

parse const comment and draw note

type Kind string

// enum of kind
const (
    KindFoo Kind = "foo"
    KindBar Kind = "bar"
)
class "Kind" as k <<V>>

note as nk
    <b>enum of kind</b>
    KindFoo
    KindBar
end note

nk --> k

Missing @startuml Header and @enduml Footer

Just noticed that my plantuml plugin in Goland has issues rendering the image output when the header and footer @startuml @enduml aren't included in the outputted file. I add these manually and its all good.

I'm also guessing this could be an issue for other third party tools that rely on this markup in someway.

Interface implementation missing if methods use types from different packages

First of all, awesome tool for reverse engineering. Wonderful work!

Let me illustrate this issue with an example:

Let's say I have a package called usecases with an interface called UserOutputBoundary and another package called adapters with a type UserPresenter that implements the interface.

Here is an example where everything works great using a simple data type in the interface methods:

good

However, if I use a UserOutputData type from the usecases package instead of a simple data type this tool gets confused and produces the following PlantUML output without the expected inheritance relationship:

bad

Hope it's an easy fix.

go get reports an error

go/src/github.com/kazukousen/gouml/cmd/gouml/main.go:37:15: cannot use []cli.Command literal (type []cli.Command) as type []*cli.Command in assignment

Install gouml with error

I am trying to install gouml, but got this error.

go get -u github.com/kazukousen/gouml/cmd/gouml
# github.com/kazukousen/gouml/cmd/gouml
../../../go/src/github.com/kazukousen/gouml/cmd/gouml/main.go:37:15: cannot use []cli.Command literal (type []cli.Command) as type []*cli.Command in assignment

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.