hack to override golang.org/x URL's

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-11 21:14:46 -05:00
parent 5bc1a24a69
commit bf2a42ec64
1 changed files with 39 additions and 0 deletions

39
new.go
View File

@ -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
}