I have my own PubSub package, which has a method SubscribeWithCallback. One of the arguments to this function is a function (used as a callback in this case)...
func (ps PubSub) SubscribeWithCallback(
c context.Context,
sub pubsub.Subscription,
callback func(context.Context, pubsub.Message),
) (context.Context, error) {
When I use go:generate with interfacer on my PubSub struct, the resultant interface is not syntactically correct and will not compile...
//go:generate interfacer -for github.com/my/repo/pubsub.PubSub -as psiface.PubSub -o psiface/pubsub_iface.go
pubsub_iface.go looks like this:
// Code generated by interfacer; DO NOT EDIT
package psiface
import (
"context"
"github.com/my/repo/psiface"
)
// PubSub is an interface generated for "github.com/my/repo/pubsub.PubSub".
type PubSub interface {
....
SubscribeWithCallback(context.Context, pubsub.Subscription, func(context.Context, cloud.google.com/go/internal/pubsub.Message)) (context.Context, error)
}
This has a syntax error as cloud.google.com/go/internal/pubsub.Message is not a valid type.
It seems that some step must be missing or bugged to handle arguments of functions passed as arguments.
I have my own PubSub package, which has a method
SubscribeWithCallback. One of the arguments to this function is a function (used as a callback in this case)...When I use go:generate with interfacer on my PubSub struct, the resultant interface is not syntactically correct and will not compile...
pubsub_iface.go looks like this:
This has a syntax error as
cloud.google.com/go/internal/pubsub.Messageis not a valid type.It seems that some step must be missing or bugged to handle arguments of functions passed as arguments.