Golang: How to Read File All Content in one time

package main

import (
	"fmt"
	"io/ioutil"
	"os"
)

func main() {
	content, err := ioutil.ReadFile("d:/fileOpen.txt") // Read all the contents of a file at once, which can affect performance when the file is large
	if err != nil {
		fmt.Println("read file err:", err)
		os.Exit(2)
	}
	fmt.Println(string(content))
}

Read More: