Skip to content

Commit

Permalink
Merge branch 'master' into exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
bykof authored Nov 13, 2022
2 parents ce64a16 + 3afd2a8 commit d4b279c
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 22 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# go-plantuml
[![Build Status](https://github.com/bykof/go-plantuml/actions/workflows/test.yml/badge.svg)](https://github.com/bykof/go-plantuml/actions/workflows/test.yml/badge.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/bykof/go-plantuml)](https://goreportcard.com/report/github.com/bykof/go-plantuml)
[![go-recipes](https://raw.githubusercontent.com/nikolaydubina/go-recipes/main/badge.svg?raw=true)](https://github.com/nikolaydubina/go-recipes)

go-plantuml generates plantuml diagrams from go source files or directories.

Expand Down
3 changes: 2 additions & 1 deletion astParser/formatters.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package astParser

import (
"fmt"
"github.com/bykof/go-plantuml/domain"
"strings"

"github.com/bykof/go-plantuml/domain"
)

func formatArrayType(typeName string) string {
Expand Down
6 changes: 4 additions & 2 deletions astParser/formatters_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package astParser

import (
"github.com/bykof/go-plantuml/domain"
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"

"github.com/bykof/go-plantuml/domain"
)

func Test_formatArrayType(t *testing.T) {
Expand Down
6 changes: 4 additions & 2 deletions astParser/mapper_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package astParser

import (
"github.com/bykof/go-plantuml/domain"
"github.com/magiconair/properties/assert"
"go/ast"
"testing"

"github.com/magiconair/properties/assert"

"github.com/bykof/go-plantuml/domain"
)

func Test_starExprToField(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion astParser/mappers.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package astParser

import (
"github.com/bykof/go-plantuml/domain"
"go/ast"

"github.com/bykof/go-plantuml/domain"
)

func starExprToField(fieldName string, starExpr *ast.StarExpr) domain.Field {
Expand Down
4 changes: 2 additions & 2 deletions astParser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"go/ast"
"go/parser"
"go/token"
"io/ioutil"
"log"
"os"
"path/filepath"
"reflect"
"regexp"
Expand All @@ -22,7 +22,7 @@ func ParseDirectory(directoryPath string, opts ...ParserOptionFunc) domain.Packa
}

var packages domain.Packages
files, err := ioutil.ReadDir(directoryPath)
files, err := os.ReadDir(directoryPath)
if err != nil {
log.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/generate.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cmd

import (
"io/ioutil"
"log"
"os"

"github.com/spf13/cobra"

Expand Down Expand Up @@ -41,7 +41,7 @@ var (
}

formattedPlantUML := formatter.FormatPlantUML(packages)
err := ioutil.WriteFile(outPath, []byte(formattedPlantUML), 0644)
err := os.WriteFile(outPath, []byte(formattedPlantUML), 0644)
if err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package cmd

import (
"fmt"
"github.com/spf13/cobra"
"os"

homedir "github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

Expand Down
5 changes: 2 additions & 3 deletions domain/class.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ type (
func (class Class) HasRelation(toClass Class) bool {
for _, field := range class.Fields {
fieldTypeName := string(field.Type)
if strings.HasPrefix(fieldTypeName, "*") {
fieldTypeName = fieldTypeName[1:]
}

fieldTypeName = strings.TrimPrefix(fieldTypeName, "*")

if fieldTypeName == toClass.Name {
return true
Expand Down
3 changes: 2 additions & 1 deletion domain/class_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package domain

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestClass_HasRelation(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion domain/field_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package domain

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestField_IsPrivate(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion domain/function_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package domain

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestFunction_IsPrivate(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion domain/interface_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package domain

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestInterface_IsImplementedBy(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion domain/package_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package domain

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestPackages_AllClasses(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion domain/type_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package domain

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestType_ToString(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion formatter/plantUml.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package formatter

import (
"fmt"
"github.com/bykof/go-plantuml/domain"
"strings"

"github.com/bykof/go-plantuml/domain"
)

const PlantUMLInterfaceFormat = `interface %s{
Expand Down
1 change: 0 additions & 1 deletion test/user/models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ type (
LastName string
Age uint8
Address *models.Address
privateAddress models.Address
}
)

Expand Down

0 comments on commit d4b279c

Please sign in to comment.