Skip to content

Instantly share code, notes, and snippets.

@Kairi
Created September 16, 2014 06:15
Show Gist options
  • Select an option

  • Save Kairi/60c4d6d034910332a560 to your computer and use it in GitHub Desktop.

Select an option

Save Kairi/60c4d6d034910332a560 to your computer and use it in GitHub Desktop.
read file in golang using "ioutil"
package main
import (
"io/ioutil"
"log"
"fmt"
)
func main() {
message, err := ioutil.ReadFile("./file_name.txt")
if err != nil {
log.Fatal(err)
}
fmt.Print(string(message))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment