]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: remove importcycles function
authorJeremy Quirke <qjeremy@uber.com>
Mon, 26 Dec 2022 04:07:03 +0000 (04:07 +0000)
committerCherry Mui <cherryyz@google.com>
Tue, 24 Jan 2023 17:00:10 +0000 (17:00 +0000)
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 does import cycle detection in linksetup -> postorder.

For #57400

Change-Id: I3095bdb3f16a82ba25681bf4a20ceaa3c9613921
GitHub-Last-Rev: 87a46153b136db67675874ffe46e5881b9c756ce
GitHub-Pull-Request: golang/go#57462
Reviewed-on: https://go-review.googlesource.com/c/go/+/459475
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>

src/cmd/link/internal/ld/go.go
src/cmd/link/internal/ld/lib.go

index 9dfb0f756edc7ddb480f747ee75202cb8977be68..ef739249145e54fb7270d240cd7dfff8b40e0628 100644 (file)
@@ -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()
-       }
-}
index c0730179db4accf3500cb69b56aeab262062d0aa..22c764ada56604fba5651bd8457bc69832af69cf 100644 (file)
@@ -646,8 +646,6 @@ func (ctxt *Link) loadlib() {
        // We've loaded all the code now.
        ctxt.Loaded = true
 
-       importcycles()
-
        strictDupMsgCount = ctxt.loader.NStrictDupMsgs()
 }