MCPcopy Create free account
hub / github.com/conforma/cli / copyFile

Function copyFile

acceptance/kubernetes/kind/image.go:404–419  ·  view source on GitHub ↗

copyFile copies a file from src to dst, preserving the executable permission.

(src, dst string)

Source from the content-addressed store, hash-verified

402
403// copyFile copies a file from src to dst, preserving the executable permission.
404func copyFile(src, dst string) error {
405 in, err := os.Open(src)
406 if err != nil {
407 return err
408 }
409 defer in.Close()
410
411 out, err := os.OpenFile(dst, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0o755) // #nosec G302
412 if err != nil {
413 return err
414 }
415 defer out.Close()
416
417 _, err = io.Copy(out, in)
418 return err
419}
420
421// Tar and gzip a file. Used with trusted artifacts.
422func tarGzipFile(source, target string) error {

Callers 1

buildCliImageMethod · 0.85

Calls 2

CloseMethod · 0.65
OpenMethod · 0.45

Tested by

no test coverage detected