Golang : Delete file
Tags : golang delete
Deleting file in Go is simple. This short tutorial will demonstrate how to delete a file.
Let choose a file deleteme.file
as target practice and the code example below will remove the deleteme.file
when executed.
deletefile.go
package main
import (
"fmt"
"os"
)
func main() {
err := os.Remove("deleteme.file")
if err != nil {
fmt.Println(err)
return
}
}
Reference :
See also : Golang : Rename file
Tags : golang delete
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+3.7k Golang : Detect user location with HTML5 geo-location
+6k Golang : How to check for empty array string or string?
+2.2k CodeIgniter : form input set_value cause " to become & quot
+2.9k Golang : How to control fmt or log print format?
+5.9k Golang : "https://" not allowed in import path
+6.9k Golang : How to get time from unix nano example
+7.5k Golang : Find smallest number in array
+2.3k Get Facebook friends working in same company
191 Golang : How to handle file size larger than available memory panic issue
+6.9k Golang : HTTP response JSON encoded data
+4.9k Golang : Get timezone offset from date or timestamp
+3.3k Golang : Proper way to test CIDR membership of an IP 4 or 6 address example