Skip to content

Instantly share code, notes, and snippets.

@tmtk75
Created August 28, 2013 00:21
Show Gist options
  • Select an option

  • Save tmtk75/6360714 to your computer and use it in GitHub Desktop.

Select an option

Save tmtk75/6360714 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
)
func main() {
file, err := os.Open("file_read.go")
defer file.Close()
if err != nil {
panic(err)
}
data := make([]byte, 50)
fmt.Println(file)
file.Read(data)
fmt.Println(string(data))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment