How to load modules from gitlab subgroup?

I wrote a program and want to encapsulate some logic.

So I did new module and pull it in my git. Link for git looks like gitlab.xxx.ru/group/subgroup/proj but when I tried to get it with go get, I got error

fatal: «https://xxx.ru:@gitlab.xxx.ru/group/subgroup.git/» unreachable: URL using bad/illegal format or missing URL

Go tried to load subgroup instead project.

I made folder gitlab.xxx.ru/group/subgroup/ in $GOPATH/src/ and clone my project.

And now it wrote

could not import gitlab.xxx.ru/group/subgroup/proj (no required module provides package "gitlab.xxx.ru/group/subgroup/proj")

So, if I understand correctly, in Golang 1.16 I can’t just put my project in the correct directory and I can’t use local packages.

How to fix loading from my GitLab and load it with ssh?

Thank you.

UDP go.mod in my proj.

module gitlab.xxx.ru/group/subgroup/proj

go 1.16

require (
    golang.org/x/sys v0.0.0-20210608053332-aa57babbf139
    golang.org/x/text v0.3.6
)

Leave a Comment