Hi, I want to port parts of an existing system written mainly in C++ and Python to Go. It depends on Protobuf and Thrift and I would like to keep the generated Go files outside $GOPATH, so that I don't have to check them into Git. For example, if GOPATH is /code/project/go, I'd like to output the generates go files in /code/project/gen-go/... and include it as a search directory for imports present in $GOPATH.
I tried go build -gcflags '-I /code/project/gen-go' - but it failed to find the package. Looking at the error message, it seems that -I didn't help and only $GOROOT and $GOPATH were searched:
a/b/simple.go:11:8: cannot find package "a/b/test_pb" in any of:
/usr/local/go/src/pkg/a/b/test_pb (from $GOROOT)
/code/project/go/src/a/b/test_pb (from $GOPATH)
where a/b/test_pb is present under /code/project/gen-go. Any suggestions on how to achieve this? Or is it not the advisable way to organize Go code?
Thanks,
Nipun