Skip to content

Instantly share code, notes, and snippets.

@joshlf
Created January 5, 2014 20:17
Show Gist options
  • Save joshlf/8273261 to your computer and use it in GitHub Desktop.
Save joshlf/8273261 to your computer and use it in GitHub Desktop.
"go build" can be passed linker flags. If the "-s" flag is passed to remove debugging information, runtime reflection can break. Try building with 'go build' and with 'go build -ldflags "-s"' separately.
package main
import (
"fmt"
"reflect"
"runtime"
)
func main() {
fmt.Println(runtime.FuncForPC(reflect.ValueOf(main).Pointer()).Name())
}
@joshlf
Copy link
Author

joshlf commented Jan 5, 2014

Note: I ran this test on go1.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment