Package ioutil
Table of Contents
Read a text file howto
foo.txtHello, World!
bytes, err := ioutil.ReadFile("foo.txt")
if err != nil {
fmt.Print(err)
}
fmt.Println(string(bytes))
Hello, World!
Hello, World!
bytes, err := ioutil.ReadFile("foo.txt")
if err != nil {
fmt.Print(err)
}
fmt.Println(string(bytes))
Hello, World!