Arpith Siromoney 💬

Go: Reading lines from (small) files

Not much to talk about today, I’m going to be reading a bunch of strings from a file (not just two). It’s not really a whole lot, so I’m going to be lazy and just read the file and split it by newline characters:

    dat, e := ioutil.ReadFile("")
    if e != nil {
    strs := strings.Split(string(dat), "\n")

Note that Split deals with strings but ReadFile returns a slice of bytes.