January 2018
Intermediate to advanced
340 pages
8h 6m
English
This following example is straightforward, and it demonstrates how to delete a file. The standard package provides os.Remove(), which expects a file path:
package main
import (
"log"
"os"
)
func main() {
err := os.Remove("test.txt")
if err != nil {
log.Fatal(err)
}
}
Read now
Unlock full access