How to properly embed gorackhd in another project?
codenrhoden opened this issue · comments
My question here is stemming from #10. when working on github.com/codenrhoden/rackhdcli, I had originally started by working with gorackhd
directly. Because of that, I had previously go install
'd it.
To use gorackhd
, you have to go install
it, then do a make
to generate the clients with go-swagger
. When you run make
, gorackhd
uses glide to grab its dependencies and throw them in gorackhd/vendor
.
At first I went down a path that let me to #10, whereby I was no longer using Glide in my project and was counting on having previously go install
'd gorackhd
. I had forgotten how I got there, and @clintonskitson pointed out that was the wrong way to do things. I do need to use Glide and have gorackhd
in there as my dependency.
However, now I'm stuck on what to do next. If I use Glide to install gorackhd
, it is not going to run make
for me. I'd still have to run make
manually (or add it to a make in rackhdcli
, which seems less than ideal). In the end, I'm not seeing how I can ever do go install rackhdcli
and get something working as long as that make
step is in there.
On a side note, if I go into my resulting vendor
'd copy of gorackhd
and run make
, I still end up with a second vendor
directory and end up with mis-matched types. But I think this is an additional result of the make
process.
Just for clarity, here is my glide.yaml:
package: github.com/codenrhoden/rackhdcli
import:
- package: github.com/emccode/gorackhd
subpackages:
- client
- package: github.com/emccode/gorackhd-redfish
subpackages:
- client
- package: github.com/spf13/cobra
- package: github.com/spf13/viper
Am I doing this completely wrong?
@codenrhoden It would be wrong to assume that go install rackhdcli
will work. Because of dependencies and the fact that we do not embed those in the repos, this method won't work. It would be a go get -d rackhdcli
followed by a make
to build it properly. We don't expect people to interface with it in this way anyhow. The artifacts from the CI in Travis should yield uploads to bintray, which represent the best approach to running rackhdcli
.
Which package is complaining? Have you tried adding it to the glide file?
@codenrhoden as i had mentioned in our slack convo, I wouldn't focus on the go get
method to install your CLI. Instead, as @clintonskitson said, use binaries. Use your local system with all the files necessary to build the binary package, then you can use that as your release.
curl -L https://github.com/codenrhoden/rackhdcli/releases/download/v0.1.0/rackhd.`uname -s`-`uname -m` >/usr/local/bin/rackhd && chmod +x /usr/local/bin/rackhd
Going this route satisfies the majority of people and requires only individuals wishing to contribute to your repo to follow all the make
steps and have gorackhd
available locally.
I can definitely close this now. From working with docker-machine-rackhd, and creating the rackhdcli (my first go projects), I understand a lot better what needs to happen.
I didn't understand all those months ago how to properly use Glide, and how to flatten multiple projects dependencies into one vendor
directory.