Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stepanbujnak/6b0e0efecd79158ac174e06874a99466 to your computer and use it in GitHub Desktop.
Save stepanbujnak/6b0e0efecd79158ac174e06874a99466 to your computer and use it in GitHub Desktop.
:~$ cat test.go
package main
import "os"
func main() {
file, err := os.OpenFile("helloworld", os.O_WRONLY|os.O_CREATE, os.ModePerm)
if err != nil {
panic(err)
}
defer file.Close()
err = file.Truncate(1024 * 1024)
if err != nil {
panic(err)
}
}
:~$ go run test.go
:~$ du -sh helloworld
0 helloworld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment