TL;DR: Implement the error interface with as much contextual and relevant information as you can in a struct. Then use type switching, not equality or string parsing, to inspect the error.
if err != nil {
if !strings.Contains(err.Error(), "reader returned negative count from Read") {
//Do something
}