title: ExperienceReports
This page collects experience reports about problems with Go that might inform our design of solutions to those problems. These reports should focus on the problems: they should not focus on and need not propose solutions. To propose solutions, see the proposal process.
We hope to use these experience reports to understand where people are having trouble writing Go, to help us prioritize future changes to the Go ecosystem. (We do not promise to reply to these. If you need immediate help answering questions about Go, see https://go.dev/help/ for resources.)
The best experience reports tell: (1) what you wanted to do, (2) what you actually did, and (3) why that wasn’t great, illustrating those by real concrete examples, ideally from production use. Please write these reports about the problems most significant to you, post them on your own blog, or on Medium, or as a Github Gist (use a .md
extension for Markdown), or as a publicly-readable Google doc, and then link them here. (Talk videos or slides are also welcome, although they are not as convenient for us to digest.)
If you do not have permission to edit the wiki to add an article to this list, please file an issue.
Please keep the overall page sorted alphabetically by section (Error Handling before Logging, and so on). Within a section, please keep articles sorted chronologically. It's helpful to include a one-phrase summary of the point of each article.
Add new sections as appropriate.
Table of Contents
App and Game Development
Casting
Concurrency
Context
- Sam Vilain, “Using Go's context library for making your logs make sense,” December 2016, about extracting structured log values from context.
- Jon Calhoun, “Pitfalls of context values and how to avoid or mitigate them in Go,” February 2017.
- Michal Štrba, “Context should go away for Go 2,” August 2017
- Axel Wagner, “Why context.Value matters and how to improve it,” August 2017.
- Dave Cheney, “Context isn't for cancellation,” August 2017.
- Ross Light, “Canceling I/O in Go Cap'n Proto,” January 2018.
- Iman Tumorang, “Avoiding Memory Leak in Golang API,” January 2018.
Declarations
Dependencies
Diagnostics and Debugging
Kevin Burke, “How I'm running benchmarks and printing their results”, it would be nice if I didn't need so much Unix glue to run and print these. July 2017.
John Clarke, Tracking down an intermittent fault (not a race) by running a very slow {hit test failure, increase logging} cycle by running “do { go test -race } while ( $LASTEXITCODE -eq 0 )” overnight. Over many nights. Execution trace functionality like https://rr-project.org/ would be transformative. November 2018.
guanw
, cmd/trace
and PySnooper. Comparison of cmd/trace
with a (more succinct) Python tracing API. May 2019.
Documentation
Education and Teaching
- Carl Kingsford and Phillip Compeau, “Go 2.0 for Teaching”. Experience using Go in an introductory programming course.
Error Handling
(This section is about writing if err != nil
.)
- Andrew Gerrand, “Error Handling and Go,” July 2011, showing Go error handling patterns.
- Martin Sústrik, “Why should I have written ZeroMQ in C, not C++ (part I),” May 2012, discussing production problems with C++ exception handling due to error-handling code being far from code that causes the error.
- Thomi Richards, “The Problems with Errors,” March 2014, arguing that it's essential for code to document exactly which errors it returns / exceptions it might throw.
- Roger Peppe, “Lovin' your errors,” March 2015, discussing idioms for error handling.
- Bleve, “Deferred Cleanup, Checking Errors, and Potential Problems,” September 2015, showing a bug related to error handling and defer in Bleve search.
- Andrew Morgan, “What I Don't Like About Error Handling in Go, and How to Work Around It,” January 2017, about it being difficult to force good error handling, errors not having stack traces, and error handling being too verbose.
- André Hänsel, “If Ⅰ were to make my own Go…”, August 2017
- Peter Goetz, “Thinking About New Ways of Error Handling in Go 2,” September 2017, shows how error-prone error handling in Go is and lays out requirements to improve the experience.
Error Values
(This section is about additional error semantics beyond the Error() string
method.)
- Andrew Morgan, “What I Don't Like About Error Handling in Go, and How to Work Around It,” January 2017, about it being difficult to force good error handling, errors not having stack traces, and error handling being too verbose.
- Chris Siebenmann, “Go‘s net package doesn’t have opaque errors, just undocumented ones,” August 2018
- Bryan C. Mills, “Error Wrapping and Redundancy in Go,” September 2019
File System
Generics
- “Summary of Go Generics Discussions (living document).”
- Bouke van der Bijl, “Idiomatic Generics in Go,” September 2014.
- Craig Weber, “Living without generics in Go,” December 2014.
- Shashank Sharma, “Poor man's generics in Golang (Go),” May 2016.
- Niek Sanders, “Overhead of Go's generic sort,” September 2016, documenting the overhead of sorting using sort.Interface instead of specialized code.
- Jon Calhoun, “Using code generation to survive without generics in Go,” May 2017.
- Jon Bodner, “Closures are the Generics for Go,” June 2017.
- Andrew Stock, “Why I miss generics in Go,” June 2017
- Kevin Burke, “Code example with lots of interface casts,” requires a lot of boilerplate/casts.
- Ian Lance Taylor, “The append function,” July 2017.
- DeedleFake, “The Problem with Interfaces”, July 2017.
- Kurtis Nusbaum “Why I'm So Frustrated With Go,” June 2017
- Juan Álvarez, “Generics on Go's stdlib”, July 2017.
- David Chase, “A use case for Go Generics in a Go Compiler”, August 2017
- Varun Kumar, “Generics - I Wish You Were Here...”, August 2017
- Sameer Ajmani, “Go Experience Report for Generics: Google metrics API”, August 2017
- Chewxy, “Tensor Refactor: A Go Experience Report”, September 2017, discusses the lack of generics and how it affects building high performance multidimensional arrays for different data types (having to resort to a lot of pointer ugliness, and manually keeping track of type and runtime type checking)
- qwerty2501,“A problem runtime error due to lack of Generics”, October 2017
- posener, “Why I recommend to avoid using the go-kit library”, clear separation of concern need lots of boilerplate code. gokit try code generation to avoid this #70 #308 protoc-gen-gokit , but it looks like a complex solution for the problem.
- Xavier Leroy, “A modular module system”, paper about module description for generics.
- Tobias Gustafsson, “Experiences implementing PEDS”, PEDS is a set of statically type safe, immutable/persistent, collections. November 2017
- A Googler “govisor/generics.go”. April 27, 2018
GoMobile
- Vijay, “[Nested structs and slices not supported in gomobile]”
Immutability
Inter Process Communication
Large-Scale Software Development
Literals
Logging
- Evan Miller, “Logging can be tricky,” September 2014, showing how logging can add to application tail latency.
- Dave Cheney, “Let's talk about logging,” November 2015, arguing that there are only two log levels.
- TJ Holowaychuk, “Apex log,” January 2016, describing a structured log package and how it would be used in production.
- Paddy Foran, “Logging in Go,” February 2016, showing how sends Go program logs to Sentry.
- Martin Angers, “About Go logging for reusable packages,” March 2016, making suggestions for how to write code that doesn't assume a particular log package.
- BugReplay.com, “How to use Google Cloud's Free Structured Logging Service With Golang,” September 2016.
- Sam Vilain, “Using Go's context library for making your logs make sense,” December 2016, about extracting structured log values from context.
- Logmatic, “Our Guide to a Golang Logs World,” March 2017.
- Chris Hines, Peter Bourgon, “Proposal: standard Logger interface,“ February 2017, problems related to stdlib logger, especially in the context of libraries, and one proposed solution.
- Sindre Myren, “There is nothing Goish about log.Fatal” August 2017, how poorly log.Fatal plays with defer, and a simple pattern for delaing with it in Go 1.x and Go 2.x.
- Joonas Loppi, “An idea to fix Go´s logging mess” December 2017, just use *log.Logger as an interface everywhere and compose solutions around it.
Misc / Multiple
- Iman Tumorang, “Trying Clean Architecture on Golang” July 2017
- Laurent Demailly, “My Go lang experience, part 1” December 2017, a laundry list of pros and cons with current Go from an experienced C/C++/Java/Scripting languages developer perspective.
- Gokcehan Kara, “Installation with Go Language can be Simpler” May 2018, some complications about the installation and distribution of static stripped binaries with version information.
- Bob Nystrom, “The Language I Wish Go Was” October 2010, I wish Go had tuples, unions, constructors, no Nil, exceptions, generics, some syntax sugar, and ponies that shoot Cheez Whiz out of their noses.
Modules
Performance
- Kevin Burke, “Real Life Go Benchmarking,” trying to explain to the average developer how to use tools like pprof, maybe this could be easier. July 2016.
- Nathan Kerr, “Concurrency Slower?”, shows how to use Go's testing, benchmarking, and profiling tools to improve the performance of a concurrent implementation of a function. April 2017.
Porting
- Shannon Pekary, “Why GOPP,” an attempt to create a ‘class’ keyword that simply makes a struct to also be an interface to make porting code from object-oriented languages much easier.
Slices
Syntax
Time
Tooling
Type System
- Sam Whited, “Faking Enumeration Types with Consts and Unexported Types”, July 2017, about attempting to ensure compile time correctness of values provided to an API using the type system.
- Andreas Matuschek, “Operator Methods”, July 2017, just to remember that there are problems with types without corresponding operators (#19770).
- Leigh McCulloch, “Go: Experience Report: Pointers”, July 2017, about pointers being used for both transferring ownership and indicating a lack of value.
- Jack Lindamood, “Interface wrapping method erasure”, July 2017, about the loss of information due to type wrappers
- Sam Whited, “The Case for interface{}”, Aug 2017, two examples of using interface and why one is bad (but necessary) and one is good.
- James Frasché, “Sum types experience report”, Aug 2017, issues caused by inability to restrict to a closed set of types
- Robin Eklind, “Specific use cases. In response to James Frasché's ‘Sum types experience report’”, Aug 2017, issues caused by inability to restrict to a closed set of types
- Rick Branson, “Implicit Pointers = Explicitly Bad”, Sep 2017, issues encountered with parameters/variables with interface types as implicit references
- Chewxy, “Tensor Refactor: A Go Experience Report”, September 2017, issues regarding discussion of a type system in Go
- Walter Schulze, “Generic functions cannot be passed as values”, September 2017
- Walter, Schulze, “For Sum Types: Multiple return parameters are overrated”, September 2017
- Nicolas, Boulay "Sum type not always the best choice (Typed tagless-final interpretations), October 2017
- Eduard Urbach, “Type-casting interface{} to chan interface{}”, October 2017
- David Vennik, “Unjumbling Golang OOP primitives”, April 20, 2018 - The problem of the lack of structuring in OOP primitives - dummy functions and redundant boilerplate type bindings.
- Jelte Fennema, “Fixing the billion dollar mistake in Go by borrowing from Rust”, June 14, 2018 - Nil pointer dereferences cause panics in production - it would be great if the type system would catch some of those.
Typed nils
Vendoring