Sharing Go code on Heroku from private github repositories.

300 views
Skip to first unread message

Tor Langballe

unread,
Apr 21, 2013, 5:16:32 AM4/21/13
to golan...@googlegroups.com
Hello

We have a shared PRIVATE repository of Go packages, and need to use them for different programs deployed to Heroku.
We have our shared code and programs all importing using full 


and


type syntax.

This works fine locally, where the repositories are all available.
When pushing to Heroku, however, the shared code obviously isn't accessible without authentication.

I've tried using git submodules, but Go doesn't like that, since I have to have a different import path for the shared packages then.

So I've settled on compiling locally and deploying to Heroku with https://github.com/ryandotsmith/null-buildpack (allows you to push binaries).

This might in many ways be more efficient, but now I have the trouble of not being able to cross-compile (to Linux AMD64) from Darwin since I use CGO.

Any bright ideas for a source-deploying method or a binary-cross-compile method? Either way I'm kind of stuck.

Tor


Hraban Luyat

unread,
Apr 21, 2013, 7:45:28 AM4/21/13
to golan...@googlegroups.com
we used to copy over the dependency repositories as part of the publish process. push the code to the GOPATH dir in your heroku app just as go get would do.

hraban

Tor Langballe

unread,
Apr 21, 2013, 9:33:05 AM4/21/13
to golan...@googlegroups.com
Is that possible? They are one-level outside the git repo I am pushing (since they are shared).

Kamil Kisiel

unread,
Apr 21, 2013, 9:35:42 AM4/21/13
to golan...@googlegroups.com
It actually doesn't matter how you get the packages, so long as the sources are in the right location corresponding to the package's import path within $GOPATH/src when you run the go tool. 

Dave Cheney

unread,
Apr 21, 2013, 9:40:09 AM4/21/13
to Kamil Kisiel, golang-nuts
To echo what Kamil said: you don't have to use the go tool, especially
if it isn't a good fit for the job. I would just use git directly,
checking out into the correct subdirectory of $GOPATH/src.
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Tor Langballe

unread,
Apr 21, 2013, 10:08:38 AM4/21/13
to golan...@googlegroups.com
Hmmm, maybe I don't understand something, but I use git to push code to Heroku, so everything has to be in one repo, which heroku compiles and deploys. The problem is thus accessing the shared code/packages/repo's from within what I've pushed, how to address them, since within heroku, there is no full go-source directory with everything I've gotten, just the one repo.

I'm not using the go tool, just pushing a repo to Heroku with git.

Keith Rarick

unread,
Apr 21, 2013, 1:19:34 PM4/21/13
to Tor Langballe, golang-nuts
This is something the Go buildpack on Heroku should try to do
better eventually. Currently it only runs the go tool.
Reply all
Reply to author
Forward
0 new messages