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 vendor some replace pkg didn't inside vendor #28633

Open
lizihuai opened this Issue Nov 7, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@lizihuai

lizihuai commented Nov 7, 2018

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

$ go version go1.11 linux/amd64

Does this issue reproduce with the latest release?

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

go env Output
$ go env

What did you do?

GO111MODULE=on go mod download
GO111MODULE=on go mod vendor

I use "replace" in go.mod file . like replace golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac => github.com/golang/crypto v0.0.0-20180820150726-614d502a4dac use go mod download ,downloaded package in “src/pkg” directory , but when use go mod vendor some pkg didn't inside the vendor

What did you expect to see?

What did you see instead?

@ianlancetaylor ianlancetaylor changed the title from go mod vendor some replace pkg didn't inside vendor to cmd/go: go mod vendor some replace pkg didn't inside vendor Nov 7, 2018

@ianlancetaylor ianlancetaylor added this to the Go1.12 milestone Nov 7, 2018

@ianlancetaylor

This comment has been minimized.

Contributor

ianlancetaylor commented Nov 7, 2018

@bcmills

This comment has been minimized.

Member

bcmills commented Nov 7, 2018

when use go mod vendor some pkg didn't inside the vendor

I don't know what that means. Please provide explicit steps that we can follow exactly to reproduce the problem, ideally starting from an empty directory.

Note that go mod vendor “[includes] all packages needed to build and test all the main module's packages”, not all packages from the modules needed to build and test the main module. Packages that are not needed to build the main module are not vendored.

@lizihuai

This comment has been minimized.

lizihuai commented Nov 8, 2018

for example ,go.mod like (fake code)

module github.com/lizihuai/test

require (
golang.org/x/net v0.0.0-20180824152047-4bcd98cce591
google.golang.org/grpc v1.14.0
k8s.io/api v0.0.0-20180925152912-a191abe0b71e // indirect
k8s.io/apimachinery v0.0.0-20180823151430-017bf4f8f588
)

replace (
golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac => github.com/golang/crypto v0.0.0-20180820150726-614d502a4dac
golang.org/x/net v0.0.0-20180824152047-4bcd98cce591 => github.com/golang/net v0.0.0-20180824152047-4bcd98cce591
golang.org/x/sys v0.0.0-20180824143301-4910a1d54f87 => github.com/golang/sys v0.0.0-20180824143301-4910a1d54f87
golang.org/x/text v0.3.0 => github.com/golang/text v0.3.0
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 => github.com/golang/time v0.0.0-20180412165947-fbb02b2291d2
)

use go mod download be downloaded no matter what use requireor or replace but go mod vendor some pkg not inside " vendor" , like "golang.org/x/sys" (the project use all of the above packages)

@bcmills

This comment has been minimized.

Member

bcmills commented Nov 9, 2018

Please provide explicit steps that we can follow exactly to reproduce the problem, ideally starting from an empty directory.

go mod vendor uses the import graph of the actual Go source files to decide what to copy. To diagnose the problem, we need at least enough of the source files to capture that import graph.

Note that go mod why -m -vendor can tell you whether or why a given module should be present in vendor.

@bcmills bcmills modified the milestones: Go1.12, Go1.13 Nov 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment