jfeliu007 / goplantuml

PlantUML Class Diagram Generator for golang projects
MIT License
1.78k stars 167 forks source link

Support for parenthesized type declarations #102

Closed rlankfo closed 3 years ago

rlankfo commented 3 years ago

I had several parenthesized interface type declarations and noticed they weren't showing up in the puml output.

Examples) Works:

type Foo interface {
  Foo()
}
type Bar interface {
  Bar()
}

Not working:

type (
  Foo interface {
    Foo()
  }
  Bar interface {
    Bar()
  }
)
jfeliu007 commented 3 years ago

I'll take a look at this. Thanks for reporting it.

rlankfo commented 3 years ago

Thanks. If you could provide some direction I wouldn't mind taking a crack at a PR.

jfeliu007 commented 3 years ago

Actually I would have to see how the AST represents this specific problem. Let me make a couple of tests to see if I can suggest a COA. Thanks for this and sorry for the delays in my responses. I think I have to hook some notifications in this repo. I only see these updates if I come to github.

jfeliu007 commented 3 years ago

I just took a look at this. In the fileparser/class_parser.go near to line 320 the code assumes the dec.Specs array will only contain 1 element. I have never seen the declarations as you posted in this issue and of course never ran into this case. If you wrap the code from 321 to 370 around a for loop range on each Spec you will solve this issue. :)