1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:24:41 -07:00
go/internal/imports/proxy_112_test.go
Heschi Kreinick 757ca719ca imports: rename to internal/imports
For various reasons we need an internal-facing imports API. Move imports
to internal/imports, leaving behind a small wrapper package. The wrapper
package captures the globals at time of call into the options struct.

Also converts the last goimports tests to use the test helpers, and
fixes go/packages in module mode to work with empty modules, which was
necessary to get those last tests converted.

Change-Id: Ib1212c67908741a1800b992ef1935d563c6ade32
Reviewed-on: https://go-review.googlesource.com/c/tools/+/175437
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-05-20 21:49:35 +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)
}