Answers for "golang reading a file"

Go
3

golang read file

dat, err := ioutil.ReadFile("/tmp/dat")
    check(err)
    fmt.Print(string(dat))
Posted by: Guest on November-02-2020
1

golang read file

file_data, err := ioutil.ReadFile("./index.html")
if err != nil {
	fmt.Println(err)
}
fmt.Println(file_data)
Posted by: Guest on February-04-2022

Browse Popular Code Answers by Language