Skip to content

Instantly share code, notes, and snippets.

@sonyarianto
Created December 5, 2018 09:39
Show Gist options
  • Save sonyarianto/e4ce064d94a7af56f6806b85cd593949 to your computer and use it in GitHub Desktop.
Save sonyarianto/e4ce064d94a7af56f6806b85cd593949 to your computer and use it in GitHub Desktop.
Load a text file
package main
import (
"fmt"
"io/ioutil"
"log"
)
func main() {
fileContent, err := ioutil.ReadFile("my-text-file.txt")
if err != nil {
log.Fatal(err)
}
fmt.Println(string(fileContent))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment