rjeczalik / interfaces

Code generation tools for Go.
MIT License
420 stars 31 forks source link

fix fixup when include other package struct #14

Closed Konboi closed 4 years ago

Konboi commented 4 years ago

When I define method that contain other package struct slice, generated invalid Field interface

eg)

// github.com/rjeczalik/interfaces/test/sample
package sample

import (
    "github.com/rjeczalik/interfaces/test/hoge"
)

type Sample struct{}

func (s *Sample) Hoges() []*hoge.Hoge { return []*hoge.Hoge{&hoge.Hoge{}} }
interfacer -for 'github.com/rjeczalik/interfaces/test/hoge'.Sample -as hoge.Sampler -o sample.gen.go

generated

// github.com/rjeczalik/interfaces/test/sample.gen.go
package sample

type Sampler interface {
  Hoges() *[]github.com/rjeczalik/interfaces/test/hoge.Hoge
}

refs: https://github.com/rjeczalik/interfaces/issues/13


so I fixed fixup method

Konboi commented 4 years ago

fixed