Skip to content

Change the target directory into which go get clones the repo #27850

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

Closed
EVODelavega opened this issue Sep 25, 2018 · 1 comment
Closed

Change the target directory into which go get clones the repo #27850

EVODelavega opened this issue Sep 25, 2018 · 1 comment

Comments

@EVODelavega
Copy link

What version of Go are you using (go version)?

go version go1.10.4 linux/amd64

Does this issue reproduce with the latest release?

Yes, reproduced with go version go1.11 linux/amd64

What operating system and processor architecture are you using (go env)?

Linux/amd64, specifically Fedora 28

What did you do?

Cloning a private gitlab repository using go get. The url looked something like git.foo.io/main-serivces/subcategory/my-service. I had to add .git explicitly: go get git.foo.io/main-services/subcategory/my-service.git.
Don't think it's relevant, but worth noting: the repo was empty when I cloned it.

What did you expect to see?

I expected/hoped to find my code under $GOPATH/src/git.foo.io/main-services/subcategory/my-service

What did you see instead?

Instead, the path was $GOPATH/src/git.foo.io/main-services/subcategory/my-service.git

There's 2 possible solutions that I'd like to propose.

  1. Add a flag to go get to specify the target path where you want to checkout the package, or a flag to strip the .{git|svn|whatever} from the path. Arguably, this should be the default behaviour, that can be disabled using a flag.
    If this should not be the default behaviour, I'm thinking a flag like -s[trip]=.git might be worth adding.

  2. either change the last catchall regexp in cmd/go/internal/get/vcs.go, or add a next-to-last one that handles generic .git repo's (ie a url containing \bgit\.\b, or simply ending in .git), and trim the .git` from the target directory/path

I'm perfectly happy working on either one of these solutions, depending on which would be the preferred approach. If this is a bad idea, feel free to tell me so, and I'll leave it at that, although I'd like to know why this would not be a useful feature.

@EVODelavega
Copy link
Author

EVODelavega commented Sep 25, 2018

Closing because this seems to be an issue related to gitlab (incorrect meta - only applies to subgroups).

https://gitlab.com/gitlab-org/gitlab-ce/issues/1337#note_36293613

Quite a depressing read, BTW

@golang golang locked and limited conversation to collaborators Sep 25, 2019
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

2 participants