Back to Home

Go Examples

A collection of Go programming tutorials and example projects.

Basic Go

A quick-reference instruction sheet covering variables, slices, maps, functions, structs, goroutines, and more.

Learning to Code by Bowling

A beginner build-along: write a bowling score program with only if and else, then replay it with for loops and a flatter data model — same score, a quarter of the code. A lesson in how to improve code you've already written.

Learning Go With Algebra Equations

Six classic algebra problems — linear equations, systems, the quadratic formula, and the equation of a line — each solved the standard way by hand, then again in Go, with a Feynman “explain it simply” check after every one.

Big O Notation, by Example

A beginner's guide to how code scales. Runnable Go examples for O(1), O(log n), O(n), O(n log n), and O(n²) side by side, a growth table and chart, and a refactor that drops an algorithm from O(n²) to O(n).

Go Interview Questions

Google-style coding problems solved in Go — arrays, strings, trees, graphs, dynamic programming, and design. Each with a statement, example, complete Go solution, explanation, and complexity analysis.

Project: Concurrent Web Page Fetcher

Fetch a dozen URLs in parallel using goroutines and channels. The whole batch finishes in roughly the time of the slowest single request — Go's “wow” moment in under 40 lines.

Project: TCP Chat Server

A multi-client chat room in ~80 lines. One goroutine per connection, one channel to broadcast. Connect with telnet or nc from multiple terminals and watch messages fan out.

Project: HTTP URL Shortener

A working JSON REST service using net/http. POST /shorten creates a short code; GET /<code> redirects. No framework, no dependencies — just the standard library.

Project: Blog CMS

A WordPress-style blog server in ~320 lines. Posts, admin login with bcrypt, session cookies, slug generation, and SQLite — all standard library except two packages. Full working source.

Project: Mortgage Calculator (Live Go App)

A working mortgage calculator that saves each calculation to SQLite. Built with html/template, database/sql, and the Post-Redirect-Get pattern. Running live at /goapp/mortgage/.

Hosting: Run a Go Web App on Linux (nginx + systemd)

Install Go, write a small web app, run it as a systemd service, and expose it through nginx on bozcode.com. Includes a live demo at /goapp/hello/.

Hosting: Run a Go Web App on macOS

Install Go with Homebrew, build a web server, and keep it running automatically at login using a launchd plist — the macOS equivalent of systemd.

Hosting: Run a Go Web App on Windows

Install Go with winget, build a web server, and run it as a persistent Windows Service using NSSM — no admin scripting required.