Since Go 1.13 we have the ability to chain errors, unwrap them and check if any error in the chain matches any of expected errors via errors.Is() and errors.As().
To wrap an error all you have to do is use %w verb with fmt.Errorf() like below.
fmt.Errorf("Custom message: %w", err)
This is easy, it wraps err in another one with additional message. But let's say I need some more context than just a message. How do I wrap err in my own, structured, custom error? Using Go 1.13+ standard library only.