Skip to content

cmd/go: save GOMODCACHE disk space with clonefile/reflink copies of dup files? #75851

@bradfitz

Description

@bradfitz

I noticed that I have 22,896 duplicate files in my GOMODCACHE looking only at candidates that are at the same relative path within in the same module name, but just at different versions.

In other words, many files in a module don't change between versions, say, 1.0.0 and 1.0.1.

Maybe go mod download could do clonefile (macOS, APFS, cp -c) or FICLONE (Linux, XFS/btfs/etc, cp --reflink) to save disk space when possible?

The search doesn't cost much: you don't need to sha256 all files in GOMODCACHE looking for dups. Just looking at same relative path in other versions of the same module gets almost all of the win.

And then you can detect files already sharing backing storage with F_CTNL F_LOG2PHYS_EXT on macOS or fiemap on Linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.ToolProposalIssues describing a requested change to a Go tool or command-line program.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions