Create an empty file
Example
package main
import (
"log"
"os"
)
func main() {
emptyFile, err := os.Create("empty.txt")
if err != nil {
log.Fatal(err)
}
log.Println(emptyFile)
emptyFile.Close()
}
Output
2018/08/11 15:46:04 &{0xc042060780}
Most Helpful This Week
Go program to extracting or unzip a Zip format file
Golang Create Copy of a file at another location
Go program to compress list of files into Zip file
Go program to read a text file character by character
Golang Changing permissions, ownership, and timestamps
Go program to Create directory or folder if not exist