-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Description
Problem statement:
We are working on the Go API for TensorFlow.
The problem is that this package depends on the tensorflow shared libraries, and in order to compile this libraries we depend on "go generate", but since there is no way to run "go generate" during the "go get" this package can't be go-gettable. I came up with this ugly solution:
$ TF_REPO=github.com/tensorflow/tensorflow/tensorflow/contrib/go/;go get $TF_REPO || (go generate $TF_REPO && go get $TF_REPO)
First I use the "go get" to clone the repo, if it is already installed, that's it, but if not it executes the "go generate" and the "go get" once again.
I think that it would be a good idea to add a way to execute "go generate" while executing "go get", something like a special comment on the package or so. This could be useful on situations like the described below as also on other cases like to generate protobuf files or any other code necessary to get the package so we don't need to upload them to the repository.
Possible solutions:
It could be nice to have a special comment like:
// go:get generate
or something like that in the package in order to force the execution of "go generate" before "go get".
Another option could be to add a -g
to "go get" but this could be more confusing for the users since they would need to know in advance that the flag is required to get the package.