gowrap icon indicating copy to clipboard operation
gowrap copied to clipboard

Generated imports fail when we have an alias

Open NoGambiNoBugs opened this issue 8 months ago • 0 comments

When we have some interface with methods that use parameters from another package that was imported with an alias... the result is not going well, just to explain:

This is working:

Code:

import ".../pkg/proto"

...

// MyInterface is a driven port.
//
//go:generate gowrap gen -g -i MyInterface -t ../templates/log.go.tmpl -o ./decorators/logs/url_shortener_gateway_with_logs.go
type MyInterface interface {
	MyMethod(ctx context.Context, body proto.Incomming) (proto.Outcomming, error)
}

This isn't working:

Code:

import alias ".../pkg/proto"

...

// MyInterface is a driven port.
//
//go:generate gowrap gen -g -i MyInterface -t ../templates/log.go.tmpl -o ./decorators/logs/url_shortener_gateway_with_logs.go
type MyInterface interface {
	MyMethod(ctx context.Context, body alias.Incomming) (alias.Outcomming, error)
}

I am using the latest version of package.

NoGambiNoBugs avatar Jun 19 '24 10:06 NoGambiNoBugs