mod: fix mod get

Signed-off-by: Sam Alba <samalba@users.noreply.github.com>
This commit is contained in:
Sam Alba 2021-11-03 21:53:38 -07:00
parent 33685f9bbf
commit 285edb4cf0

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"os" "os"
"path" "path"
"path/filepath"
"regexp" "regexp"
"strings" "strings"
) )
@ -85,6 +86,11 @@ func replace(r *Require, sourceRepoPath, destPath string) error {
return err 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 { if err := os.Rename(path.Join(sourceRepoPath, r.clonePath), destPath); err != nil {
return err return err
} }