diff --git a/cmd/dlv/main.go b/cmd/dlv/main.go index e4ced0f7e51277b90865e9984867f38f729fca90..abd01060227dc8e87598133c70c912c0a3af7d5e 100644 --- a/cmd/dlv/main.go +++ b/cmd/dlv/main.go @@ -5,6 +5,7 @@ import ( "github.com/derekparker/delve/cmd/dlv/cmds" "github.com/derekparker/delve/pkg/version" + "github.com/sirupsen/logrus" ) // Build is the git sha of this binaries build. @@ -14,6 +15,11 @@ func main() { if Build != "" { version.DelveVersion.Build = Build } - os.Setenv("CGO_CFLAGS", "-O -g") + const cgoCflagsEnv = "CGO_CFLAGS" + if os.Getenv(cgoCflagsEnv) == "" { + os.Setenv(cgoCflagsEnv, "-O -g") + } else { + logrus.WithFields(logrus.Fields{"layer": "dlv"}).Warnln("CGO_CFLAGS already set, Cgo code could be optimized.") + } cmds.New(false).Execute() }