cmd/go: Go build don't compiled files from the vendor folder by default? #63441
Labels
FrozenDueToAge
GoCommand
cmd/go
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOHOSTOS=windows
GOHOSTARCH=amd64
What did you do?
I ran the go mod vendor command and then edited a file within the vendor folder to troubleshoot a personal problem. However, when building, the compiler did not take into account the vendor folder with the file I modified.
Then I needed to build with the flag "go build -mod=vendor maing.go" and yes, it took into account the file I modified.
I looked in the Go doc (https://go.dev/ref/mod#build-commands) (By default, if the go version in go.mod is 1.14 or higher and a vendor directory is present, the go command acts as if -mod=vendor were used. Otherwise, the go command acts as if -mod=readonly were used.)
I then realized that it could be a possible bug because the vendor folder exists and therefore the compiler should take it into consideration without the need to explicitly pass the -mod=vendor flag.
What did you expect to see?
When modifying a file within the vendor folder I expected to know if a block of code was executed but it did not execute.
Example a simple log.Println("Ok Ok")
however it didn't happen.
What did you see instead?
That the compiler does not take into account the vendor folder
The text was updated successfully, but these errors were encountered: