like to have is the ability to use private repositories. The issue that
you quickly run into is that the "standard" for fetching Go dependencies is
either "go get" or "godep" (which, as far as I can tell, uses "go get" or
at least the "vcs" stuff beneath the surface).
So the bottom line is that I spent some time trying to figure out how to be
able to use private repositories. I found a lot of people with this issue,
but many claim it can't be done or even that the Go documentation is
Looking at the machinery, it seems that Go is perfectly capable of
supporting private repositories but there are some really minor hang ups.
The first thing is that people wanting to use private repositories are
generally expecting to use SSH. As far as I can tell, the main hangup here
is actually just the ordering of schemes in vcs.go. The "https" scheme
comes before the "git+ssh" scheme. As a result, when it gets a hit on "git
ls-remote https://..." it seems to think that is the preferred scheme. If
the authentication fails, it simply seems to give up. The sad thing is
that git+ssh is in the list (and this would be the best choice, as far as I
can tell, for private repos) but it just never gets there (at least if you
are using GitHub, since GitHub offers an https transport layer).
Was there a specific reason that https is "preferred" over git+ssh? To be
clear, GitHub supports the git+ssh scheme which means the current "go get"
infrastructure would probably work just fine for dealing with private
repositories (assuming you had the right SSH private key and perhaps a bit
of setup in ~/.ssh/config).
On a somewhat related note, it is a bit of a shame that the import path
stuff is so...rigid. It doesn't seem to support a general scheme for
turning import paths into URLs. The documentation seems to imply that this:
is transformed into a url of the form:
where several schemes are tried. However, there is clearly some logic
behind the scenes because this doesn't work for:
something=identifier (i.e. a non-dot qualified name, despite the presence
of .git explicitly in the import path)
something=hostname:port/path (i.e. if a port specification or even user
specification is present in <something>)
I know there is special code to look for patterns related to providers like
github and bitbucket. But it seems like this interferes with other
potentially legal URL components that are not from those providers.
Overall, I think that being able to easily utilize code in private
repositories is important (at least it is important to me). At the end of
the day, it seems very useful to me that it should be possible to import
(i.e. via "go get") code from private repositories. Am I missing
something? Is anybody working on this? Is there some reason (other than a
lack of pull requests) why this wasn't done?
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 email@example.com.
For more options, visit https://groups.google.com/d/optout.