diff --git a/src/cmd/compile/internal/ssa/stmtlines_test.go b/src/cmd/compile/internal/ssa/stmtlines_test.go index 4dadfe86307..dd3ce7c1d87 100644 --- a/src/cmd/compile/internal/ssa/stmtlines_test.go +++ b/src/cmd/compile/internal/ssa/stmtlines_test.go @@ -75,8 +75,15 @@ func TestStmtLines(t *testing.T) { } } + // Build cmd/go forcing DWARF enabled, as a large test case. + dir := t.TempDir() + out, err := testenv.Command(t, testenv.GoToolPath(t), "build", "-ldflags=-w=0", "-o", dir+"/test.exe", "cmd/go").CombinedOutput() + if err != nil { + t.Fatalf("go build: %v\n%s", err, out) + } + lines := map[Line]bool{} - dw, err := open(testenv.GoToolPath(t)) + dw, err := open(dir + "/test.exe") must(err) rdr := dw.Reader() rdr.Seek(0) diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index 343f0ce332f..25f75804e04 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -1328,7 +1328,7 @@ func toolenv() []string { // Do not include local development, so that people working in the // main branch for day-to-day work on the Go toolchain itself can // still have full paths for stack traces for compiler crashes and the like. - env = append(env, "GOFLAGS=-trimpath") + env = append(env, "GOFLAGS=-trimpath -ldflags=-w -gcflags=cmd/...=-dwarf=false") } return env }