vburenin / ifacemaker

Generate interfaces from structure methods.
Apache License 2.0
320 stars 43 forks source link

Imported packages that end with the name of the current package are replaced incorrectly #42

Closed Peter-Maguire closed 4 years ago

Peter-Maguire commented 4 years ago

e.g

package xyz

import "example.com/abcdxyz"

type Demo struct {
}

func (demo *Demo) TestFunction(input abcdxyz.ImportedType){

}

would create an interface of

package x

type Demo interface{
   TestFunction(input abcdImportedType)
}

The offending line of code is here: https://github.com/vburenin/ifacemaker/blob/master/maker/maker.go#L100

vburenin commented 4 years ago

Thanks a lot! Could you fix it please and submit PR? I will not be able to get access to my dev environment for months to come :(