Skip to content

Commit f1a397b

Browse files
committed
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 <[email protected]>
1 parent 5ffc324 commit f1a397b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cmd/bundle/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ var (
107107
dstPath = flag.String("dst", "", "set destination import `path` (default taken from current directory)")
108108
pkgName = flag.String("pkg", "", "set destination package `name` (default taken from current directory)")
109109
prefix = flag.String("prefix", "", "set bundled identifier prefix to `p` (default source package name + \"_\")")
110+
underscore = flag.Bool("underscore", false, "rewrite golang.org to golang_org in imports; temporary workaround for golang.org/issue/16333")
110111

111112
importMap = map[string]string{}
112113
)
@@ -296,6 +297,9 @@ func bundle(src, dst, dstpkg, prefix string) ([]byte, error) {
296297
if isStandardImportPath(path) {
297298
pkgStd[spec] = true
298299
} else {
300+
if *underscore {
301+
spec = strings.Replace(spec, "golang.org/", "golang_org/", 1)
302+
}
299303
pkgExt[spec] = true
300304
}
301305
}

0 commit comments

Comments
 (0)