MCPcopy
hub / github.com/snyk/cli / copyFile

Function copyFile

cliv2/test/testlib.go:157–172  ·  view source on GitHub ↗
(sourcePath, destinationPath string)

Source from the content-addressed store, hash-verified

155}
156
157func copyFile(sourcePath, destinationPath string) error {
158 source, err := os.Open(sourcePath)
159 if err != nil {
160 return err
161 }
162 defer func() { _ = source.Close() }()
163
164 destination, err := os.Create(destinationPath)
165 if err != nil {
166 return err
167 }
168 defer func() { _ = destination.Close() }()
169
170 _, err = io.Copy(destination, source)
171 return err
172}
173
174func copyDir(sourceDir, destinationDir string) error {
175 sourceStat, err := os.Stat(sourceDir)

Callers 2

SetupTestProjectFunction · 0.85
copyDirFunction · 0.85

Calls 1

CloseMethod · 0.80

Tested by

no test coverage detected