Skip to content

cmd/dist: import cycle causes deadlock #76439

@adonovan

Description

@adonovan

The dist command has a rather idiosyncratic way of reporting a cycle in the import graph.

(Thanks @matloob for identifying the cause of the deadlock so quickly.)

~$ cd ~/w/goroot/src
src$ git co master
src$ ./make.bash
Building Go cmd/dist using /opt/homebrew/Cellar/go/1.25.1/libexec. (go1.25.1 darwin/arm64)
Building Go toolchain1 using /opt/homebrew/Cellar/go/1.25.1/libexec.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for darwin/arm64.

src$ echo 'package ast; import _ "go/ast"' > ./go/ast/selfimport.go
src$ ./make.bash
Building Go cmd/dist using /opt/homebrew/Cellar/go/1.25.1/libexec. (go1.25.1 darwin/arm64)
Building Go toolchain1 using /opt/homebrew/Cellar/go/1.25.1/libexec.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan receive]:
main.install(...)
	/Users/adonovan/w/goroot/src/cmd/dist/build.go:682
main.cmdbootstrap()
	/Users/adonovan/w/goroot/src/cmd/dist/build.go:1508 +0x7a0
main.xmain()
	/Users/adonovan/w/goroot/src/cmd/dist/main.go:189 +0x10c
main.main()
	/Users/adonovan/w/goroot/src/cmd/dist/main.go:172 +0xd30
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.GoCommandcmd/goNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions