Go get fails with a 500 for deep nested projects

When go get fetches from a GitLab URL, it appends a ?go-get=1 parameter to the URL.

This is then used to redirect go get to the repository it should clone.

Unfortunately, this is failing for deep nested projects.

For example:

The command go get gitlab.com/group/sub-group/project/cmd/x will issue a request to https://gitlab.com/group/sub-group/project/cmd/x?go-get=1.

This should redirect go get to https://gitlab.com/group/sub-group/project/, and this works as expected for projects nested directly off the root namespace.

However, for deep nested projects, it does not work correctly, in that the client is redirected to the second level nesting, which in this case will be a group.

image

go get will then attempt to perform a git clone of https://gitlab.com/group/sub-group, which is a group and cannot be cloned.

From the client side, this will error, for example:

go get -v https://gitlab.com/gitlab-com/gl-infra/cloudflare
package https:/gitlab.com/gitlab-com/gl-infra/cloudflare: https:/gitlab.com/gitlab-com/gl-infra/cloudflare: invalid import path: malformed import path "https:/gitlab.com/gitlab-com/gl-infra/cloudflare": invalid char ':'
Edited by Tim Rizzi