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/link: accepts nonsense ldflags #25085

Closed
heschik opened this issue Apr 25, 2018 · 4 comments
Closed

cmd/link: accepts nonsense ldflags #25085

heschik opened this issue Apr 25, 2018 · 4 comments

Comments

@heschik
Copy link
Contributor

@heschik heschik commented Apr 25, 2018

I don't think this should succeed:

~/go/bin/go build -ldflags=a=b hello.go  && ./hello
hi

I haven't checked the code, but from strace it looks like go build is swallowing ldflags that don't start with a -.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Apr 25, 2018

The syntax -ldflags=a=b means "pass b to all packages that match the pattern a". If there are no packages that match the pattern a, then the flag will never be passed.

@heschik

This comment has been minimized.

Copy link
Contributor Author

@heschik heschik commented Apr 25, 2018

Oh. That makes sense, I just didn't even consider that that syntax would apply to ldflags. I'm not sure what good it is, but it's not a bug. Thanks.

@heschik heschik closed this Apr 25, 2018
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Apr 26, 2018

Change https://golang.org/cl/109355 mentions this issue: cmd/link: fix test flag

gopherbot pushed a commit that referenced this issue Apr 26, 2018
Doesn't cause an error, see #25085.
But we should fix it nonetheless.

Change-Id: I7b6799e0a95475202cacefc3a7f02487e61bfd31
Reviewed-on: https://go-review.googlesource.com/109355
Reviewed-by: Heschi Kreinick <heschi@google.com>
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Oct 14, 2018

Change https://golang.org/cl/142003 mentions this issue: strings, bytes: Add ToValidUTF8

@golang golang locked and limited conversation to collaborators Oct 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.