Use [] to find tag! Example: [flutter, javascript]

Learn Go Programming Language
Learn Go Programming Language

Chapter 2

Installation

remove_red_eye 1038 Times
spellcheck 334 Words, 2378 Characters
*Note: this book is still ongoing until it has a finished label.

Installing Go on macOS

Whether you're a seasoned developer or taking your first steps into the programming world, setting up Go (Golang) on your Mac is a breeze. Follow this fluid guide to embark on a seamless installation journey.

Step 1: Prerequisites

Before diving into the installation process, ensure your macOS system is up-to-date. Go requires macOS 10.11 or later. Make sure you have administrative privileges to install software.

Step 2: Download Go

Head to the official Golang website https://golang.org/dl/ to download the latest stable release. Once the download is complete, locate the downloaded file—usually named something like go1.x.x.darwin-amd64.pkg.

Step 3: Install Go

Open your Terminal and navigate to the directory containing the downloaded file. Now, let's install Go:

sudo installer -pkg go1.x.x.darwin-amd64.pkg -target /

You'll be prompted to enter your password. Once done, the installer will gracefully set up Go on your system.

Step 4: Set Go Paths

To ensure Go works smoothly, set up the required paths. Open your terminal and add the following lines to your shell profile file (.zshrc for Zsh or .bash_profile for Bash):

export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

Then, apply the changes:


source ~/.zshrc   # for Zsh
source ~/.bash_profile   # for Bash

Step 5: Verify Installation

go version

You should see the installed Go version, signaling that your installation is complete.

Installing Go on Windows

Whether you're an enthusiastic Windows developer or just embarking on your programming journey, installing Go (Golang) on your Windows system is a straightforward task. Follow this step-by-step guide to kickstart your journey hassle-free.

Step 1: Download the Go Installer

Open your browser and visit the official Go download page at https://golang.org/dl/. Choose the Windows version and download the installer file, usually with a .msi extension, according to your system architecture (32-bit or 64-bit).

Step 2: Run the Installer

After the download is complete, open the newly downloaded installer file. Follow the installation prompts, choose the desired installation location, and make sure to select the "Add go to PATH" option so that the Go commands can be accessed from the Command Prompt.

Step 3: Verify Installation

Open the Command Prompt (cmd) and run the following command:

go version


Next Article (Init Mod)
Content Navigation