1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:34:45 -07:00

cmd/bundle: add flag to rewrite golang.org/ to golang_org/ in imports

I've been doing this by hand since Go 1.7rc2.

Updates golang/go#16333

Change-Id: Ib12c013b14210123d48d6ad78922caf1286c20cc
Reviewed-on: https://go-review.googlesource.com/29086
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Brad Fitzpatrick 2016-09-12 22:56:01 +00:00
parent 5ffc3249d3
commit f1a397bba5

View File

@ -107,6 +107,7 @@ var (
dstPath = flag.String("dst", "", "set destination import `path` (default taken from current directory)") dstPath = flag.String("dst", "", "set destination import `path` (default taken from current directory)")
pkgName = flag.String("pkg", "", "set destination package `name` (default taken from current directory)") pkgName = flag.String("pkg", "", "set destination package `name` (default taken from current directory)")
prefix = flag.String("prefix", "", "set bundled identifier prefix to `p` (default source package name + \"_\")") prefix = flag.String("prefix", "", "set bundled identifier prefix to `p` (default source package name + \"_\")")
underscore = flag.Bool("underscore", false, "rewrite golang.org to golang_org in imports; temporary workaround for golang.org/issue/16333")
importMap = map[string]string{} importMap = map[string]string{}
) )
@ -296,6 +297,9 @@ func bundle(src, dst, dstpkg, prefix string) ([]byte, error) {
if isStandardImportPath(path) { if isStandardImportPath(path) {
pkgStd[spec] = true pkgStd[spec] = true
} else { } else {
if *underscore {
spec = strings.Replace(spec, "golang.org/", "golang_org/", 1)
}
pkgExt[spec] = true pkgExt[spec] = true
} }
} }