Skip to content

Instantly share code, notes, and snippets.

@jbgo
Last active December 31, 2015 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbgo/8056395 to your computer and use it in GitHub Desktop.
Save jbgo/8056395 to your computer and use it in GitHub Desktop.
go-isms

Starting a collection of common programming tasks expressed in Go.

Read a file as a string

Imports: bytes, io/ioutil

data, err := ioutil.ReadFile("path/to/file")
buf := bytes.NewBuffer(data)
str := buf.String()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment