Go (Golang)
Go (also known as Golang) is a statically typed, compiled programming language designed by Google.
Install Go
Launch terminal on your Comet or connect via SSH and run the below command.
$ wget https://go.dev/dl/go1.23.6.linux-arm64.tar.gz
$ tar -C /usr/local -xzf go1.23.6.linux-amd64.tar.gz
Add /usr/local/go/bin
to the PATH environment variable
You can do this by adding the following line to your $HOME/.profile
or /etc/profile
(for a system-wide installation):
$ export PATH=$PATH:/usr/local/go/bin
After installation, verify that Go is properly installed:
$ go version
Running an example
Let's create a simple "Hello, World!" program to test Golang on the Comet.
1
Create a new directory, and a new source file for your go program.
$ mkdir hello_world && cd hello_world
$ nano main.go
2
Paste the following program in the editor
import "fmt"
func main() {
fmt.Println("Hello, Go!")
}
3
Now lets compile and run the program.
$ go run main.go
Hello, Go!
You are all set now, you are ready for compiling and running Go
programs ☄️!