github.com/neilgarb/delve@v1.9.2-nobreaks/cmd/dlv/main.go (about)

     1  package main
     2  
     3  import (
     4  	"os"
     5  
     6  	"github.com/go-delve/delve/cmd/dlv/cmds"
     7  	"github.com/go-delve/delve/pkg/version"
     8  	"github.com/sirupsen/logrus"
     9  )
    10  
    11  // Build is the git sha of this binaries build.
    12  var Build string
    13  
    14  func main() {
    15  	if Build != "" {
    16  		version.DelveVersion.Build = Build
    17  	}
    18  	const cgoCflagsEnv = "CGO_CFLAGS"
    19  	if os.Getenv(cgoCflagsEnv) == "" {
    20  		os.Setenv(cgoCflagsEnv, "-O0 -g")
    21  	} else {
    22  		logrus.WithFields(logrus.Fields{"layer": "dlv"}).Warnln("CGO_CFLAGS already set, Cgo code could be optimized.")
    23  	}
    24  	cmds.New(false).Execute()
    25  }