Skip to content

cmd/fix: go fix -inline ./... results in very large build cache #78214

@connorszczepaniak-wk

Description

@connorszczepaniak-wk

Go version

go version go1.26.1 darwin/arm64

Output of go env in your module/workspace:

❯ go env -changed
GOBIN='/Users/connorszczepaniak/go/bin'
GOPRIVATE='github.com/Workiva'

What did you do?

Ran go clean -cache, then ran go fix -inline ./... on a large Go repository.

What did you see happen?

An almost 100GB build cache:

❯ du -sh "$(go env GOCACHE)"
 98G    /Users/connorszczepaniak/Library/Caches/go-build

Furthermore, while the go fix was still running, total disk usage got closer to 200GB, but roughly 100GB was freed right before the command exited. This one is harder to show in a GitHub issue, but I observed by watching macOS's disk usage estimate. Often when running a go fix like this, I end up with many of the following errors:

mkdir /var/folders/14/dl88pgbs11766nqnslc5ry8h0000gs/T/go-build114066672/b14431/: no space left on device

I attempted a du -sh /var/folders/14/dl88pgbs11766nqnslc5ry8h0000gs/T during the go fix but the command hung.

What did you expect to see?

I'm not sure what I expect the Go build cache disk usage to look like, but 100GB seems high. The fact that there seems to be an (even more) ephemeral extra 100GB during the go fix was also surprising and means I need twice as much disk space available to run such a command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions