Skip to content
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

cmd/go: project depending on project using modules not building: "error loading module requirements" #31929

Closed
sab84 opened this issue May 9, 2019 · 7 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@sab84
Copy link

sab84 commented May 9, 2019

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

$ go version
go version go1.12.4 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/me/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/me/localrepo"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.4/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/me/golangrepo/content-config/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0d/wcqqd_f523b517dqn0ghdwqc1qjkyx/T/go-build771363169=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I have a project "a", which uses modules, that has dependency on code that is another project "b" which uses modules.

go.mod line # 1 in project "b":
module <private_gitlab_repo>/<group>/<subgroup>/<project "b" name>

import statement in project "a":
"<private_gitlab_repo>/<group>/<subgroup>/<project "b" name>.git/internal/parser"

What did you expect to see?

go build should complete correctly

What did you see instead?

go: <private_gitlab_repo>/<group>/<subgroup>/<project "b" name>.git@v0.0.0-20190508223317-420ea8aa2597: parsing go.mod: unexpected module path "<private_gitlab_repo>/<group>/<subgroup>/<project "b" name>" go: error loading module requirements

What am I doing wrong ?

@beoran
Copy link

beoran commented May 9, 2019

I think you don't need the .git in the import statement.

@sab84
Copy link
Author

sab84 commented May 9, 2019

@beoran , that didn't work either.

build <private_gitlab_repo>/<group>/<subgroup>/<project "a">: cannot load <private_gitlab_repo>/<group>/<subgroup>/<project "b">/internal/parser: cannot find module providing package <private_gitlab_repo>/<group>/<subgroup>/<project "b">/internal/parser

@sab84
Copy link
Author

sab84 commented May 9, 2019

Also, I am able to depend on other internal project with the ".git" in the import statement and the go build command correctly updated the mod file with the project reference. The only difference is that this third project is not using modules.

@andybons andybons changed the title Project depending on project using modules not building: "error loading module requirements" cmd/go: project depending on project using modules not building: "error loading module requirements" May 13, 2019
@andybons andybons added modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels May 13, 2019
@andybons andybons added this to the Unplanned milestone May 13, 2019
@andybons
Copy link
Member

@jayconrod @bcmills

@bcmills
Copy link
Contributor

bcmills commented May 13, 2019

The path-mismatch error is due to the lack of .git suffix in the module directive.
The cannot find module providing package error is #26232.

This looks like a duplicate of #26232. In the interim, you should be able to work around it using:

replace <private_gitlab_repo>/<group>/<subgroup>/a v0.0.0-20190508223317-420ea8aa2597 => <private_gitlab_repo>/<group>/<subgroup>/a.git v0.0.0-20190508223317-420ea8aa2597

@bcmills
Copy link
Contributor

bcmills commented May 13, 2019

Actually, for GitLab specifically this is #29888.

@bcmills
Copy link
Contributor

bcmills commented May 13, 2019

Duplicate of #29888

@bcmills bcmills marked this as a duplicate of #29888 May 13, 2019
@bcmills bcmills closed this as completed May 13, 2019
@golang golang locked and limited conversation to collaborators May 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants