Gitlab Subgroup + go get

Given:

Suppose your dependency lives at:

https://gitlab.your-company.tld/project-group/lib-group/lib

Unfortunately, you can’t install it just by passing the package name. There are two paths forward:

The first option is the simplest, but I think most would agree it’s pretty unappealing.

The second option, using replace, would look like this for the example above:

module ...

go 1.XX

require (
        ...
        gitlab.your-company.tld/project-group/lib-group/lib vTAG
        ...
)

replace gitlab.your-company.tld/project-group/lib-group/lib => gitlab.your-company.tld/project-group/lib-group/lib.git v<TAG>

You may also need a url rewrite in ~/.gitconfig, but it’s better to confirm that with whoever set up your gitlab. In the overwhelming majority of cases it’ll look something like this:

[url "ssh://git@gitlab.your-company.tld:"]
        insteadOf = https://gitlab.your-company.tld