Go: Find build version

fmt.Println(runtime.Version())

The function runtime.Version returns the Go tree’s version string, which is

  • either the commit hash and date at the time of the build,
  • or, when possible, a release tag like go1.9.
$ go version

The command go version prints the version in the same format as runtime.Version.

Comments