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: modules in GitLab virtual directories resolve to truncated repo paths #33905

Closed
sashker opened this issue Aug 28, 2019 · 4 comments
Closed

Comments

@sashker
Copy link

@sashker sashker commented Aug 28, 2019

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

$ go version 1.12.3

Does this issue reproduce with the latest release?

Not tested

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

go env Output
$ go env
GOARCH="amd64"
GOBIN="/Users/user/go/bin"
GOCACHE="/Users/user/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/user/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.3/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/kj/g088t7n96bs3k0pcl0vbt09h0000gn/T/go-build835766205=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

When I try to get my module located on Gitlab which has virtual directories (i.e. Subgroups) in the path, then go get utility tries to download files from the wrong place.

 go get gitlab.com/bmitelecom/Kazoo/kazoo-go

 git ls-remote -q https://gitlab.com/bmitelecom/Kazoo.git in /Users/user/go/pkg/mod/cache/vcs/55c621ce033eb787541b307c3099c5c7a00422ba30170b0e047b6efcc66c823f: exit status 128:
        The project you were looking for could not be found.

So, for some reason, the path passed to git ls-remote was shorten and obviously wrong

What did you expect to see?

I expect to see the correct path which I specify for go get

What did you see instead?

The path is shorten

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Aug 28, 2019

The go command does not control the mapping of gitlab.com paths to repositories: see #29094 (comment).

Please run curl -Ls https://gitlab.com/bmitelecom/Kazoo/kazoo-go?go-get=1 | grep go-import and see what URL (if any) it reports.

If the go-import directive in the response indicates https://gitlab.com/bmitelecom/Kazoo.git, then this is an issue with GitLab's server and you'll need to take it up with them.

@bcmills bcmills changed the title cmd/go If a module URL has virtual directories then go get ignores real repo name cmd/go: modules in GitLab virtual directories resolve to truncated repo paths Aug 28, 2019
@bcmills bcmills added this to the Go1.14 milestone Aug 28, 2019
@sashker

This comment has been minimized.

Copy link
Author

@sashker sashker commented Aug 28, 2019

Thank you, @bcmills
You're right - Gitlab returns

https://gitlab.com/bmitelecom/Kazoo.git"

in response.

And it's interesting, that it doesn't matter actually whether repo exists or not - Gitlab always returns
path to the first subgroup.

@sashker

This comment has been minimized.

Copy link
Author

@sashker sashker commented Aug 28, 2019

I found the issue according to this problem: #50596

@bcmills bcmills removed the WaitingForInfo label Aug 28, 2019
@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Aug 28, 2019

In that case, I don't think there's anything to do in the go command to fix it, but please do let us know if you discover other issues in the process of getting a fix.

Note that you'll need go1.13beta1 or newer to work with private GitLab repos in general; see #29888.

@bcmills bcmills closed this Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.