#go
58 posts tagged go. All posts
Building a REST API in Go with the Gin frameworkBuild a small in-memory books REST API with Gin in Go, covering routing, route groups, path parameters, JSON binding and status codes.
Wrapping up the Go series: recap and where to learn nextA recap of the Go concepts covered in this series, some habits worth keeping as you write more Go, and the official and community resources to learn from next.
Go basics: variables, constants, types, operators and control flowThe building blocks of a Go program: package layout, variables and constants, basic types and conversions, operators, and if, switch and for, with runnable examples.
Go pointers and garbage collection basicsHow pointers work in Go (&, *, passing by pointer), how the compiler decides between stack and heap, and a small program that shows the garbage collector running.
Go functions, packages, and exported namesWriting Go functions with multiple return values, splitting code into packages inside a module, and controlling visibility with capitalised names.
Go arrays, slices, and maps: how they differFixed-size arrays, slices that share a backing array, and maps, with runnable examples and the gotchas: aliasing, append reallocation, and nil maps.
Object-oriented programming in Go: structs, methods, embedding and interfacesHow Go covers classic OOP ideas without classes: structs and methods, package-level encapsulation, embedding instead of inheritance, and interfaces.
Concurrency in Go: goroutines, channels and selectStart goroutines, wait for them with sync.WaitGroup, pass data over channels, wait on several channels with select, and build a small concurrent request processor.
Reading and writing files in Go, and handling errorsRead and write files with the os package, stream large files, and handle Go errors: returning them, wrapping with %w, and checking with errors.Is.
Web development in Go: net/http routing and html/templateBuild a small web server with Go's standard library: register handlers, route by method and path wildcard, and render HTML safely with html/template.
Processing WAV audio in Go with go-audioRead a WAV file with go-audio/wav, apply gain and a low-pass filter, find the dominant frequency with a gonum FFT, and write the result back to WAV.
Why Go: where it came from, what it's good at, and how to install itGo's origins at Google, the language features that matter day to day, the jobs it suits and doesn't, and installing it on Windows, macOS and Linux.
Getting started with Echo in Go: routes, JSON handlers and middlewareBuild a small Go web server with the Echo framework: routes, a JSON POST handler with request binding, and the built-in logging and recovery middleware.
Go Micro basics: writing, discovering and calling services in GoWrite and call a Go Micro v6 service: handlers, mDNS and Consul service discovery, client-side load balancing, retries and timeouts.
Building a GraphQL server in Go with graphql-goBuild a small GraphQL server in Go with graphql-go and graphql-go/handler, with a book type, a query, a mutation and GraphiQL for testing.
Structured logging in Go with zap: loggers, levels, fields and encodersSet up Uber's zap logger in Go: production vs development presets, log levels, structured fields, console output and custom time formats.
Testing in Go with Testify: assert, require, suites, and mocksHow to use Testify's assert, require, suite, and mock packages in Go tests, with runnable examples and the gotchas that trip people up.
Go kit basics: services, endpoints and HTTP transport in GoBuild a small string service with Go kit: define the service, wrap it in endpoints, expose it over HTTP, and add logging middleware.
Collecting files for GitHub Pages with Go and bitfield/scriptA small Go program that uses bitfield/script to gather HTML and PDF reports into a gh-pages folder, write an index page, and deploy it with GitHub Actions.
GORM basics in Go: models, migrations, CRUD, and associationsGetting started with GORM in Go using SQLite, covering models, AutoMigrate, create/read/update/delete, and a one-to-many association, with zero-value gotchas.
Calling C and C++ code from Go with cgo and SWIGCall C functions from Go with cgo, wrap C++ behind an extern "C" shim, and let the go tool run SWIG for you to bind a C++ class.
Introduction to Go: where it came from, the basics, and a first web serverA short history of Go, why teams pick it, and the basics: structs, arrays and slices, building a binary, a net/http server, and go doc.
Building a line-based text diff tool in GoBuild a small command-line diff in Go that compares two files line by line using a longest common subsequence (LCS) table and prints added and removed lines.
Web scraping in Go with net/http and goqueryFetch a page with Go's net/http, parse it with goquery's CSS selectors, and extract Hacker News story titles and links, plus the gotchas that break scrapers.
A basic Wails app that fetches quotes from the Tronald Dump APIBuild a small Wails desktop app with a Vue frontend that fetches a random quote, either from the frontend with fetch or from a bound Go method.
How I made a book API in Go with OpenAPI Generator and Google BooksHow I generated a Go server from an OpenAPI spec and wired its one endpoint to the Google Books API, plus the bugs I fixed in the service code.
Monitoring Go HTTP services with Prometheus and GrafanaInstrument a Go HTTP server with client_golang (request count, latency histogram, in-flight gauge), scrape it with Prometheus and query it in Grafana.
Filtering Reddit posts with Go and sending matches to DiscordHow my finreddit project pulls new posts from several subreddits with the Reddit API, filters them by score, flair and keywords, and posts matches to a Discord webhook.
Generating a Go API server and client from a Swagger spec with go-swaggerUse go-swagger to validate a Swagger 2.0 spec, generate a Go server and client from it, and wire up a handler for a small todo API.
Checking balances and placing orders with the Kraken REST API in GoUse the go_kraken library to read your Kraken account balance, place (or just validate) a limit order, and check an order's status from Go.
Building a Go CLI with Cobra: commands, subcommands and flagsBuild a command-line app in Go with Cobra: scaffold it with cobra-cli, add commands and subcommands, and define local and persistent flags.
gRPC in Go: define a service, generate code, and write a server and clientBuild a gRPC service in Go: define it in Protocol Buffers, generate code with protoc-gen-go and protoc-gen-go-grpc, then write the server and client.
GCSS: compiling indented CSS from GoGCSS syntax (variables, mixins, nesting, &) and how to compile it to CSS from Go code or the command line with yosssi/gcss.
Scheduling recurring jobs in Go with gocronRun Go functions on an interval, at a time of day or on a cron schedule with gocron v2, plus how it maps to the old jasonlvhit/gocron API.
Dictionaries in Go: creating, reading, deleting and iterating over mapsHow Go's built-in map type works as a dictionary: creating maps, adding and reading keys, the comma-ok check, deleting, iterating in sorted order, and common gotchas.
Storing large sets of integers in Go with the bitset packageHow to use the bits-and-blooms/bitset package in Go to set, test, count and iterate bits, and to take unions and intersections of sets.
Loading Go configuration from YAML and environment variables with cleanenvHow to load a Go app's config from a YAML file with environment variable overrides and defaults using cleanenv's ReadConfig and struct tags.
Parsing command-line flags in Go with go-flagsDefine CLI options as struct tags with jessevdk/go-flags, parse them, add subcommands, and handle --help and parse errors correctly.
Building a Go CLI with subcommands using google/subcommandsBuild a small Go command-line tool with add and multiply subcommands using the google/subcommands package, including per-command flags and help output.
Dnote: keeping Go notes from the command lineHow to install the Dnote CLI and use books, add, view, find and edit to keep short notes about Go (or anything else) from your terminal.
Building a terminal UI in Go with gocuiSet up a gocui application in Go that draws a centred view, then add key bindings to quit. Includes notes on the maintained awesome-gocui fork.
Styling Go terminal output with Lip Gloss: colors, padding and layoutsHow to style and lay out terminal output in Go with Charm's Lip Gloss v2: colors, bold text, fixed-width bars and stacking blocks to fit the terminal width.
Using MPI from Go: a parallel sum with gompi and Open MPICall the Message Passing Interface from Go with the gompi Open MPI wrapper: start MPI, get ranks, broadcast data, reduce partial sums and run with mpirun.
Updating terminal output in place in Go with uiliveUse gosuri/uilive to redraw lines in place in a Go CLI: a hand-rolled progress bar, multi-line status output, and printing logs above it.
Printing aligned tables in Go terminal output with uitableUse gosuri/uitable to print aligned columns in a Go CLI: building rows, right-aligning numbers, and truncating or wrapping long cells.
Progress bars in Go terminal apps with uiprogressHow to render one or several progress bars in a Go command-line program with gosuri/uiprogress, including custom decorators and bar characters.
Coloring Go terminal output with the chalk packageHow to color and style terminal text in Go with ttacon/chalk: basic colors, text styles, reusable styles, and its limits compared with fatih/color.
Adding help output and remote includes to a Go Makefile with mmakeHow to use mmake, a wrapper around make, to turn Makefile comments into a help command and share targets across Go projects with remote includes.
Running concurrent tasks in Go: WaitGroup, errgroup and context cancellationStart tasks as goroutines, wait for them with sync.WaitGroup, collect errors with errgroup and cancel the rest through a context.Context.
Gaper: rebuild and restart a Go program on crash or file changeHow to install and run gaper, a development-only supervisor that rebuilds your Go program when files change and restarts it when it exits.
Running Go build, test and fmt commands from one file with 1buildHow to use 1build to keep a Go project's build, test, fmt and run commands in a single 1build.yaml and run them by name, with before/after hooks.
Writing a callback-style WebSocket client in Go with gowebsocketConnect to a WebSocket server from Go with sacOO7/gowebsocket: event callbacks, sending text and binary messages, and closing cleanly.
sqlx in Go: scanning rows into structs, named queries and transactionsUse jmoiron/sqlx with PostgreSQL to scan query results into structs, insert with named parameters, run transactions and handle sql.ErrNoRows.
Loading Go configuration from files, defaults and env vars with ViperRead a YAML config file with spf13/viper, layer defaults and environment variables on top, decode it into a struct, and reload on change.
Plotting ASCII line graphs in Go with asciigraphHow to draw line graphs in the terminal from Go with the asciigraph package, and how to set height, width, captions, colours and multiple series.
Uploading APKs to Google Drive from a Bitrise build with a Go stepA custom Bitrise step written in Go that finds the APKs a build produced and uploads them to a Google Drive folder with a service account.
Building a space shooter in Go with Ebiten (v1 API)A walkthrough of a small 2D space shooter written in Go with Ebiten v1, covering audio, sprites, the game loop, collisions and spawning enemies.
How to parse git commits using golangParsing git commits with golang
© 2026 David Li · Home · Blog · RSS ·Classic site · Built with Astro, Starlight and three.js · Logos:Font Awesome Free (CC BY 4.0)