Created
June 11, 2015 07:59
-
-
Save pm-kartik-sura/c940714de93ed6fb54b4 to your computer and use it in GitHub Desktop.
Read file into string
This file contains hidden or 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" | |
| ) | |
| func main() { | |
| file, err := ioutil.ReadFile("testfile.txt") | |
| if err != nil { | |
| fmt.Println(err) | |
| return | |
| } | |
| // out the file content | |
| fmt.Println(string(file)) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment