Skip to content

Commit

Permalink
reorganization
Browse files Browse the repository at this point in the history
  • Loading branch information
RangelReale committed Feb 8, 2023
1 parent 3fdb7f2 commit 36a8f11
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions pkg/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,25 +117,6 @@ func (g *Generator) addPackageImport(ctx context.Context, pkg *types.Package) st
return g.addPackageImportWithName(ctx, pkg.Path(), pkg.Name())
}

type replaceType struct {
alias string
pkg string
typ string
}

func parseReplaceType(t string) replaceType {
ret := replaceType{}
r := strings.SplitN(t, ":", 2)
if len(r) > 1 {
ret.alias = r[0]
t = r[1]
}
lastInd := strings.LastIndex(t, ".")
ret.pkg = t[:lastInd]
ret.typ = t[lastInd+1:]
return ret
}

func (g *Generator) checkReplaceType(ctx context.Context, f func(from replaceType, to replaceType) bool) {
for _, replace := range g.ReplaceType {
r := strings.SplitN(replace, "=", 2)
Expand Down Expand Up @@ -935,3 +916,22 @@ func resolveCollision(names map[string]struct{}, variable string) string {

return ret
}

type replaceType struct {
alias string
pkg string
typ string
}

func parseReplaceType(t string) replaceType {
ret := replaceType{}
r := strings.SplitN(t, ":", 2)
if len(r) > 1 {
ret.alias = r[0]
t = r[1]
}
lastInd := strings.LastIndex(t, ".")
ret.pkg = t[:lastInd]
ret.typ = t[lastInd+1:]
return ret
}

0 comments on commit 36a8f11

Please sign in to comment.