Created
July 14, 2017 22:28
-
-
Save stepanbujnak/6b0e0efecd79158ac174e06874a99466 to your computer and use it in GitHub Desktop.
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
:~$ 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