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 mydomain.com #3099

Closed
bradfitz opened this issue Feb 21, 2012 · 9 comments
Closed

cmd/go: go get mydomain.com #3099

bradfitz opened this issue Feb 21, 2012 · 9 comments
Milestone

Comments

@bradfitz
Copy link
Contributor

Thread/discusson CL:

https://groups.google.com/group/golang-dev/browse_thread/thread/7fdb05b7df59692d

http://golang.org/cl/5660051/ 



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="swtch.com/codesearch hg
https://code.google.com/p/codesearch";>

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 x.com/y/z then we're only
interested in the tag with a prefix that is a prefix of x.com/y/z.

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
Copy link
Contributor

rsc commented Feb 22, 2012

Comment 1:

sgtm

@niemeyer
Copy link
Contributor

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
content.
Something like having ?go-import=1 would already do it.

@bradfitz
Copy link
Contributor Author

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
Copy link
Contributor

Comment 4:

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

@bradfitz
Copy link
Contributor Author

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
Copy link
Contributor

Comment 6:

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

@rsc
Copy link
Contributor

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
Copy link
Contributor Author

Comment 8:

Done:
http://golang.org/cl/5660051/
(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
Copy link
Contributor Author

bradfitz commented Mar 6, 2012

Comment 9:

This issue was closed by revision 932c8dd.

Status changed to Fixed.

@bradfitz bradfitz self-assigned this Mar 6, 2012
@rsc rsc added this to the Go1 milestone Apr 10, 2015
@rsc rsc removed the priority-go1 label Apr 10, 2015
@golang golang 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.
Projects
None yet
Development

No branches or pull requests

4 participants