Cookies management by TermsFeed Cookie Consent

💻 How to check your Go version

Last updated:
introduction version

Check the Go version installed on your system

To find out what version of Go is installed on your system, open your terminal/command line/shell, and run the command:

go version

The version is a command of the go tool which prints out version information for Go executables. If no additional arguments are given, it prints out the Go version installed on your computer.

Example of the go version output:

go version go1.18.4 darwin/amd64

If you want to learn more about the go version, check the documentation using the command:

go help version

Check what version of Go a binary was built with

To find out what version of Go a given application was built with, just use the go version command, passing the path to the binary as an argument:

go version <path/to/the/binary>

Example

Create a simple app, for example the “Hello World” application, and save it as a main.go file:

package main

import "fmt"

func main() {
    fmt.Println("Hello World!")
}

Then build the application using the command:

go build -o hello-world

Now you can check what version of Go the hello-world app was built with:

go version hello-world

In the output, you should see the application name and version:

hello-world: go1.18.4

Check at runtime what version of Go the app was built with

If you want to check directly in the application what version of Go it was built with, you can use the runtime.Version() function. It returns the Go version information, the same as when using the go version <path/to/the/binary> command.

Example

Create a new app that prints Go version information and save it as a main.go file:

package main

import (
    "fmt"
    "runtime"
)

func main() {
    fmt.Println("Hello World!")
    fmt.Printf("The application was built with the Go version: %s\n", runtime.Version())
}

Build the application using the command:

go build -o hello-world-with-version

Run the application:

./hello-world-with-version

In the output, you should see the Go version string:

Hello World!
The application was built with the Go version: go1.18.4

Current Go (Golang) version

How to upgrade to a newer version of Go?

To update your Go version, go to the official Download and install website. There you will find up-to-date information on how to update an existing version of Go on Linux, macOS, and Windows.

Go (Golang) version history

Major Go releases are labeled as, for example, 1.16, 1.17, 1.18 (in the list below, they are written in a larger font). In addition, there are support releases introducing minor fixes labeled as, for example, 1.17.1, 1.17.2, and so on. If you want to learn more about the release policy of Go, read the official documentation.

Go was first publicly announced on November 10, 2009.

The first major version of Go - go1 was released on March 28, 2012.


Thank you for being on our site 😊. If you like our tutorials and examples, please consider supporting us with a cup of coffee and we'll turn it into more great Go examples.

Have a great day!

Buy Me A Coffee

🫘 Count the occurrences of an element in a slice in Go

Learn how to count elements in a slice that meet certain conditions
introduction generics generics-intro

❤️‍🩹 Recover function in Go

Learn what it is for and how to use the built-in recover() function
introduction syntax builtin

🐾 How to compare strings in Go

shorts introduction strings