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
Post a Comment