MCPcopy Index your code
hub / github.com/go-python/gopy / copyCmd

Function copyCmd

main.go:77–103  ·  view source on GitHub ↗
(src, dst string)

Source from the content-addressed store, hash-verified

75}
76
77func copyCmd(src, dst string) error {
78 srcf, err := os.Open(src)
79 if err != nil {
80 return errors.Wrap(err, "could not open source for copy")
81 }
82 defer srcf.Close()
83
84 os.MkdirAll(path.Dir(dst), 0755)
85
86 dstf, err := os.Create(dst)
87 if err != nil {
88 return errors.Wrap(err, "could not create destination for copy")
89 }
90 defer dstf.Close()
91
92 _, err = io.Copy(dstf, srcf)
93 if err != nil {
94 return errors.Wrap(err, "could not copy bytes to destination")
95 }
96
97 err = dstf.Sync()
98 if err != nil {
99 return errors.Wrap(err, "could not synchronize destination")
100 }
101
102 return dstf.Close()
103}

Callers 1

testPkgBackendFunction · 0.85

Calls

no outgoing calls

Tested by 1

testPkgBackendFunction · 0.68