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: Go 1.4.2 ldflags -s still shows the line numbers of the stack trace #11622

Closed
FlashKnight opened this issue Jul 7, 2015 · 2 comments

Comments

@FlashKnight
Copy link

What platform did I use for test:

Microsoft Windows 7 x86 , go 1.4.2 windows x86

What code did I use for test:

// test
package main

func main() {
    panic("golang")
}

What command did I use for complier the test program:

go build -ldflags "-s -w" test.go

What am I expected to see :

Should not print the line number in the stack trace.

What exactly did the complier show:

panic: golang

goroutine 1 [running]:
main.main()
        D:/Users/lenovo/Desktop/test.go:5 +0x54
...
So... Is it designed to always shows the line numbers ?
There may be security reason that some projects may needs to hide or strip some unexpected printing messages. So I just curious 😄
@davecheney
Copy link
Contributor

-s does not strip line number information.

-s is not tested and is not recommended as it is know to produce broken executables on multiple platforms.

@mikioh mikioh changed the title Go 1.4.2 ldflags -s still shows the line numbers of the stack trace cmd/link: Go 1.4.2 ldflags -s still shows the line numbers of the stack trace Jul 8, 2015
@FlashKnight
Copy link
Author

OK , I get it . I think this should be add into the golang document , as I was looking for some ideas to block the whole debugging messages

@golang golang locked and limited conversation to collaborators Jul 11, 2016
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