What’s wrong with this
m, err := os.Truncate(path,0)
if err != nil {
log.Printf("Failed to truncate: %v", err)
}
if I do above I am getting an error like this
cannot initialize 2 variables with 1 values
while this works without an issue
if err := os.Truncate(path, 0); err != nil {
log.Printf("Failed to truncate: %v", err)
}
>Solution :
function os.Truncate will just affect the file in the path. Only return error, nothing else.