Go Compiler
Contents
Compile-Time Variables
Consider the below sample program, hello:
package main import ( "fmt" ) var Name string func main() { fmt.Printf("Hello, %s!\n", Name) }
$ go build && ./hello Hello, ! $ go build -ldflags "-X main.Name=Dominic" && ./hello Hello, Dominic!