Skip to content

go get can't fetch repository with several nested groups #46132

Closed
@leviska

Description

@leviska

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

$ go version
go version go1.16.3 linux/amd64

Does this issue reproduce with the latest release?

Can't test it right now, but probably yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/leviska/.cache/go-build"
GOENV="/home/leviska/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/leviska/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/leviska/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.3"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/leviska/projects/collector/go.mod"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build4043914452=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Having several nested groups in gitlab messes with go mod tidy (or go get)
Example: create two nested groups in gitlab, and repository inside it, so url will look like gitlab.com/group1/group2/repo
Create some module inside it
Try to do go get gitlab.com/group1/group2/repo or add this url to go.mod in another module
As far as I know, go mod works with github, where there is only one level of nesting in url, but in gitlab there can be several layers

What did you expect to see?

No errors

What did you see instead?

go: gitlab.com/group1/group2/[email protected]: reading gitlab.com/group1/group2/repo/repo/go.mod at revision repo/v1.0.0: unknown revision repo/v1.0.0
(yes, repo/repo is correct)

Fix

Somebody actually told me, how to fix it: add this line after require (in the end of the file)
replace gitlab.ozon.ru/group1/group2/repo => gitlab.ozon.ru/group1/group2/repo.git v1.0.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions