mirror of https://github.com/golang/go.git
cmd/link: remove dead importcycles function
The importcycles method has not been useful since April 2016 when a large code deletion was performed. The compiler itself provides some protection against import cycles, and the linker now does import cycle detection in linksetup -> postorder. For #57400
This commit is contained in:
parent
a5a4744250
commit
87a46153b1
|
|
@ -452,48 +452,3 @@ func (ctxt *Link) addexport() {
|
|||
adddynlib(ctxt, lib)
|
||||
}
|
||||
}
|
||||
|
||||
type Pkg struct {
|
||||
mark bool
|
||||
checked bool
|
||||
path string
|
||||
impby []*Pkg
|
||||
}
|
||||
|
||||
var pkgall []*Pkg
|
||||
|
||||
func (p *Pkg) cycle() *Pkg {
|
||||
if p.checked {
|
||||
return nil
|
||||
}
|
||||
|
||||
if p.mark {
|
||||
nerrors++
|
||||
fmt.Printf("import cycle:\n")
|
||||
fmt.Printf("\t%s\n", p.path)
|
||||
return p
|
||||
}
|
||||
|
||||
p.mark = true
|
||||
for _, q := range p.impby {
|
||||
if bad := q.cycle(); bad != nil {
|
||||
p.mark = false
|
||||
p.checked = true
|
||||
fmt.Printf("\timports %s\n", p.path)
|
||||
if bad == p {
|
||||
return nil
|
||||
}
|
||||
return bad
|
||||
}
|
||||
}
|
||||
|
||||
p.checked = true
|
||||
p.mark = false
|
||||
return nil
|
||||
}
|
||||
|
||||
func importcycles() {
|
||||
for _, p := range pkgall {
|
||||
p.cycle()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -646,8 +646,6 @@ func (ctxt *Link) loadlib() {
|
|||
// We've loaded all the code now.
|
||||
ctxt.Loaded = true
|
||||
|
||||
importcycles()
|
||||
|
||||
strictDupMsgCount = ctxt.loader.NStrictDupMsgs()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue