matryer / moq

Interface mocking tool for go generate
http://bit.ly/meetmoq
MIT License
2k stars 127 forks source link

Import aliases not maintained, cannot import multiple packages with same name #68

Closed shousper closed 3 years ago

shousper commented 6 years ago

We have an unfortunate case where we have packages with the same name imported:

package things

import (
    "context"

    pclient "github.com/example/client"
    mclient "github.com/micro/go-micro/client"
)

//go:generate moq -out client.mock.go . Client

type Client interface {
    GetByID(ctx context.Context, in *pclient.Client, opts ...mclient.CallOption) (*pclient.Response, error)
}

The generated code doesn't retain the import aliases meaning we have to find/replace a bunch of code post-generate. Any chance moq can retain the import aliases?

Thanks in advance!

sudo-suhas commented 3 years ago

This issue is resolved in moq v0.2.0.