Abhinav Gupta | About

Log

2023

GopherCon 2023: Future-Proof Go Packages talkSlides for my talk from GopherCon 2023.

2022

Designing Go Libraries 53 minutes Requirements for writing high-quality Go libraries and patterns and best practices to help meet them.

Introduction to generics in Go 13 minutes Basics of function and type-level generics in Go, their limitations, and how to design around those limitations.

Bare minimum semantic versioning 4 minutes Basics of semantic versioning, and why you should do it.

Go Patterns and Practices talkSlides from a talk about writing maintainable Go packages.

Subcommands with Go’s flag package 10 minutes Gain a better understanding of Go's standard flag package and use it to build CLIs with subcommands.

Handle spaces in file names with xargs 6 minutes A gotcha with xargs, and how to work around it.

Mock programs to test os/exec in Go 17 minutes Learn how the test machinery works in Go and how you can use it to inject arbitrary mock behavior into external binaries during tests.

2021

Go errors: Use %q with fmt.Errorf 1 minute Why you should almost always use %q for strings variables in printf-style functions in Go.

How to write flexible YAML shapes in Go 11 minutes Leverage the YAML package to write flexible YAML shapes. Adapt the same technique to make JSON shapes flexible.

2020

How to parse Newline Delimited JSON in Go 2 minutes Parse the ndjson format using Go's standard library.

Go Gotcha: Struct pointers as map keys 2 minutes An easy to make mistake when playing with maps and structs.

Fix-up Git commits with Tig 6 minutes Introduction to Tig and an instant productivity boost you can get from it.

2019

Filter Go slices without allocating 7 minutes Build a better mental model for how Go slices work. Use that knowledge to filter items from a slice without creating a new one.

Restack Git branches automatically 10 minutes Improve how you manage multiple stacked branches in Git with a nearly invisible tool.

Go Antipatterns: Channels that fire once 3 minutes Why it might be a mistake to have a channel that only ever gets one value.

Understanding Go’s token.Pos 7 minutes An explanation of a piece of the go/token package and why it's interesting.

2018

Go Antipatterns: With* Context Managers 5 minutes Why you don't need Python-style context managers in Go and what you can do instead.