Skip to content
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 build don't compiled files from the vendor folder by default? #63441

Closed
faelp22 opened this issue Oct 7, 2023 · 2 comments
Closed
Labels
GoCommand cmd/go WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@faelp22
Copy link

faelp22 commented Oct 7, 2023

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

$ go version
GOVERSION=go1.21.2

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

image

@seankhliao
Copy link
Member

seankhliao commented Oct 7, 2023

please provide the output of go env and a self contained reproducer

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Oct 7, 2023
@bcmills bcmills added the GoCommand cmd/go label Oct 13, 2023
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants