Last Modified: 2024-06-26 12:31:05Z
Table of Contents
1. Try it online
You can try the Go programming language on the official go.dev site, at the 'Try Go' section in the middle of the page.
2. Install
The official website provides installers for various operating systems, including Windows, MacOS. You can download the .msi
file or .pkg
file and double click to install the Go programming language.
If you use the homebrew
(Linuxbrew
of course), you can install it by the command below:
brew install go
If you use the Nix package manager, you can instantly install packages for the Go programming language by typing the command to the terminal.
nix-shell -p go
3. Writing codes and running them
This code below will print "Hello, World!!" to the console.
// hello.go
package main
import "fmt"
func main() {
fmt.Println("Hello, World!!")
}
You can run the code with go run
subcommand.
$ go run hello.go
Hello, World!!