Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Methods containing type literals can't be mocked in source mode #8

Closed
@peterstace

Description

@peterstace

If an interface has a method containing a literal struct type, then mockgen isn't able to generate a mock when using source mode.

E.g. interfaces.go:

type Foo interface {
    Baz(struct{})
}

type Bar interface {
    Baz() struct{}
}

$ mockgen -source=interfaces.go gives the following error: 2015/08/18 15:02:43 Loading input failed: interfaces.go:6:5: failed parsing arguments: don't know how to parse type *ast.StructType.

The mocks can be generated successfully when using mockgen in reflect mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions