Getting the running Go version

Kelvin Wangonya - Jul 24 '21 - - Dev Community

This would mostly be useful for debugging.

package main

import (
    "log"
    "runtime"
)

func main() {
    log.Printf("Running Go: %s", runtime.Version())
}
Enter fullscreen mode Exit fullscreen mode

Output: Running Go: go1.16.6

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .