Skip to content

Go 101 — Fundamentals

This module covers the essential building blocks of Go from the perspective of a working TypeScript developer. Each lesson anchors a Go concept in something you already know, then shows you the Go way.

  • Variableslet/const:=, zero values vs undefined
  • Functions — signatures, multiple returns, named returns, variadics
  • Control Flowif, the one for loop that does everything, switch, range
  • Collections — arrays vs slices, maps (Go’s version of JS objects/Map)
  • Structs & Methods — value types, receivers (Go’s answer to classes)
  • Interfaces — implicit satisfaction (structural but explicit — like TS, but different)
  • Errors — errors as values, not exceptions
  • Packages — Go modules, exported identifiers, imports

In TypeScript you probably write this every day:

const greet = (name: string): string => {
return `Hello, ${name}!`;
};
console.log(greet("World"));

In Go the same idea looks like:

package main
import "fmt"
func greet(name string) string {
return fmt.Sprintf("Hello, %s!", name)
}
func main() {
fmt.Println(greet("World"))
}

A few things jump out immediately: explicit package main, no arrow functions, fmt for formatted output, and types come after parameter names. All of these will feel natural by the end of this module.

Where do types appear relative to parameter names in Go?