Skip to content

cmd/go: use cached copy instead of GOTMPDIR archive #81727

Open

Description

@Dinichthys

The build process currently uses the package _pkg_.a from GOTMPDIR after building a package, even though a copy of the archive is already stored in GOCACHE at the end of buildObject. It can use the cached copy from GOCACHE instead.

When -work is not enabled, the GOTMPDIR copy is no longer needed and can be removed to reduce disk usage during compilation.

I have a fix for this issue and plan to open a CL for this change.

For example, my fix reduced peak disk usage during ./make.bash from 1.2 GB
to 657 MB.

Activity

  1. gopherbot commented on Sep 24, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/838145 mentions this issue: cmd/go: use cached copy instead of GOTMPDIR archive

  2. prattmic commented on Sep 29, 2026

    @prattmic
    Member

    cc @golang/command-line

  3. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Sep 29, 2026
  4. added this to the Backlog milestone on Oct 6, 2026
  5. Dinichthys commented on Oct 9, 2026

    @Dinichthys
    ContributorAuthor

    I have a CL, which fixes this issue by using file from cache and removing temporary file. The link to the CL - https://go-review.googlesource.com/c/go/+/838145.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.help wanted

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions