Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
leviska opened this issue May 12, 2021 · 2 comments
Closed

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

leviska opened this issue May 12, 2021 · 2 comments

Comments

@leviska
Copy link

leviska commented May 12, 2021

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

@leviska leviska changed the title go get can't fetch repository with several nested groups go get can't fetch repository with several nested groups May 12, 2021
@seankhliao
Copy link
Member

It works provided go is given the correct credentials to make authorized http requests

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@leviska
Copy link
Author

leviska commented May 12, 2021

I have an ssh key and configured git to use ssh over https
And it works fine with 1 nested group (i.e. it works with gitlab.com/group1/[email protected]), but it doesn't work with 2 nested groups (gitlab.com/group1/group2/[email protected])

@golang golang locked and limited conversation to collaborators May 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants