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: Looping trying to add package when I go get a package that use go mod #33471

Closed
hbenhoud opened this issue Aug 5, 2019 · 2 comments
Closed

Comments

@hbenhoud
Copy link

@hbenhoud hbenhoud commented Aug 5, 2019

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

go version go1.12.6 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

Ubuntu 16.04

go env Output
$ go env

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/git/gitlab.user.com/work/project"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/user/git/gitlab.user.com/work/project/src/backend/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-build128257304=/tmp/go-build -gno-record-gcc-switches"

What did you do?

  • I have two projects pushed in gitlab (project1, project2), project2 is a library used in a project1.
  • I used go get to add dependencies of project2 in go.mod of project1 by using the following command "go get gitlab.user.com/work/project2@branch_name"

Example of project1:

project1
|_ src/backend/file1.go
|_ src/backend/main.go
|_ src/backend/go.mod
|_ src/backend/go.sum
|_ pkg/mod/gitlab.user.com/project/project2@v1.0.0/

Example of project2:

project2
|_ src/lib/file1.go
|_ src/lib/go.mod
|_ src/lib/go.sum

What did you expect to see?

When I download dependencies I expect to get project2 with his sources in pkg of project1

What did you see instead?

I have an empty folder (project2) added in pkg of project1

NOTE: when I remove go.mod and go.sum from project2 and I go get again I can fetch project2 in pkg of prorject1 with his provided sources (src/..)

@bcmills bcmills changed the title Looping trying to add package when I go get a package that use go mod cmd/go: Looping trying to add package when I go get a package that use go mod Aug 5, 2019
@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Aug 6, 2019

What you you mean by src/lib? What do you mean by “in pkg of project1”? (The GOPATH/pkg directory is not specific to a project or module.)

Absent a replace directive, go get fetches modules from their origin (such as gitlab.user.com/work/project2 in your example), not from GOPATH/src.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Sep 6, 2019

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.