Get the latest tech news
Too Much Go Misdirection
much go misdirection Poking through layers of indirection in go trying to recover some efficiency. Many functions in go take an io.Reader interface as input.
So the primary do the work function takes a[]byte and passes it to C, and there’s a wrapper that does things the go way with an io.Reader, which does a full read into a temporary buffer before sending it along. Turns out the go image library does its own type inspection, looking for a Peek function, and if it’s not found, wraps the reader in a bufio.Reader instead. The approach (in general, not my specific wizardry) only scales to the extent people stick with the standard types.
Or read this on Hacker News