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.

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.