kevinconway / wrapgen

Interface wrapper generator for Go
Apache License 2.0
26 stars 9 forks source link

Can't emit wrapped file in to same package as source #6

Closed MarkSRobinson closed 6 years ago

MarkSRobinson commented 6 years ago

Running

wrapgen -t template.txt -p <root>/gateway/ufeed | goimports > gateway/ufeed/ufeed_wrap.go

Causes this error

open /usr/local/Cellar/go/1.9.3/libexec/src/<root>/gateway/ufeed: no such file or directory

kevinconway commented 6 years ago

I believe the issue may be in the definition of <root> for this example. The binary expects go import paths for the -p or --package option. It also expects the paths to be resolvable using the same path hierarchy that the import statement uses which is ${GOPATH}/src and ${GOROOT}/src.

Another way of putting it is that any package you want to render needs to have a valid import path that is discoverable from the GOPATH.

The default GOPATH for installs nowadays is the ~/go directory which should contain your package somewhere. If it already does then try adjusting the package name given to the binary to only path below ${GOPATH}. For example, if your project is ${GOPATH}/src/gateway/ufeed then the -p argument should be gateway/ufeed.

Let me know if this resolves the issue for you.

kevinconway commented 6 years ago

Hey there, I'm going to close the issue since I'm unable to reproduce. If you keep having this issue, please re-open the issue and I'll take another look.