Go AST Viewer - online tool for analysis and visualization of ast

Basic AST Manipulation, Basic AST Traversal in Go - simple technique to modify Go code using AST.


Type embedding in Go - Go does not provide the typical, type-driven notion of subclassing, but it does have the ability to β€œborrow” pieces of an implementation by embedding types within a struct or interface. In fact, type embedding is product type composition. The article explains basics behind the embedding.

Errors are values - Error handling in Go is different than other functional programming. Usually Either monad helps a lot. Go programmers miss a fundamental point about errors: Errors are values. The article shows a few patterns on error handling with Go.

Why doesn’t Go have variance in its type system? - It explain what co-, contra- and invariance are and what the implications for Go’s type system would be. In particular, why it’s impossible to have variance in slices.

Go and Sum Data Types - Sum types is a neat feature of some programming languages that lets us specify that a value might take one of several related types, and includes convenient syntax for pattern matching on these types at run-time.

Functional options on steroids - Functional options is a paradigm in Go for clean and extensible APIs popularized by Dave Cheney and Rob Pike. This post is about the practices that appeared around the pattern since it was first introduced.

JSON and struct composition in Go - Say you are decoding a JSON object into a Go struct. It comes from a service that is not under your control, so you cannot do much about the schema. However, you want to encode it differently.

Standard Package Layout - These are seen as big issues in the Go community but there’s another issue that’s rarely mentioned β€” application package layout.

Go best practices, six years in - Hints and practices to manage Golang project.

Don’t use Go’s default HTTP client - Go’s http package doesn’t specify request timeouts by default, allowing services to hijack your goroutines. Always specify a custom http.Client when connecting to outside services.