Files
supersonic/backend/util/util.go
T
Michael Manganiello 801967a530 misc: Upgrade Go to v1.21
Upgrade to 1.21 as 1.20 is now unmaintained.

Most changes are related to the new `slices` package from standard
library, which can replace some existing custom functions.
2024-03-05 09:49:10 -03:00

24 lines
298 B
Go

package util
import (
"io"
"os"
)
func CopyFile(srcPath, dstPath string) error {
fin, err := os.Open(srcPath)
if err != nil {
return err
}
defer fin.Close()
fout, err := os.Create(dstPath)
if err != nil {
return err
}
defer fout.Close()
_, err = io.Copy(fout, fin)
return err
}