Golang: Print Version

By Xah Lee. Date: .

Show go version from script

here's code that prints the go version from a script.

package main

import "fmt"
import "runtime"

func main() {
	fmt.Printf("%v\n", runtime.Version())
 // go1.18.4
}

Show go version from command line

go version
shows the version from command line.
go version 2022-07-24
go version

Golang: Print Runtime Info