Lecture 1 / 12
Lecture 01 ยท Fundamentals

Introduction to Go & Setup

Beginner ~50 min

What is Go?

Go (Golang) is a modern, statically typed, compiled programming language designed by Google. It is known for its simplicity, performance, and built-in support for concurrency.

Why Go?

  • Excellent performance and efficiency
  • Built-in concurrency with goroutines
  • Simple and clean syntax
  • Ideal for cloud-native, microservices, CLI tools, and networking

Installation

Download from go.dev/dl or use package managers.

terminal
go version
go version go1.22.3 linux/amd64

Your First Go Program

main.go
package main

import "fmt"

func main() {
    fmt.Println("Hello, Go Mastery!")
    fmt.Println("Fast, simple, and concurrent!")
}
Output
Hello, Go Mastery!
Fast, simple, and concurrent!
๐ŸŽฏ Exercise 1.1

Install Go, run go version, then create a new module with go mod init hello and run your first program with go run main.go.

Lecture 02 ยท Fundamentals

Variables & Data Types

Beginner ~45 min

Declaring Variables

Go offers multiple ways to declare variables. The short declaration := is the most common inside functions.

var name string = "Gopher"
age := 10 // Type inferred as int

Zero Values

Variables declared without an initial value are given their zero value (0 for numeric, false for boolean, "" for strings).

Lecture 03 ยท Fundamentals

Control Flow

Beginner ~40 min

The Only Loop: For

Go only has one looping construct: the for loop.

for i := 0; i < 5; i++ {
    fmt.Println(i)
}

// while-style loop
for n < 100 {
    n *= 2
}
Lecture 04 ยท Fundamentals

Functions & Multiple Returns

Beginner ~50 min

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
}
Lecture 05 ยท Fundamentals

Pointers & Structs

Intermediate ~55 min

Structs

type User struct {
    ID   int
    Name string
}

u := User{ID: 1, Name: "Alice"}
Lecture 06 ยท Core Concepts

Arrays, Slices & Maps

Intermediate ~60 min

Slices: Dynamic Arrays

s := []int{1, 2, 3}
s = append(s, 4)

Maps: Key-Value Pairs

m := make(map[string]int)
m["apples"] = 5
Lecture 07 ยท Core Concepts

Methods & Interfaces

Intermediate ~60 min

Interfaces

Go uses implicit interfaces. If a type implements the methods, it implements the interface.

type Shape interface {
    Area() float64
}
Lecture 08 ยท Core Concepts

Error Handling

Intermediate ~40 min

The Idiomatic Way

val, err := doSomething()
if err != nil {
    // Handle error
    return err
}
Lecture 09 ยท Advanced

Concurrency & Goroutines

Advanced ~60 min

Goroutines

Use the go keyword to run a function concurrently.

go sayHello()
Lecture 10 ยท Advanced

Channels & Synchronization

Advanced ~65 min

Channels

Channels are the pipes that connect concurrent goroutines.

ch := make(chan int)
ch <- 42 // Send
val := <-ch // Receive
Lecture 11 ยท Advanced

Modules & Testing

Intermediate ~50 min

Writing Tests

func TestAdd(t *testing.T) {
    if Add(1, 2) != 3 {
        t.Errorf("Failed!")
    }
}
Lecture 12 ยท Capstone Project

Capstone: Concurrent CLI Tool

Advanced ~120 min

Build a tool that fetches data from multiple APIs concurrently using goroutines and channels.

// Requirements:
// 1. Use net/http to fetch data
// 2. Use goroutines for parallel requests
// 3. Collect results via channels
// 4. Use context for timeouts