Add version info in Go projects
08 Jan, 2021 Go offers a nice way to specify version information at compile time using the -ldflags
flag in go build command.
How to use it effectively ?
Just declare a -v
flag in your application using the flag
package
Now compile this & provide the value for AppVersion
variable at compile time
Test if it works by running ./yourapp -v
Last updated