cmd/go: go get #3099

bradfitz opened this Issue Feb 21, 2012 · 9 comments


None yet
4 participants

bradfitz commented Feb 21, 2012

Thread/discusson CL: 

Final(?) design decision:


Okay, let's suppose we're not going to use the redirect.  It has this S3
problem but also has the implicit constraints I mentioned earlier.

What if instead we said that you fetch the page at that URL and look
for a <meta> tag?

<meta name="go-import" content=" hg";>

The three space-separated fields are import path prefix, vcs, repo root
corresponding to that import path prefix.  There can be more than one
meta tag, but if we just fetched the HTML for then we're only
interested in the tag with a prefix that is a prefix of

In the most trivial case, you can write a list of all your repositories and
put it in a global HTML template or in the 404 page.  You don't have to
generate a different line for each URL you serve (like you'd have to
generate a different redirect for each URL), it works with static content
servers, and it is still trivially testable in a browser.  In fact it encourages
people to make their import paths work in a browser.

rsc commented Feb 22, 2012

Comment 1:


niemeyer commented Feb 22, 2012

Comment 2:

As mentioned in the thread:
That looks nice, but can we please introduce the aspect of "go get"
using a query argument? Without something like that, we can't
distinguish who's being served at the server side, which restricts
possibilities like redirecting people to an external documentation
site like Gary's gopkgdoc, for example, or even generating the page
for go get dynamically without interfering with the normal site
Something like having ?go-import=1 would already do it.

bradfitz commented Feb 22, 2012

Comment 3:

A query parameter is a little gross, but I agree with the desire.  I'd prefer to do both
User-Agent and Accept header.  The User-Agent will show in almost everybody's typical
logs, and the Accept header is the "correct" way to signal this intent for a certain
type of content, and supported by mod_rewrite at least.
That work?

niemeyer commented Feb 22, 2012

Comment 4:

It'd be harder to see the information with a browser, but that works too.

bradfitz commented Feb 22, 2012

Comment 5:

I don't understand.
With a browser, your browser sends "Hi I'm FIrefox, and I Accept: text/html!".  And then
your webserver give it pretty javascript ponies.
With go get, the go http client sends, "Hi, I'm go get, and I Accept: text/html,
x-golang/go-imports".  And then your webserver gives it a lighter-weight HTML page with
just the metadata, and doesn't do any redirects.
What don't I follow?

niemeyer commented Feb 22, 2012

Comment 6:

How do you open a page in your browser to have a look at what "go get" is seeing?

rsc commented Feb 22, 2012

Comment 7:

Please use a query parameter.  I want to be able to test this using
just a browser.

bradfitz commented Feb 23, 2012

Comment 8:

(big CL description there now)
Tested many cases by hand, and setup the code for easy testability, but no test code
yet.  I will do that in a subsequent CL or at least once people are happy with the code.

bradfitz commented Mar 6, 2012

Comment 9:

This issue was closed by revision 932c8dd.

Status changed to Fixed.

bradfitz self-assigned this Mar 6, 2012

rsc added this to the Go1 milestone Apr 10, 2015

rsc removed the priority-go1 label Apr 10, 2015

gopherbot locked and limited conversation to collaborators Jun 24, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.