github.com/cnboonhan/delve@v0.0.0-20230908061759-363f2388c2fb/_fixtures/buildflagtest.go (about)

     1  package main
     2  
     3  import "fmt"
     4  
     5  // To be set via
     6  //   go build -ldflags '-X main.Hello=World'
     7  var Hello string
     8  
     9  func main() {
    10  	if len(Hello) < 1 {
    11  		panic("global main.Hello not set via build flags")
    12  	}
    13  	fmt.Printf("Hello %s!\n", Hello)
    14  }