I'm adding Go support to a multi-language project. The go tools are
almost great but a little inflexible. I think it would be easy to fix, I have very specific problems and suggestions.
The project has C and Java libraries and language bindings for the C library: python, ruby, php, javascript... and now go. For testing purposes it is not reasonable to separate each binding into it's own repo. In any case it's not my repo, I can argue for change but "go tools can't hack it" isn't a strong argument.
I want my packages to have sensible names e.g.
qpid.apache.org/proton/events, so I set up <meta> tags at
qpid.apache.org.
PROBLEMS:
1. go get <meta> tags only allow you to alias a repository *root*. My packages would be
qpid.apache.org/proton/proton-c/bindings/go/events. That sucks. I created a "go" symlink so my packages are
qpid.apache.org/proton/go/events. Still sucks but less.
2. My work was on a branch called "go". 'go get' will only get branches master or "go1" So I renamed my branch "go1". Now I can do 'go get', hurray!
3. go doc -http doesn't follow symlinks, but it
does follow every other path. So it displays nonsense empty packages e.g. "proton/examples/go" It displays my packages under the long path. I moved the go directory to repo root and the symlink to where it should be. This is significant repo surgery to facilitate a tool. Not cool. I'm still on a branch so nobody cares, yet. Now go doc works for my packages but
still produces nonsense for the examples.
4. I develop in a lot of languages. I cannot have every language dictating where I put my clones (git is the first language that has tried). Symlinks from the go workspace would be fine but see problem 3.
SUGGESTIONS (implementation suggests are just ideas, ignore at will if there's a better way)
1. All go tools should handle symlinks in the workspace. Even
windows has symlinks now.
2. <meta> tags should be able to alias a subdirectory
and a branch in a repository.
master is not even required by git it's just a (very common) convention.
The import path syntax already almost allows this (no branch) so you could kill two birds with one stone, extend the import path syntax and use it in the meta tags for a consistent package-locating experience. Here's a backward compatible suggestion:
<meta name="go-import" content="
qpid.apache.org/proton git
https://git-wip-us.apache.org/repos/asf/qpid-proton.git/proton-c/bindings/go?branch=go1">
I don't care about the syntax as long as I can specify repo, path and branch.
When 'go get' sees that tag it could check out the repo but not directly in the src tree:
$GOPATH/repos/
qpid.apache.org/protonand create a symlink:
$GOPATH/src/
qpid.apache.org/proton -> ../../repos/
qpid.apache.org/proton/proton-c/bindings/gonow all the other go tools work unmodified (except for symlink support) and do exactly what I want.
If I have missed anything and it is possible to solve my problems with the existing go tools then apologies and please tell me how. I did ask on go-nuts, the situation above is as far as I could get.