izumin5210 / gex

The implementation of "clarify best practice for tool dependencies".
MIT License
51 stars 5 forks source link

Support executing commands in sub-directories #12

Closed izumin5210 closed 5 years ago

antonve commented 5 years ago

I have the same problem right now when I want to use gex together with go generate.

Suppose I have a app/server.go file:

//go:generate gex mockgen -source=server.go -package app -destination=server_mock.go

package app

...

and then run go generate app/server.go there is an error about being unable to detect a dependencies management tool. This is because go generate changes the working directory to that of the sub-package.

$ go generate app/server.go
failed to detect a dependencies management tool
app/server.go:1: running "gex": exit status 1

It might be a good idea to travel up the file tree to see if this package is being managed at a higher level already.

izumin5210 commented 5 years ago

I will try to fix it asap 🏃


:memo: golang/dep's implementation

https://github.com/golang/dep/blob/22125cfaa6ddc71e145b1535d4b7ee9744fefff2/project.go#L26-L47