Skip to content

Generating an interface where method parameter is a function causes it to miss imports #50

@anujchheda

Description

@anujchheda

If one of the methods has parameters which are functions that also have parameters that the generated interface file misses those imports
file bar.go

package interfaces

type Bar struct{}

func (*Bar) Foo(func(bar *Bar)) {}

file bar_interface.go

// Code generated by interfacer; DO NOT EDIT

package luts3

import (
	
)

// FooBar is an interface generated for "interfaces.Bar".
type FooBar interface {
	Foo(func(*interfaces.Bar))
}

It's missing the import for function parameter bar for the method parameter func(*Bar).

Instead it should be

// Code generated by interfacer; DO NOT EDIT

package luts3

import (
	"/path/interfaces"
)

// FooBar is an interface generated for "interfaces.Bar".
type FooBar interface {
	Foo(func(*interfaces.Bar))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions