Closed
Description
What version of Go are you using (go version
)?
go version go1.10.1 windows/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
GOHOSTARCH=amd64
GOHOSTOS=windows
What did you do?
go run -gcflags="all=-N -l" main.go
The contents of main.go
file:
package main
import (
"log"
"net/http"
"strings"
)
func indexHandler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`Hello world`))
if strings.Contains(strings.ToLower(r.UserAgent()), "chrome") {
w.Write([]byte(` from ` + r.UserAgent()))
}
}
func main() {
log.Println("starting server...")
http.HandleFunc("/", indexHandler)
log.Fatal(http.ListenAndServe(":8080", nil))
}
What did you expect to see?
I would expect the resulting binary to have the .debug_info
section present.
What did you see instead?
The debug info is not present, which means that Delve will fail with decoding dwarf section info at offset 0x0: too short
.
Using objdump -h binary.exe | grep -i debug_info
also does not show any section present in the executable produced by go run
but it's there for go build -gcflags="all=-N -l"
.