Getting Started with Go (Golang)

March 16, 2026 • Go • 10 min read

Go (also called Golang) is Google's programming language that powers Docker, Kubernetes, Terraform, and countless other tools. If you want to work with modern infrastructure, Go is essential.

Why Go?

Go was designed to solve problems at Google scale. It combines the performance of compiled languages with the simplicity of interpreted ones. The entire language can be learned in days.

Installing Go

sudo apt update
sudo apt install golang-go
go version

Your First Go Program

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

Running Your Program

go run hello.go

Variables

// Explicit type
var name string = "Alice"

// Type inference
city := "London"

// Constants
const Pi = 3.14159

Functions

func add(a int, b int) int {
    return a + b
}

// Multiple return values
func divide(a, b float64) (float64, error) {
    if b == 0 {
        return 0, errors.New("cannot divide by zero")
    }
    return a / b, nil
}

Goroutines - Go's Superpower

Goroutines are lightweight threads managed by the Go runtime. You can have thousands running simultaneously:

func main() {
    // Start a goroutine
    go sayHello()
    
    // Do other work
    fmt.Println("Main function continues")
}

func sayHello() {
    fmt.Println("Hello from goroutine!")
}

Channels

Channels let goroutines communicate safely:

ch := make(chan string)

go func() {
    ch <- "Hello from goroutine!"
}()

msg := <-ch
fmt.Println(msg)

What's Next?

Go is perfect for APIs, microservices, CLI tools, and cloud-native applications. Check out our Go guide to master the language!

// Comments

Leave a Comment