Skip to main content
Yaroslav Grebnov
Golang developer, SDET
View all authors

Concurrent streaming in Go with channels

· 6 min read
Yaroslav Grebnov
Golang developer, SDET

The previous exercises map a finite slice with sync.WaitGroup or errgroup. This version processes values as they arrive. The input size does not need to be known, and successful results can be consumed before the input channel closes.

Stream accepts a receive-only input channel and returns separate receive-only result and error channels. A fixed worker pool bounds concurrency.

Parallel map in Go with sync.WaitGroup

· 5 min read
Yaroslav Grebnov
Golang developer, SDET

This interview exercise starts with a concurrent map and adds the invariants interviewers commonly ask about: stable order, identifiable results, bounded concurrency, cancellation, and panic recovery.

The final implementation returns one result for every input. A failed or panicking task does not hide the results of other tasks.

Adding context to errors in Go

· 4 min read
Yaroslav Grebnov
Golang developer, SDET

This post compares two ways to enrich Go errors — both sentinel and typed — with additional context:

  • github.com/ygrebnov/errorc.With
  • the standard fmt.Errorf approach

The main difference is not only syntax. errorc gives you a more structured way to attach fields, and it works especially well together with github.com/ygrebnov/keys when you want stable hierarchical field names such as user.id or request.trace_id.

How to use enums in Python applications

· 18 min read
Yaroslav Grebnov
Golang developer, SDET

Python enum package allows to utilise very powerful functionality in terms of managing constants and configuration entities. These entities are very compact and in many cases are more convenient to use than dictionaries or configuration files in any format. In a set of examples below, we will demonstrate how to use enums in Python applications as well as the benefits of such usage.