- Hands-On System Programming with Go
- Alex Guerrieri
- 40字
- 2021-06-24 13:42:28
Delete
In order to delete a file, there is another simple function, called os.Remove, as shown in the following code:
package main
import "os"
func main() {
if err := os.Remove("file.txt"); err != nil {
fmt.Println("Error:", err)
}
}