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

Projects
None yet
3 participants
@FlashKnight
Copy link

commented Jul 7, 2015

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

This comment has been minimized.

Copy link
Contributor

commented Jul 7, 2015

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

@davecheney davecheney closed this Jul 7, 2015

@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

This comment has been minimized.

Copy link
Author

commented Jul 8, 2015

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

@junegunn junegunn referenced this issue Apr 25, 2016

Closed

Building on i686 #555

3 of 14 tasks complete

@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.
You can’t perform that action at this time.