Skip to the content.

Print Go Version

We can use runtime.Version function to print Go Version.

Example

package main

import (
    "fmt"
    "runtime"
)

func main() {
    fmt.Println("Go version: " + runtime.Version())
}

Source: GopherSnippets