Files
via/internal/examples/livereload
Ryan Hamamura a7ace9099f feat: replace log with rs/zerolog for structured logging
Switch from the standard library log package to rs/zerolog with
ConsoleWriter for colorful terminal output in dev mode and JSON
output in production. Users can now provide their own logger via
Options.Logger or set the level via Options.LogLevel.
2026-01-31 08:18:24 -10:00
..
2025-11-08 13:05:23 -05:00
2025-11-08 13:05:23 -05:00

Live Reload with Air

Hot-reloads your Go code and web page.

Setup

If you don't have Air yet:

go install github.com/air-verse/air@latest

Run

air

Then open http://localhost:3000 in your browser.

How It Works

Air watches your Go files and rebuilds when you make changes.

LiveReloadPlugin handles browser refresh through a SSE connection at /dev/reload. When Air restarts the server, the connection drops, triggering an automatic page reload after 100ms. This only runs on localhost.

Files

  • .air.toml - Air config
  • livereload.go - Via plugin for browser auto-reload