Created
December 5, 2018 09:39
-
-
Save sonyarianto/e4ce064d94a7af56f6806b85cd593949 to your computer and use it in GitHub Desktop.
Load a text file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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