-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: 'go mod tidy' does not add indirect private dependencies #28397
Comments
@gopherbot needsinvestigation modules |
@karysto taking your example; given This is working as intended. |
@myitcv thanks for taking a look. If the required dependencies (in this case |
@karysto sorry for just a quick comment, but does it seem like #26241 might be related? Also, would you be able to put together 3 or so short but representative (A full blown repository on github that shows what you are seeing would be even better, but maybe to start some sample |
@karysto If you're seeing a build failure then there is something else going on, because
Notice I'm using |
@thepudds thanks for the response, I'll setup a repo demonstrating the issue so that it can be reproduced. @myitcv I agree, |
@karysto
Not without a repro, no. |
What version of Go are you using (
go version
)?go version go1.11.1 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOCACHE="/home/karysto/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/karysto/go"
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=""
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-build201986556=/tmp/go-build -gno-record-gcc-switches"
What did you do?
I have a private repo I'm working on called
parent_repo
, it imports another private repo I wrote calledchild_repo
.child_repo
imports another private repo I wrote calledgrandchild_repo
. All of these repos havego.mod
files. In this case,grandchild_repo
is an indirect dependency ofparent_repo
.When I run
go mod tidy
onparent_repo
,child_repo
appears, butgrandchild_repo
does not. After addinggrandchild_repo
manually toparent_repo
's mod file (with an associatedreplace
directive to find it locally),go mod vendor
andgo build -mod=vendor
works perfectly, the build succeeds. The problem is that if I dogo mod tidy
onparent_repo
, my manually addedgrandchild_repo
entry is removed, and my builds fail.My use case is wanting to automate gathering dependencies to vendor before running a CI pipeline, but I can't right now because of this issue.
What did you expect to see?
I expected to see
go mod tidy
add my indirect dependency to go.mod (so that I didn't have to add it manually) and the build to succeed as a result.What did you see instead?
I see go.mod tidy remove the grandchild dependency and the build failing
The text was updated successfully, but these errors were encountered: