Golang: Print Version

By Xah Lee. Date: . Last updated: .

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

type

go version

go version 2022-07-24
go version

Golang, Print Runtime Info