MCPcopy Index your code
hub / github.com/google/go-github / copyFile

Function copyFile

tools/metadata/main_test.go:246–277  ·  view source on GitHub ↗
(src, dst string)

Source from the content-addressed store, hash-verified

244}
245
246func copyFile(src, dst string) (errOut error) {
247 srcDirStat, err := os.Stat(filepath.Dir(src))
248 if err != nil {
249 return err
250 }
251 err = os.MkdirAll(filepath.Dir(dst), srcDirStat.Mode())
252 if err != nil {
253 return err
254 }
255 dstFile, err := os.Create(dst)
256 if err != nil {
257 return err
258 }
259 defer func() {
260 e := dstFile.Close()
261 if errOut == nil {
262 errOut = e
263 }
264 }()
265 srcFile, err := os.Open(src)
266 if err != nil {
267 return err
268 }
269 defer func() {
270 e := srcFile.Close()
271 if errOut == nil {
272 errOut = e
273 }
274 }()
275 _, err = io.Copy(dstFile, srcFile)
276 return err
277}
278
279type testRun struct {
280 t *testing.T

Callers 2

updateGoldenDirFunction · 0.85
copyDirFunction · 0.85

Calls 2

CloseMethod · 0.80
CreateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…