TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

HN: Help make Golang more (resource|env) friendly

1 pointsby codesniperjoeover 2 years ago

1 comment

codesniperjoeover 2 years ago
Hi, just discovered that the (sometimes excessive large) golang mod disk cache is - in opposite to the compiler cache - not (yet) properly deduplicated.<p>Try yourself: Made a little hack&#x2F;tool to deduplicate data via hardlinks (unix&#x2F;i-node-filesystems tested only, not windows yet).<p><a href="https:&#x2F;&#x2F;github.com&#x2F;paepckehh&#x2F;fsdd">https:&#x2F;&#x2F;github.com&#x2F;paepckehh&#x2F;fsdd</a><p>(less than 1kLOC, 100% golang stdlib, no external deps)<p><pre><code> go install paepcke.de&#x2F;fsdd&#x2F;cmd&#x2F;fsdd@latest cd $GOMODCACHE &amp;&amp; fsdd --hard-link . FSDD [start] [&#x2F;usr&#x2F;store&#x2F;gomod][hash:MAPHASH] FSDD [_done] [time: 39.000221ms] FSDD [stats] [files:13329] [inode(s): 8680] [sym.valid: 0] [sym.invalid: 0] [data blocks: 277.1 Mbytes] FSDD [_info] [new deduplication savings][inode(s): 4649] [data blocks: 66.9 Mbytes] </code></pre> If you can reproduce and has it shows no downsides (remove&#x2F;add should auto-dereference) it should be part of src&#x2F;cmd&#x2F;go&#x2F;internal&#x2F;mod* pack?<p>If you can confirm&#x2F;field test, please report back! I would love to write a quick stdlib&#x2F;proposal.<p>At golang scale, it could make a real resource &#x2F; enviromental dent!<p>It least for me, it cut my disk cache in half and reduced vfs fs mem-cache required as well, so should scale even on deduplicated fs like zfs&#x2F;btrfs. Made my batch builds fast and snappy again!<p>Michael (edit:first-post-ever-style-fixes)