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

go4.org repo collides with go4.org/grpc #30

Closed
adg opened this issue Jun 9, 2017 · 12 comments · May be fixed by go4org/grpc#1
Closed

go4.org repo collides with go4.org/grpc #30

adg opened this issue Jun 9, 2017 · 12 comments · May be fixed by go4org/grpc#1

Comments

@adg
Copy link

adg commented Jun 9, 2017

If you do this

$ go get go4.org/grpc
$ go get go4.org/types

then the second command fails.

This is because go get doesn't support nested repositories, and it's not clear that this can or should work (there should be a corresponding issue for cmd/go; will file it). The workaround is to perform the commands in the opposite order.

@mpl
Copy link
Contributor

mpl commented Jun 9, 2017

Ah I understand, thanks.
that's unfortunate.

@mpl
Copy link
Contributor

mpl commented Jun 9, 2017

@bradfitz wouldn't it be enough to change

content="go4.org/grpc

into

content="go4.org

in the meta HTML returned by https://go4.org/grpc ?

I've never played with meta yet, so I'm going to test and see on a dummy repo.

Edit: ah nevermind, I see now that this would pull the contents of https://github.com/go4org/grpc directly into GOPATH/src/go4.org , which is def not what we want.

@mpl
Copy link
Contributor

mpl commented Jun 9, 2017

ok, I think this would work:

  1. merge Move everything into a grpc dir grpc#1

  2. change the meta tag at https://go4.org/grpc

to:

<meta name="go-import" content="go4.org git https://github.com/go4org/grpc">

WDYT?

@mpl mpl reopened this Jun 9, 2017
@bradfitz
Copy link
Contributor

bradfitz commented Jun 9, 2017

I'd rather not move everything down a directory in my fork, as I'm trying to keep the git history and file layout roughly compatible (and comparable) with the official grpc-go upstream git repo. That's why I didn't just copy everything into go4's git repo, for instance.

If I'd known about this problem before, I wouldn't have gone this route and I might've used a subdomain of go4.org instead. Maybe I still should, even if import "grpc.go4.org/grpc" isn't as pretty of an import.

Still thinking. Ideas welcome.

@dmitshur
Copy link
Contributor

dmitshur commented Jun 9, 2017

even if import "grpc.go4.org/grpc" isn't as pretty of an import.

Have you considered an import "grpc.go4.org" import path instead? Less stuttering. I'm not aware of a reason it wouldn't work; is there one?

You'd want https://grpc.go4.org?go-get=1 to serve:

<meta name="go-import" content="grpc.go4.org git https://github.com/go4org/grpc">

@bradfitz
Copy link
Contributor

bradfitz commented Jun 9, 2017

Have you considered an import "grpc.go4.org" import path instead? Less stuttering. I'm not aware of a reason it wouldn't work; is there one?

Interesting thought.

Are there examples of anybody else doing this?

The closest I can think of is "golang.org/x/oauth2" which is only interesting in that its package files are in the root of its git repo and not under a subdirectory.

But yeah, I can't think of why that wouldn't work.

@dmitshur
Copy link
Contributor

dmitshur commented Jun 9, 2017

Are there examples of anybody else doing this?

What exactly are you referring to by "this"? Using the root of a domain as a custom import path of a Go package, or something else?

One example I can think off the top of my head is:

(I'm aware of it from golang/go#13506 and golang/gddo#355.)

The closest I can think of is "golang.org/x/oauth2" which is only interesting in that its package files are in the root of its git repo and not under a subdirectory.

That's pretty common, most projects that have custom import paths are at the root of the git repo, e.g.:

@bradfitz
Copy link
Contributor

bradfitz commented Jun 9, 2017

Yes, "this" == "root of a domain as a custom import path".

Super excited to hear that works. I'll set that up now.

Thanks!

bradfitz added a commit to go4org/grpc that referenced this issue Jun 9, 2017
Follow-up to 9f3812d. Turns out the cmd/go tool doesn't like
having go4.org/* in one git repo and go4.org/grpc in a different repo.

Updates go4org/go4#30
bradfitz added a commit to go4org/grpc-codegen that referenced this issue Jun 9, 2017
gopherbot pushed a commit to golang/build that referenced this issue Jun 9, 2017
Fixes go4org/go4#30

Change-Id: Id914ac18bb5bed723a14147d239496aa165e1f3a
Reviewed-on: https://go-review.googlesource.com/45272
Reviewed-by: Brad Fitzpatrick <[email protected]>
@bradfitz
Copy link
Contributor

bradfitz commented Jun 9, 2017

Done.

Let me know if there are problems or parts I forgot.

Thanks!

@bradfitz bradfitz closed this as completed Jun 9, 2017
@dmitshur
Copy link
Contributor

dmitshur commented Jun 9, 2017

Super excited to hear that works.

It's one of the things I really appreciate about Go (and contribute fixes when needed): it's simple and has few unexpected edge cases. Vanity import paths are just schema-less URLs, and a URL with the path value "/" (i.e., domain root) is no more special than "/foo/bar", so it's nice that it works equally well as an import path. 😊

@dmitshur
Copy link
Contributor

dmitshur commented Jun 9, 2017

This is because go get doesn't support nested repositories, and it's not clear that this can or should work (there should be a corresponding issue for cmd/go; will file it).

The situation with nested/overlapping repositories is interesting. @adg, did you file that cmd/go issue? What number is it? I'd like to follow it.

@bradfitz
Copy link
Contributor

He didn't. Feel free to file one yourself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants