Go

Scheduling In Go : Part I - OS Scheduler, Scheduling In Go : Part II - Go Scheduler and Scheduling In Go : Part III - Concurrency provide an understanding of the mechanics and semantics behind the scheduler in Go

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.

Building an Unbounded Channel in Go The default un-buffered channels pass values from one goroutine to another, one at a time. The goroutine that writes to the channel blocks until another goroutine reads from the same channel. A buffered channel gives writers a bit more flexibility. When a channel is buffered, a set number of values can be written to the channel and not read before the channel blocks. It behaves like a synchronized queue with a bounded size. The post explains how to build Erlangโ€™s style unbounded queues.

Organising Database Access in Go In the context of a web application what would you consider a Go best practice for accessing the database in (HTTP or other) handlers? The post analyses various design pattern they pros and cons.

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.

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.

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.

Dealing with JSON with non-homogeneous types in GO - Dynamic languages supports non-homogeneous schemas out-of-the-box (e.g. [ { "value": "123" }, { "value": 123 } ]). The post explains how to achieve this with type-safe approach in Golang.

Golang Parsing JSON into Interfaces - Interfaces are an incredibly powerful feature in Go, and JSON is one of the most ubiquitous serialization formats in use today. The post explains how to handle sum-type support in JSON with interfaces.

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.

A Simple Web Scraper in Go and Web Scrapping With Golang are easy technic to parse HTML output of website. Most of the online bots are based on same technic to get required information

Iterating Over Slices In Go In Go everything is pass by value. We can pass by value the address of an object or pass by value a copy of an object. That includes function parameters, return values and when iterating over a slice, map or channel.

Recursion And Tail Calls In Go Go does not optimize for recursion, even if tail calls are explicit. The post explains in details a Golang design of recursive calls and how to improve the memory consumption in recursive algorithms.

Golang Unsafe Type Conversions and Memory Access Go is a strongly typed, you have to convert variable from one type to another to use in different parts of application. But sometimes you need to step around this type safety. It could be needed to optimization of bottle necks in high load systems, where every tick counts. Unsafe operation potentially could safe a lot of allocations. Unsafe also allows to hack into any struct field, including slices, strings, maps etc.

Errors

Why Go gets exceptions right explains how the error handling made right in Go to compare with C, C++ and Java.

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.

Constant errors post show up the issue with sentinel error values in Go, it proposes alternative and type-safe solution to express errors using const. The approach advances error declaration and handling towards behaviour-based approach to inspect errors.

Inspecting errors Donโ€™t assert errors for type, assert for behaviour. For package authors, if your package generates errors of a temporary nature, ensure you return error types that implement the respective interface methods. For package users, if you need to inspect an error, use interfaces to assert the behaviour you expect, not the errorโ€™s type.

Donโ€™t just check errors, handle them gracefully in-depth explanation about error handling strategies.