'Deleting content of file without deleting the file in Golang
I have a CSV file let's say crop.csv I want to delete its content only (which will make crop.csv empty) without deleting the crop.csv file.
Solution 1:[1]
import os.exec
err := exec.Command("/bin/bash", "-c", "echo > filepath").Run()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Paul Roub |
