1
0
mirror of https://github.com/golang/go synced 2024-11-18 23:34:45 -07:00
go/imports/proxy_112_test.go
Jay Conrod 2d660fb8a0 go/packages/packagestest: fix GOPROXY file URLs for Windows
Amends prematurely submitted CL 173918. We now use file:/// URLs for
go1.13 and later and file:// URLs for go1.12 and earlier.

Fixes golang/go#31675

Change-Id: I009c63a900bdfd091bf46def5cea5a0843639b47
Reviewed-on: https://go-review.googlesource.com/c/tools/+/173919
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-25 21:41:24 +00:00

21 lines
713 B
Go

// +build !go1.13
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package imports
import "path/filepath"
// TODO: use proxy functionality in golang.org/x/tools/go/packages/packagestest
// instead of copying it here.
func proxyDirToURL(dir string) string {
// Prior to go1.13, the Go command on Windows only accepted GOPROXY file URLs
// of the form file://C:/path/to/proxy. This was incorrect: when parsed, "C:"
// is interpreted as the host. See golang.org/issue/6027. This has been
// fixed in go1.13, but we emit the old format for old releases.
return "file://" + filepath.ToSlash(dir)
}