]> Cypherpunks repositories - gostls13.git/commit
gc: add -p flag to catch import cycles earlier
authorRuss Cox <rsc@golang.org>
Wed, 7 Sep 2011 19:50:21 +0000 (15:50 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 7 Sep 2011 19:50:21 +0000 (15:50 -0400)
commit1e480cd1adde73b0f7549a2d0c79bcc666ebb74d
tree7cd14d94ac22229537966325bca45c7dfb7f2e64
parentef01ebf4035063442d93ab4aadd0b56dc8ef05b8
gc: add -p flag to catch import cycles earlier

The linker would catch them if gc succeeded,
but too often the cycle manifests as making the
current package and the imported copy of itself
appear as different packages, which result in
type signature mismatches that confuse users.

As a crutch, add the -p flag to say 'if you see an
import of this package, give up early'.  Results in
messages like (during gotest in sort):

export_test.go:7: import "sort" while compiling that package (import cycle)
export_test.go:7: import "container/heap": package depends on "sort" (import cycle)

Fixes #2042.

R=ken
CC=bradfitz, dsymonds, golang-dev
https://golang.org/cl/4972057
src/Make.pkg
src/cmd/gc/doc.go
src/cmd/gc/go.h
src/cmd/gc/go.y
src/cmd/gc/lex.c
src/cmd/gc/subr.c