Closed johanbrandhorst closed 5 years ago
The examples are from running go generate
in https://github.com/johanbrandhorst/certify/tree/master/issuers/aws. There seems to be something about the aws interface that breaks it.
I might suggest importing the interface and assigning it to a new type local to that package, it is what I am doing with the /service/s3/s3iface
interface
package main
import "github.com/aws/aws-sdk-go-v2/service/acmpca/acmpcaiface"
//go:generate moq -out s3_moq_test.go . MockAPI
type MockAPI = acmpcaiface.ClientAPI
Tested, and this generates with ease.
Cool, thanks for the workaround!
@johanbrandhorst had the same problem, but it did work with go1.13 on local dev, while repeatedly failing on CI. My guess is that the version of "golang.org/x/tools" package is subtly modified (see also #98).
The problem appears specifically when using the -pkg
option.
As a workaround for the "go list..." issue complaining that the mocked package is not here, I prepared an empty valid go file just for this to pass.
mkdir -p {mockpackage}
echo "package {mockpackage}" > {mockpackage}/{generated}.go
I might suggest importing the interface and assigning it to a new type local to that package, it is what I am doing with the
/service/s3/s3iface
interfacepackage main import "github.com/aws/aws-sdk-go-v2/service/acmpca/acmpcaiface" //go:generate moq -out s3_moq_test.go . MockAPI type MockAPI = acmpcaiface.ClientAPI
This is unfortunately unacceptable as it changes the public API of the package. It seems I will have to keep using 1.12 for now.
I'm having the same issue
This command works with go 1.12:
but breaks badly with go 1.13:
Same version of
moq
in both cases,github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd
, e.g., current master.