From f1a397bba50dee815e8c73f3ec94ffc0e8df1a09 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 12 Sep 2016 22:56:01 +0000 Subject: [PATCH] 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 --- cmd/bundle/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/bundle/main.go b/cmd/bundle/main.go index b53ced4d..87ef208d 100644 --- a/cmd/bundle/main.go +++ b/cmd/bundle/main.go @@ -107,6 +107,7 @@ var ( 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)") 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{} ) @@ -296,6 +297,9 @@ func bundle(src, dst, dstpkg, prefix string) ([]byte, error) { if isStandardImportPath(path) { pkgStd[spec] = true } else { + if *underscore { + spec = strings.Replace(spec, "golang.org/", "golang_org/", 1) + } pkgExt[spec] = true } }