Posted on 10th September 2024|14 views
How can I read a file to string?
Posted on 10th September 2024| views
Here is the example
package main
import (
"fmt"
"io/ioutil"
"log"
)
func main() {
content, err := ioutil.ReadFile("mindmajix.txt")
if err != nil {
log.Fatal(err)
}
text := string(content)
fmt.Println(text)
}