diff --git a/new.go b/new.go index 670c967..7776aec 100644 --- a/new.go +++ b/new.go @@ -127,13 +127,52 @@ func Clone(wdir string, path string) error { if err != nil { return err } + switch path { + case "golang.org/x/crypto": + path = "go.googlesource.com/crypto" + case "golang.org/x/mod": + path = "go.googlesource.com/mod" + case "golang.org/x/net": + path = "go.googlesource.com/net" + case "golang.org/x/sys": + path = "go.googlesource.com/sys" + case "golang.org/x/sync": + path = "go.googlesource.com/sync" + case "golang.org/x/term": + path = "go.googlesource.com/term" + case "golang.org/x/text": + path = "go.googlesource.com/text" + case "golang.org/x/tools": + path = "go.googlesource.com/tools" + case "golang.org/x/xerrors": + path = "go.googlesource.com/xerrors" + } + shell.RunPath(fulldir, []string{"git", "clone", "http://" + path}) if IsDirectory(fullpath) { // clone worked return nil } var url string + // TODO: attempt to work around things like: + // go get golang.org/x/term + // is now supposed to be: + // git clone https://go.googlesource.com/term // if url, err = findGoImport("http://" + path); err != nil { + if path == "golang.org/x/term" { + log.Warn("IMPLEMENT git clone hack here. path =", path) + log.Warn("IMPLEMENT git clone hack here. path =", path) + path = "go.googlesource.com/term" + log.Warn("IMPLEMENT git clone hack here. new path =", path) + log.Warn("IMPLEMENT git clone hack here. new path =", path) + shell.RunPath(fulldir, []string{"git", "clone", "http://" + path}) + if IsDirectory(fullpath) { + // clone worked + return nil + } + } + + // this creates a valid URL for git clone if url, err = runGoList(path); err != nil { return err }