mirror of
https://github.com/golang/go
synced 2024-11-18 22:34:45 -07:00
x/tools/go/packages/packagestest: fix GOPROXY file URLs for Windows
On Windows, file URLs should look like file:///C:/foo/bar instead of file://C:/foo/bar. In the latter case, the "C:" is parsed as the host. Updates golang/go#31675 Change-Id: I7f75be44dd5d289de3ffdbd20a78130ed03cd233 Reviewed-on: https://go-review.googlesource.com/c/tools/+/173918 Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
36563e24a2
commit
31fd60d6bf
@ -14,6 +14,7 @@ import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/tools/go/packages"
|
||||
)
|
||||
@ -101,6 +102,13 @@ func (modules) Finalize(exported *Exported) error {
|
||||
return fmt.Errorf("creating module proxy dir for %v: %v", module, err)
|
||||
}
|
||||
}
|
||||
proxyURL := filepath.ToSlash(proxyDir)
|
||||
if !strings.HasPrefix(proxyURL, "/") {
|
||||
// Windows paths will look like C:/foo/bar. In the URL, the C: will be
|
||||
// interpreted as the host, so add a leading /. See golang.org/issue/6027.
|
||||
proxyURL = "/" + proxyURL
|
||||
}
|
||||
proxyURL = "file://" + proxyURL
|
||||
|
||||
// Discard the original mod cache dir, which contained the files written
|
||||
// for us by Export.
|
||||
|
Loading…
Reference in New Issue
Block a user