Get ldflags from binary file


(Amandio Silva) #1

Hello

I have a HelloWorld program. I make this command to build

go build -ldflags “-X main.Version=v1.1” main.go

Its possible create a application in go, that read the binary and get
get the value of variable Version (on this example was “v.1.1”).

Thanks