Skip to content

Unable to `go get` go-packages in repositories in nested sub groups deeper than 1

Summary

Similar to gitlab-foss#32149 (closed)

Steps to reproduce

For example: Returns correctly at the first level group, group/project

curl -X GET "https://gitlab.company.com/libraries/example?go-get=1"
<html><head><meta name="go-import" content="gitlab.company.com/libraries/example git https://gitlab.company.com/libraries/example.git" /></head></html>

group/subgroup/project returns trying to fetch the first subgroup.

curl -X GET "https://gitlab.company.com/libraries/subgroup1/example?go-get=1"
<html><head><meta name="go-import" content="gitlab.company.com/libraries/subgroup1 git https://gitlab.company.com/libraries/subgroup1.git" /></head></html>

group/subgroup/subgroup/project returns trying to fetch the first subgroup.

curl -X GET "https://gitlab.company.com/libraries/subgroup1/subgroup2/example?go-get=1"
<html><head><meta name="go-import" content="gitlab.company.com/libraries/subgroup1 git https://gitlab.company.com/libraries/subgroup1.git" /></head></html>

group/subgroup/subgroup/subgroup/subgroup/project returns trying to fetch the first subgroup.

curl -X GET https://gitlab.company.com/group/enable-eng/observability-engineering/libraries/go/observability-lambda?go-get=1
<html><head><meta name="go-import" content="gitlab.company.com/group/enable-eng git https://gitlab.company.com/group/enable-eng.git" /></head></html>

What is the current bug behavior?

Cannot fetch projects in subgroups without workaround below. Putting .git in the path before the project name. go get gitlab.company.com/group/enable-eng/observability-engineering/libraries/go/subgroup.git/project

What is the expected correct behavior?

go get should be able to fetch at any level of subgroup.

Here’s an example hitting public GitLab:

curl -X GET "https://gitlab.com/umputuntests/sub/example?go-get=1"
<html><head><meta name="go-import" content="gitlab.com/umputuntests/sub/example git https://gitlab.com/umputuntests/sub/example.git" /></head></html>

Results of GitLab environment info

Self-hosted 12.3.4

Edited by Kyle James