Skip to content

Instantly share code, notes, and snippets.

@mehlon
Forked from garry415/gist:bd83a3693bf03dbd5438
Last active May 13, 2016 20:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mehlon/233261a982d81bfbf5de to your computer and use it in GitHub Desktop.
Save mehlon/233261a982d81bfbf5de to your computer and use it in GitHub Desktop.
// This works in both `go build` and `gomobile bind`.
package readsomething
import (
"io"
"io/ioutil"
)
type Reader io.Reader
func ReadSomething(r Reader) ([]byte, error) {
result, err := ioutil.ReadAll(r)
if err != nil {
return nil, err
}
return result, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment