Go io/ioutil Package ReadFile()
ReadFile()
package main /*w w w . jav a 2 s .com*/ import ( "fmt" "io/ioutil" ) func main() { bs, err := ioutil.ReadFile("main.go") if err != nil { return } str := string(bs) fmt.Println(str) }