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: "ldflags -X" variable setting does not error on bad paths #30782

Closed
larkost-fetch opened this issue Mar 12, 2019 · 3 comments
Closed
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@larkost-fetch
Copy link

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

1.12 or 1.11

Does this issue reproduce with the latest release?

The latest release on Docker, yes, I have not tried master

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

The golang:1.12 docker.

What did you do?

go run -ldflags "-X bad/path/bob.Worked=yes" alpha.go

What did you expect to see?

Some error telling me that I have a bad path.

What did you see instead?

The build succeeded and ran.

Discussion

The project I work on recently updated the version of Go we are using, and as part of the update some of the variables we are setting using ldflags "-X" stopped getting set because the path we were using was no longer recognized. I know that that mechanism changed, and that is not my objection.

Rather my objection is that the builds continued on without any errors to say we were now trying to set variables on modules that did not exist in the build. There should have been build-breaking errors to prompt us to figure out the problem immediately.

@julieqiu
Copy link
Member

@larkost-fetch - would you mind providing some more information about this issue, specifically a code sample and the output that you received after running that command?

@julieqiu julieqiu added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 12, 2019
@ianlancetaylor
Copy link
Contributor

I couldn't find the issue, but this is an explicit decision, because some build systems pass the same -X options to all programs, but not all programs include the variables being set. The -X option intentionally sets the variable if present and does nothing if absent.

@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.)

@golang golang locked and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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