Go Tidbit: Peek a Snippet From io.Reader

from blog Blog on hjr265.me, | ↗ original
You have an io.Reader, and you want to extract a small snippet from the beginning of the io.Reader and then put it back. Ideally, io.ReadSeeker would let you do that. But not all io.Readers can seek. And, like toothpaste from its tube, you cannot put something back once you read it from an io.Reader. But you can do the next best thing: 1 2 3 4 5...