I have a go test.go
package main import "fmt" var DEBUG_MODE bool = true func main() { fmt.Println(DEBUG_MODE) }
I want to set DEBUG_MODE variable to compile time false
I tried:
go build -ldflags "-X main.DEBUG_MODE 0" test.go && ./test true kyz@s497 :18:49:32:/tmp$ go build -ldflags "-X main.DEBUG_MODE false" test.go && ./test true kyz@s497 :18:49:41:/tmp$ go build -ldflags "-X main.DEBUG_MODE 0x000000000000" test.go && ./test true
This does not work, but it works when DEBUG_MODE is a string
source share