The following code works fine in Linux but when I compile and run in Windows the os.Remove function does not work or throw any errors. What can be the reason.??
infile := dl.fileName + "." + strconv.Itoa(j)
in, _ := os.Open(infile)
defer os.Remove(infile)
_, err := io.Copy(out, in)
if err != nil {
fmt.Fprintln("Error occured", err))
err:=os.Remove(infile)
if err!=nil {
fmt.Fprintln(err)
} else {
fmt.Fprintln("file ", infile, "joined")
err:=os.Remove(infile)
if err!=nil {
fmt.Fprintln(err)
}