Package ioutil

Table of Contents

Read a text file howto

foo.txt
Hello, World!
bytes, err := ioutil.ReadFile("foo.txt")
if err != nil {
        fmt.Print(err)
}
fmt.Println(string(bytes))
Hello, World!