MCPcopy
hub / github.com/MadAppGang/dingo / copyModFiles

Method copyModFiles

pkg/shadow/builder.go:262–282  ·  view source on GitHub ↗

copyModFiles copies go.mod and go.sum to the shadow directory, adjusting relative replace directives as needed

()

Source from the content-addressed store, hash-verified

260// copyModFiles copies go.mod and go.sum to the shadow directory,
261// adjusting relative replace directives as needed
262func (b *Builder) copyModFiles() error {
263 // Copy go.mod with path adjustments
264 srcMod := filepath.Join(b.WorkspaceRoot, "go.mod")
265 dstMod := filepath.Join(b.ShadowDir, "go.mod")
266
267 if err := b.copyGoMod(srcMod, dstMod); err != nil {
268 return fmt.Errorf("go.mod: %w", err)
269 }
270
271 // Copy go.sum as-is (if exists)
272 srcSum := filepath.Join(b.WorkspaceRoot, "go.sum")
273 dstSum := filepath.Join(b.ShadowDir, "go.sum")
274
275 if _, err := os.Stat(srcSum); err == nil {
276 if err := copyFile(srcSum, dstSum); err != nil {
277 return fmt.Errorf("go.sum: %w", err)
278 }
279 }
280
281 return nil
282}
283
284// copyGoMod copies go.mod, adjusting relative replace directives
285func (b *Builder) copyGoMod(src, dst string) error {

Callers 1

BuildMethod · 0.95

Calls 3

copyGoModMethod · 0.95
copyFileFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected