Read a whole file into a string (byte slice)

yourbasic.org/golang

Use ioutil.ReadFile in package io/ioutil to read a whole file into a byte slice.

b, err := ioutil.ReadFile("file.txt") // b has type []byte
if err != nil {
    log.Fatal(err)
}
s := string(b)