Skip to content

cmd/go: should default to use mod=vendor flag if the vendor folder exists #27227

@JeremyLoy

Description

@JeremyLoy

Please answer these questions before submitting your issue. Thanks!

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

go version go1.11 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"

What did you do?

  • Given a fresh install of go, there are no files downloaded in $GOPATH/pkg/mod.
  • I cloned a repo that uses the new Go 1.11 modules with vendored dependencies
  • I executed go run main.go to run the application.

What did you expect to see?

  • the application ran without downloading external dependencies.

What did you see instead?

  • The go tool downloaded all dependencies to $GOPATH/pkg/mod, despite the fact that the dependencies were vendored

I know this can easily be fixed by instead go run -mod=vendor main.go, but because the go tool is now being advertised as "context aware", I think this would be a good QoL change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.early-in-cycleA change that should be done early in the 3 month dev cycle.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions