]> Cypherpunks repositories - gostls13.git/commitdiff
catch package net import "net" for release
authorRuss Cox <rsc@golang.org>
Tue, 1 Sep 2009 21:12:09 +0000 (14:12 -0700)
committerRuss Cox <rsc@golang.org>
Tue, 1 Sep 2009 21:12:09 +0000 (14:12 -0700)
R=ken
OCL=34205
CL=34207

src/cmd/gc/go.y
test/fixedbugs/bug133.dir/bug2.go

index dfee62293b4262a16b08060444b535ed59ea0bcd..920799ec1361081259d63e2e10484880ef11f8f3 100644 (file)
@@ -230,6 +230,16 @@ import_package:
                pkgimportname = $2;
                if(strcmp($2->name, "main") == 0)
                        yyerror("cannot import package main");
+                       
+               // TODO(rsc): This is not quite precise enough a check
+               // (it excludes google/util/hash from importing hash)
+               // but it is enough to reduce confusion during the 
+               // 2009/09/01 release when all the "import myself"
+               // statements have to go away in programs building
+               // against the release.  Once the programs have converted
+               // it should probably just go away.
+               if(strcmp($2->name, package) == 0)
+                       yyerror("package cannot import itself (anymore)");
        }
 
 import_there:
index 0b8393c9341108d4e3ddbadea19a0099bd6f6c89..cfbb558bfdb6bc18603a2fb1815d2bf4acdabcd6 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package bug1
+package bug2
 
 import "./bug1"
 import "./bug0"