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
heschi opened this issue Apr 25, 2018 · 4 comments
Closed

cmd/link: accepts nonsense ldflags #25085

heschi opened this issue Apr 25, 2018 · 4 comments

Comments

@heschi
Copy link
Contributor

heschi 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
Copy link
Contributor

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.

@heschi
Copy link
Contributor Author

heschi 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.

@heschi heschi closed this as completed Apr 25, 2018
@gopherbot
Copy link

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
Copy link

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
Development

No branches or pull requests

3 participants