/fscopy

File system copy functions for Go.

Primary LanguageGoMIT LicenseMIT

Go Reference Go Report Card Build Status codecov License: MIT

Package fscopy implements file system copy functions not present in standard library.

fscopy.Dir( "/home/nofeatures/dst-dir", "/home/nofeatures/source-dir" )
fscopy.File( "/home/nofeatures/dst-file", "/home/nofeatures/source-file" )
fscopy.Into( "/home/nofeatures/dst-dir", "/tmp/file1", "/tmp/file2", "/tmp/some-dir" )

Circular References and symlinks

The types of environments where I intend to use this package are somewhat manicured and highly unlikely to experience issues related to symlinks or circular references. As such this package has no logic or consideration for symlinks. However fscopy.Dir() does have a low-effort mechanism to track src-to-dst copies that have already occurred and will not duplicate its efforts.

Test Coverage

I don't expect test coverage for this package will ever achieve 100%. The majority of statements that are not covered are return errors.Go(err) (essentially return err) where os.Stat() or os.File.Close() or io.Copy() have returned a non-nil error. While I could put in the efforts to mock such operations I don't feel the extra complexity would be worth the trade off in code coverage.