Created a regular package in a directory named vendor, not created with go mod vendor, not using -mod=vendor.
! go list -deps example.com/m
-- go.mod --
module example.com/m
go 1.14
-- use.go --
package use
import (
_ "example.com/m/vendor"
_ "example.com/m/vendor/x"
)
-- vendor/vendor.go --
package vendor
-- vendor/x/x.go --
package x
What did you expect to see?
Errors reported for packages in vendor/ when -mod=vendor is not active.
These are being treated as regular packages. Other modules won't be able to import these packages, since vendor directories are excluded from module zip files.
What did you see instead?
go list treats these like regular packages:
$ go list -deps example.com/m
example.com/m/vendor
example.com/m/vendor/x
example.com/m
Hm, I'm on the "it may just be confusing" side: my intuition is either
* "vendor" is meaningless outside of mod=vendor mode, acting like a normal package (which would be confusing be cause mod=vendor would result in a different build when it's on or off)
or better
* the only directory that's allowed to be named vendor must be in the root directory of a module, and when mod=vendor is off, all the source contained in that directory is ignored, and an error is reported if code is contained directly in vendor/
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, also reproduces with 1.14rc1.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Created a regular package in a directory named
vendor
, not created withgo mod vendor
, not using-mod=vendor
.What did you expect to see?
Errors reported for packages in
vendor/
when-mod=vendor
is not active.These are being treated as regular packages. Other modules won't be able to import these packages, since vendor directories are excluded from module zip files.
What did you see instead?
go list
treats these like regular packages:cc @matloob @bcmills
The text was updated successfully, but these errors were encountered: