From 4e26ab0ed891530cd07174813b89cea04b0fa559 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 14 Mar 2022 10:29:51 -0700 Subject: [PATCH] cmd/go: document that 'go run' strips debug info Change-Id: Ie7293a33862853ac56ee0a9017b201d8ff0ba1f0 Reviewed-on: https://go-review.googlesource.com/c/go/+/392574 Trust: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gopher Robot Reviewed-by: Bryan Mills --- src/cmd/go/alldocs.go | 4 ++++ src/cmd/go/internal/run/run.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index 825de1e64a8..8410731a28a 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -1599,6 +1599,10 @@ // cross-compiled programs when a simulator or other execution method is // available. // +// By default, 'go run' compiles the binary without generating the information +// used by debuggers, to reduce build time. To include debugger information in +// the binary, use 'go build'. +// // The exit status of Run is not the exit status of the compiled binary. // // For more about build flags, see 'go help build'. diff --git a/src/cmd/go/internal/run/run.go b/src/cmd/go/internal/run/run.go index 312b49ef5df..35c57833730 100644 --- a/src/cmd/go/internal/run/run.go +++ b/src/cmd/go/internal/run/run.go @@ -52,6 +52,10 @@ for example 'go_js_wasm_exec a.out arguments...'. This allows execution of cross-compiled programs when a simulator or other execution method is available. +By default, 'go run' compiles the binary without generating the information +used by debuggers, to reduce build time. To include debugger information in +the binary, use 'go build'. + The exit status of Run is not the exit status of the compiled binary. For more about build flags, see 'go help build'.