Skip to content

Commit

Permalink
Fix return parametrized error and added go Mod.
Browse files Browse the repository at this point in the history
Return code renderer was missing the loop to add multiple instances of the same type if there were multiple return named values with the same type in a list form.
I also added support for go mod (Finally!) fixes #127 fixed #122 fixes #31
  • Loading branch information
Javier Feliu committed Apr 4, 2022
1 parent a55546d commit c32efbe
Show file tree
Hide file tree
Showing 53 changed files with 46,451 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go:
- 1.11.x

before_install:
- go get -t -v ./...
- go mod download
- go get -u golang.org/x/lint/golint
- go get github.com/fzipp/gocyclo/cmd/gocyclo
script:
Expand Down
2 changes: 2 additions & 0 deletions ClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace parser {
- parseFileDeclarations(node ast.Decl)
- handleFuncDecl(decl *ast.FuncDecl)
- handleGenDecl(decl *ast.GenDecl)
- processSpec(spec ast.Spec)
- renderStructures(pack string, structures <font color=blue>map</font>[string]*Struct, str *LineStringBuilder)
- renderAliases(str *LineStringBuilder)
- renderStructure(structure *Struct, pack string, name string, str *LineStringBuilder, composition *LineStringBuilder, extends *LineStringBuilder, aggregations *LineStringBuilder)
Expand Down Expand Up @@ -86,6 +87,7 @@ namespace parser {
+ Aliases bool
+ ConnectionLabels bool
+ AggregatePrivateMembers bool
+ PrivateMembers bool

}
class Struct << (S,Aquamarine) >> {
Expand Down
7 changes: 7 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module github.com/jfeliu007/goplantuml

go 1.17

require github.com/spf13/afero v1.8.2

require golang.org/x/text v0.3.7 // indirect
434 changes: 434 additions & 0 deletions go.sum

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions parser/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,15 @@ func getFunction(f *ast.FuncType, name string, aliases map[string]string, packag
if results != nil {
for _, pa := range results.List {
theType, _ := getFieldType(pa.Type, aliases)
function.ReturnValues = append(function.ReturnValues, replacePackageConstant(theType, ""))
function.FullNameReturnValues = append(function.FullNameReturnValues, replacePackageConstant(theType, packageName))
count := 1
if pa.Names != nil {
count = len(pa.Names)
}
for count > 0 {
count--
function.ReturnValues = append(function.ReturnValues, replacePackageConstant(theType, ""))
function.FullNameReturnValues = append(function.FullNameReturnValues, replacePackageConstant(theType, packageName))
}
}
}
return function
Expand Down
1 change: 1 addition & 0 deletions testingsupport/subfolder1-2.puml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace subfolder2 {
class Subfolder2 << (S,Aquamarine) >> {
+ SubfolderFunction(b bool, i int) bool
+ SubfolderFunctionWithReturnListParametrized() ([]byte, []byte, []byte, error)

}
}
Expand Down
4 changes: 4 additions & 0 deletions testingsupport/subfolder2/subfolder2.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ type Subfolder2 struct {
func (s *Subfolder2) SubfolderFunction(b bool, i int) bool {
return true
}

func (s *Subfolder2) SubfolderFunctionWithReturnListParametrized() (a, b, c []byte, err error) {
return
}
2 changes: 2 additions & 0 deletions vendor/github.com/spf13/afero/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions vendor/github.com/spf13/afero/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

174 changes: 174 additions & 0 deletions vendor/github.com/spf13/afero/LICENSE.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c32efbe

Please sign in to comment.