delve/cmd/dlv/main.go
Hyang-Ah Hana Kim ac8b4718bd
all: import go telemetry and enable crash reporting (#3841)
Imported golang.org/x/telemetry@9c0d19e to avoid
go version requirement change.

For #3815
For golang/go#70056
2024-10-29 12:12:42 -07:00

33 lines
638 B
Go

package main
import (
"os"
"github.com/go-delve/delve/cmd/dlv/cmds"
"github.com/go-delve/delve/pkg/version"
"github.com/sirupsen/logrus"
"golang.org/x/telemetry"
)
// Build is the git sha of this binaries build.
var Build string
func main() {
telemetry.Start(telemetry.Config{
ReportCrashes: true,
})
if Build != "" {
version.DelveVersion.Build = Build
}
const cgoCflagsEnv = "CGO_CFLAGS"
if os.Getenv(cgoCflagsEnv) == "" {
os.Setenv(cgoCflagsEnv, "-O0 -g")
} else {
logrus.WithFields(logrus.Fields{"layer": "dlv"}).Warnln("CGO_CFLAGS already set, Cgo code could be optimized.")
}
cmds.New(false).Execute()
}