From 8554fd6e7dbfc76805ca48b71765879eeb6fb64d Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 11 Jan 2018 17:37:16 -0800 Subject: [PATCH] cmd/compile: document reserved import paths Fixes #20708. Change-Id: I2db450947b64b8b5af3822c7fbcc3e99746ae9d7 Reviewed-on: https://go-review.googlesource.com/87496 Reviewed-by: Brad Fitzpatrick Reviewed-by: Matthew Dempsky --- src/cmd/compile/internal/gc/subr.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cmd/compile/internal/gc/subr.go b/src/cmd/compile/internal/gc/subr.go index a45c15a44e..e0925dc7f2 100644 --- a/src/cmd/compile/internal/gc/subr.go +++ b/src/cmd/compile/internal/gc/subr.go @@ -1974,6 +1974,11 @@ func addinit(n *Node, init []*Node) *Node { return n } +// The linker uses the magic symbol prefixes "go." and "type." +// Avoid potential confusion between import paths and symbols +// by rejecting these reserved imports for now. Also, people +// "can do weird things in GOPATH and we'd prefer they didn't +// do _that_ weird thing" (per rsc). See also #4257. var reservedimports = []string{ "go", "type", -- 2.48.1