Getting Started

Go Introduction

Learn Go — Google's simple, fast, and reliable language for building scalable systems.

What is Go?

Go (also called Golang) is an open-source programming language designed by Google engineers Robert Griesemer, Rob Pike, and Ken Thompson. It was designed for building reliable and efficient software at scale.

Why Go?

  • Simple: Small language spec, easy to learn
  • Fast: Compiles to machine code, garbage collected
  • Concurrent: Goroutines and channels make concurrency easy
  • Static typing: Catches errors at compile time
  • Great tooling: Built-in formatter, tester, benchmarker
  • Used at: Google, Docker, Kubernetes, Dropbox, Uber

Go Philosophy

  • Simplicity over cleverness
  • Explicit over implicit
  • Composition over inheritance
  • Concurrency as a first-class feature
  • Batteries included (rich standard library)

Hello World

bash
go run main.go
go build -o myapp main.go

Example

go
package main

import (
    "fmt"
    "math"
)

func main() {
    // Variables
    var name string = "Go"
    age := 15  // short variable declaration (type inferred)

    // Multiple assignment
    x, y := 10, 20

    fmt.Println("Hello,", name)
    fmt.Printf("Age: %d, x+y: %d\n", age, x+y)

    // Constants
    const Pi = math.Pi
    const MaxRetries = 3

    fmt.Printf("Pi: %.4f\n", Pi)

    // Zero values (no undefined!)
    var num int       // 0
    var text string   // ""
    var flag bool     // false
    fmt.Println(num, text, flag)
}
Try it yourself — GO