From 896e55fb49b1ec4ef924f9925ec55c090e14f34f Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 5 Jun 2023 21:30:18 -0400 Subject: [PATCH] cmd/dist: remove stale cleanup code dist clean has logic to delete command binaries from the cmd directories in cleanlist. However, these days the only binary it could possibly remove is "$GOROOT/src/cmd/cgo/cgo". This is clearly no longer necessary, so remove this stale code. When this logic was originally introduced in CL 5622058, it was driven by cleantab (not cleanlist), which contained all of the cmd directories, which were legion at the time because this was the era of the [568][acgl] toolchain. CL 9154 deleted cleantab, and did the same clean walk over the "cmd/" directories listed in buildorder. However, buildorder was a list of packages necessary to build cmd/go, so the only "cmd/" directory in buildorder at the time was "cmd/go". Hence, at that CL, dist started deleting only a "$GOROOT/src/cmd/go/go" binary. The modern cleanlist was introduced in CL 76021, as a list of packages containing "generated files and commands". The only "cmd/" directory in cleanlist the whole time has been "cmd/cgo" (and I'm honestly not sure why cmd/cgo is in there), so since that CL dist has only deleted "$GOROOT/src/cmd/cgo/cgo". Change-Id: I1915eb938d1a0e22ae6a64e7648a21894d3e6502 Reviewed-on: https://go-review.googlesource.com/c/go/+/501136 Run-TryBot: Austin Clements TryBot-Result: Gopher Robot Reviewed-by: Russ Cox --- src/cmd/dist/build.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index 15996534ec..1bf178d0ad 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -1206,10 +1206,6 @@ func clean() { } } } - // Remove generated binary named for directory. - if strings.HasPrefix(name, "cmd/") { - xremove(pathf("%s/%s", path, name[4:])) - } } // remove runtimegen files.