Skip to content

Commit d0ca393

Browse files
committed
cmd/bundle: change the behavior of the -underscore flag
It used to rewrite golang.org/x/* imports to golang_org/x/*. But https://golang.org/cl/147443 renamed golang_org/x to internal/x, which broke the ability to run "go generate" in net/http, which runs this command. Given that net/http (and Go itself) is the only caller of cmd/bundle or the -underscore flag, repurpose it to instead rewrite the golang.org/x imports to internal/x, like CL 147443. But we keep its name out of laziness and to minimize the number of cross-repo changes needed. Change-Id: I310ce8b45812a26c8b3522eaf407fffff138b1be Reviewed-on: https://go-review.googlesource.com/c/152097 Run-TryBot: Brad Fitzpatrick <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
1 parent e51e352 commit d0ca393

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/bundle/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ var (
106106
dstPath = flag.String("dst", "", "set destination import `path` (default taken from current directory)")
107107
pkgName = flag.String("pkg", "", "set destination package `name` (default taken from current directory)")
108108
prefix = flag.String("prefix", "&_", "set bundled identifier prefix to `p` (default is \"&_\", where & stands for the original name)")
109-
underscore = flag.Bool("underscore", false, "rewrite golang.org to golang_org in imports; temporary workaround for golang.org/issue/16333")
109+
underscore = flag.Bool("underscore", false, "rewrite golang.org/x/* to internal/x/* imports; temporary workaround for golang.org/issue/16333")
110110

111111
importMap = map[string]string{}
112112
)
@@ -298,7 +298,7 @@ func bundle(src, dst, dstpkg, prefix string) ([]byte, error) {
298298
pkgStd[spec] = true
299299
} else {
300300
if *underscore {
301-
spec = strings.Replace(spec, "golang.org/", "golang_org/", 1)
301+
spec = strings.Replace(spec, "golang.org/x/", "internal/x/", 1)
302302
}
303303
pkgExt[spec] = true
304304
}

0 commit comments

Comments
 (0)