Installing Go
Learn Go through interactive, bite-sized lessons. Build scalable applications with modern concurrency.
Start Go Journey →Go, also known as Golang, is a powerful and efficient programming language developed by Google. This guide will walk you through the process of installing Go on your system.
Why Install Go?
Installing Go allows you to write and run Go programs on your machine. It's the first step towards developing applications in this versatile language.
Installation Steps
1. Download Go
Visit the official Go website (golang.org) and download the installer for your operating system.
2. Run the Installer
Execute the downloaded file and follow the installation wizard. The process varies slightly depending on your OS:
- Windows: Double-click the MSI file and follow the prompts.
- macOS: Open the package file and follow the instructions.
- Linux: Extract the archive to /usr/local, or use your distribution's package manager.
3. Set Up Environment Variables
Ensure that Go's bin directory is added to your PATH. This step is usually handled automatically by the installer.
4. Verify Installation
Open a terminal or command prompt and run:
go version
If installed correctly, you should see the Go version printed.
Creating Your First Go Program
To test your installation, create a simple "Hello, World!" program:
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
Save this as hello.go and run it using:
go run hello.go
Next Steps
Now that you have Go installed, you're ready to explore its features. Consider learning about:
Troubleshooting
If you encounter issues during installation:
- Ensure you have administrative privileges.
- Check your system's compatibility with the Go version you're installing.
- Verify that your PATH is set correctly.
With Go successfully installed, you're now prepared to dive into the world of Go programming. Happy coding!