How to Install and Set Up Go Environment in 2025?


Go, also known as Golang, is a popular programming language for building reliable and efficient software. As of 2025, setting up a Go environment is much simpler, thanks to the improvements in tooling and documentation. This guide will help you install and configure your Go environment on your system to start building projects efficiently.

Best Golang Books to Buy in 2025

ProductFeaturesPrice
System Programming Essentials with Go: System calls, networking, efficiency, and security practices with practical projects in Golang
System Programming Essentials with Go: System calls, networking, efficiency, and security practices with practical projects in Golang
Check Price
Check Amazon Price
Event-Driven Architecture in Golang: Building complex systems with asynchronicity and eventual consistency
Event-Driven Architecture in Golang: Building complex systems with asynchronicity and eventual consistency
Check Price
Check Amazon Price
Microservices with Go: The expert's guide to building secure, scalable, and reliable microservices with Go
Microservices with Go: The expert’s guide to building secure, scalable, and reliable microservices with Go
Check Price
Check Amazon Price
Kubernetes in Action
Kubernetes in Action
Check Price
Check Amazon Price
Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang
Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang
Check Price
Check Amazon Price

Prerequisites

Before you start, ensure that your system meets the following requirements:

  • Operating System: Go can be installed on Windows, macOS, or Linux. Choose an OS that best fits your development needs.
  • Internet Connection: Required to download Go binaries and other dependencies.

Best Golang Books to Buy in 2025

ProductFeaturesPrice
System Programming Essentials with Go: System calls, networking, efficiency, and security practices with practical projects in Golang
System Programming Essentials with Go: System calls, networking, efficiency, and security practices with practical projects in Golang
Check Price
Check Amazon Price
Event-Driven Architecture in Golang: Building complex systems with asynchronicity and eventual consistency
Event-Driven Architecture in Golang: Building complex systems with asynchronicity and eventual consistency
Check Price
Check Amazon Price
Microservices with Go: The expert's guide to building secure, scalable, and reliable microservices with Go
Microservices with Go: The expert’s guide to building secure, scalable, and reliable microservices with Go
Check Price
Check Amazon Price
Kubernetes in Action
Kubernetes in Action
Check Price
Check Amazon Price
Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang
Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang
Check Price
Check Amazon Price

Step 1: Download Go

The first step in setting up your Go environment is to download the latest Go binary for your operating system. Go to the official Go download page to get the latest version.

  • Choose the correct package for your operating system.
  • Download the tarball or installer appropriate for your platform.

Best Golang Books to Buy in 2025

ProductFeaturesPrice
System Programming Essentials with Go: System calls, networking, efficiency, and security practices with practical projects in Golang
System Programming Essentials with Go: System calls, networking, efficiency, and security practices with practical projects in Golang
Check Price
Check Amazon Price
Event-Driven Architecture in Golang: Building complex systems with asynchronicity and eventual consistency
Event-Driven Architecture in Golang: Building complex systems with asynchronicity and eventual consistency
Check Price
Check Amazon Price
Microservices with Go: The expert's guide to building secure, scalable, and reliable microservices with Go
Microservices with Go: The expert’s guide to building secure, scalable, and reliable microservices with Go
Check Price
Check Amazon Price
Kubernetes in Action
Kubernetes in Action
Check Price
Check Amazon Price
Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang
Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang
Check Price
Check Amazon Price

Step 2: Install Go

On Windows

  1. Run the Installer: Double-click the downloaded .msi file to start the installation process.
  2. Follow the Installation Wizard: The wizard will guide you through the installation steps. Ensure that you check the option to add Go to your PATH.
  3. Verify Installation: Open Command Prompt and type go version. It should display the version of Go installed.

On macOS

  1. Open Terminal: Use Spotlight to find and open Terminal.
  2. Execute the Commands:
    sudo pkgutil -expand go<version>.pkg /tmp/go
    sudo tar -C /usr/local -xzf /tmp/go/Payload
  3. Verify Installation: Type go version in the Terminal to confirm the installation.

On Linux

  1. Open Terminal: Use your system’s terminal application.
  2. Extract and Install:
    tar -C /usr/local -xzf go<version>.tar.gz
  3. Update PATH: Add the following line to your .bashrc, .zshrc, or equivalent:
    export PATH=$PATH:/usr/local/go/bin
    Then, execute source ~/.bashrc to update your current session.
  4. Verify Installation: Enter go version in the Terminal.

Best Golang Books to Buy in 2025

ProductFeaturesPrice
System Programming Essentials with Go: System calls, networking, efficiency, and security practices with practical projects in Golang
System Programming Essentials with Go: System calls, networking, efficiency, and security practices with practical projects in Golang
Check Price
Check Amazon Price
Event-Driven Architecture in Golang: Building complex systems with asynchronicity and eventual consistency
Event-Driven Architecture in Golang: Building complex systems with asynchronicity and eventual consistency
Check Price
Check Amazon Price
Microservices with Go: The expert's guide to building secure, scalable, and reliable microservices with Go
Microservices with Go: The expert’s guide to building secure, scalable, and reliable microservices with Go
Check Price
Check Amazon Price
Kubernetes in Action
Kubernetes in Action
Check Price
Check Amazon Price
Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang
Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang
Check Price
Check Amazon Price

Step 3: Configure Go Workspace

  1. Create a Workspace: Go typically uses a workspace to organize code.
    mkdir -p $HOME/go/{bin,src,pkg}
  2. Set GOPATH: Define where your workspace is located by adding the following line to your shell configuration file:
    export GOPATH=$HOME/go

Best Golang Books to Buy in 2025

ProductFeaturesPrice
System Programming Essentials with Go: System calls, networking, efficiency, and security practices with practical projects in Golang
System Programming Essentials with Go: System calls, networking, efficiency, and security practices with practical projects in Golang
Check Price
Check Amazon Price
Event-Driven Architecture in Golang: Building complex systems with asynchronicity and eventual consistency
Event-Driven Architecture in Golang: Building complex systems with asynchronicity and eventual consistency
Check Price
Check Amazon Price
Microservices with Go: The expert's guide to building secure, scalable, and reliable microservices with Go
Microservices with Go: The expert’s guide to building secure, scalable, and reliable microservices with Go
Check Price
Check Amazon Price
Kubernetes in Action
Kubernetes in Action
Check Price
Check Amazon Price
Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang
Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang
Check Price
Check Amazon Price

Step 4: Run a Simple Go Program

To confirm everything is set up correctly, create a simple Go program:

  1. Create a New Directory:
    mkdir -p $GOPATH/src/hello
  2. Create main.go File:
    touch $GOPATH/src/hello/main.go
  3. Edit main.go:
    package main
    
    import "fmt"
    
    func main() {
        fmt.Println("Hello, Go!")
    }
  4. Run the Program:
    go run $GOPATH/src/hello/main.go

Best Golang Books to Buy in 2025

ProductFeaturesPrice
System Programming Essentials with Go: System calls, networking, efficiency, and security practices with practical projects in Golang
System Programming Essentials with Go: System calls, networking, efficiency, and security practices with practical projects in Golang
Check Price
Check Amazon Price
Event-Driven Architecture in Golang: Building complex systems with asynchronicity and eventual consistency
Event-Driven Architecture in Golang: Building complex systems with asynchronicity and eventual consistency
Check Price
Check Amazon Price
Microservices with Go: The expert's guide to building secure, scalable, and reliable microservices with Go
Microservices with Go: The expert’s guide to building secure, scalable, and reliable microservices with Go
Check Price
Check Amazon Price
Kubernetes in Action
Kubernetes in Action
Check Price
Check Amazon Price
Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang
Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang
Check Price
Check Amazon Price

Additional Resources

Once you’ve set up the Go environment, you might want to delve deeper into more advanced topics:

By following these steps, you’ll have a robust Go environment ready for development. Happy coding!