bykof/go-plantuml

Error when struct declaration is in a different file than its method

Closed this issue · 3 comments

Hi,

go-plantuml cannot seem to find a type if its declaration is in a different file than one of its method.

For example, with the following files:

impl.go:

package models

func (user *User) SetFirstName(firstName string) {
	user.FirstName = firstName
}

func PackageFunction() string {
	return "Hello World"
}

user.go:

package models

type User struct {
	FirstName      string
	LastName       string
	Age            uint8
}

I'm getting the following error when running go-plantuml generate:

2022/09/08 14:45:56 Could not find class: User for function SetFirstName

This seems to depend on the name of the files and the order in which they are parsed by the tool.
The same issue happens if the type is an alias (e.g. type User string).

bykof commented

Thanks for the request, I'll have a look at it

@bykof can i help with this issue?

bykof commented

@mahmednabil109 sure, feel free to work on it :)