From 285edb4cf0005e2c12b2db1ee48ae49f230c6c83 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Wed, 3 Nov 2021 21:53:38 -0700 Subject: [PATCH] mod: fix mod get Signed-off-by: Sam Alba --- mod/require.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mod/require.go b/mod/require.go index 50f13aba..157a7f1a 100644 --- a/mod/require.go +++ b/mod/require.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "path" + "path/filepath" "regexp" "strings" ) @@ -85,6 +86,11 @@ func replace(r *Require, sourceRepoPath, destPath string) error { return err } + // Make sure the destination exists + if err := os.MkdirAll(filepath.Dir(destPath), 0755); err != nil { + return err + } + if err := os.Rename(path.Join(sourceRepoPath, r.clonePath), destPath); err != nil { return err }