Go: Read / Print the content of files — the simplest way


The easiest way to get the content (as a string) of a file in Go is:

import "io/ioutil"
//[..]
content, err := ioutil.ReadFile("./myDirectory/myFile.txt")
fmt.Println(string(content))
fmt.Print(err)

Comments

Popular posts from this blog

Apple's evaluating a new JVM

Tuning ext4 for performance with emphasis on SSD usage