Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: 'go get' appears to have no way to specify a branch in it that contains a `/` #36902

CyrusNajmabadi opened this issue Jan 30, 2020 · 4 comments


Copy link

@CyrusNajmabadi CyrusNajmabadi commented Jan 30, 2020

Extracting this bug out of the doc conversation that happened here #30851

Currently go get claims to be able to allow you to get a module hosted at a location with a given branch name. i.e. go get However, there seems to be no way to make this work if the branch has a / in it. i.e. neither go get nor go get work.

This effectively makes go get and modules non-viable for projects that use a very common and legal naming strategy for branches. Note that both git and github are fine with this sort of naming, and it's encouraged in many repos (as it helps keep the list of branches from getting very cluttered).

go get should not arbitrarily restrict the set of branch names it accepts.

You can write go get ...@deadbeef. however this only gives you a point-in-time version of the module. There does not seem to be a way to get all the functionality normaly present with a branch-link if the branch contains a /.


This comment has been minimized.

Copy link

@hausdorff hausdorff commented Jan 30, 2020

It's worth noting that there are a lot of people on that issue complaining about this. The skepticism expressed by maintainers that no one does this in the world is completely unwarranted. I've seen people do this at every company I've ever been in, and it is trivially easy to find Go projects on GitHub that actively use this strategy currently. For starters: basically any project that has to keep secrets back from PRs will use this strategy.

How can we help to fix this?


This comment has been minimized.

Copy link

@CyrusNajmabadi CyrusNajmabadi commented Jan 30, 2020

agreed. The original was closed with this comment:

Technically you could have a branch name with slashes in it. I sincerely doubt that many, if any, repositories containing Go code will have such branches.

Which was responded to with several dozen downvotes.

Even if this is a current heuristic for go get, there can certainly be fixes made here to deal with the issue. For example, allowing someone a way to just explicit specify a branch name with no restrictions from the go tool as to what it should be.

Heuristics (as stated by @bcmills here) are a bad thing. When it comes to this sort of decision, there should be a clear and easy way for people to specify the things they have that are otherwise entirely legal and normal today.


This comment has been minimized.

Copy link

@bcmills bcmills commented Jan 31, 2020

i.e. neither go get nor go get work.

When you say they don't work — what is the failure mode today?

(I would expect those to successfully resolve to a pseudo-version when fetching directly from source control, but not when fetching from a proxy.)

@bcmills bcmills changed the title 'go get' appears to have no way to specify a branch in it that contains a `/` cmd/go: 'go get' appears to have no way to specify a branch in it that contains a `/` Jan 31, 2020
@bcmills bcmills added this to the Backlog milestone Jan 31, 2020

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Mar 2, 2020

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.