Skip to content

gomodfs: implement synthetic .zip file serving via synthzip#27

Open
tomhjp wants to merge 1 commit intomainfrom
tomhjp/synthzip
Open

gomodfs: implement synthetic .zip file serving via synthzip#27
tomhjp wants to merge 1 commit intomainfrom
tomhjp/synthzip

Conversation

@tomhjp
Copy link
Copy Markdown
Member

@tomhjp tomhjp commented Apr 16, 2026

Implement the $base/$module/@v/$version.zip endpoint from the goproxy protocol, using github.com/tomhjp/synthzip to synthesize zip files on-the-fly from individually-cached files without materializing the entire archive in memory upfront.

synthzip requires Name and Size for each file at construction time (no I/O), then lazily reads file contents only when a byte range is actually accessed.

Key changes:

  • store: Add ZipFileEntry type and GetZipFileEntries method to Store interface
  • gomodfs: Add getZipArchive (builds synthzip.Archive from metadata), getZipFileData (materializes full zip), getZipFileSize (metadata only)
  • path: Recognize ".zip" extension in parsePath
  • All frontends (NFS, FUSE, WebDAV, WinFsp): Serve .zip files. Stat calls use getZipFileSize to avoid materializing the full zip.

Implement the $base/$module/@v/$version.zip endpoint from the goproxy
protocol, using github.com/tomhjp/synthzip to synthesize zip files
on-the-fly from individually-cached files without materializing the
entire archive in memory upfront.

synthzip requires Name and Size for each file at construction time
(no I/O), then lazily reads file contents only when a byte range
is actually accessed.

Key changes:

- store: Add ZipFileEntry type and GetZipFileEntries method to Store
  interface
- gomodfs: Add getZipArchive (builds synthzip.Archive from metadata),
  getZipFileData (materializes full zip), getZipFileSize (metadata only)
- path: Recognize ".zip" extension in parsePath
- All frontends (NFS, FUSE, WebDAV, WinFsp): Serve .zip files. Stat
  calls use getZipFileSize to avoid materializing the full zip.

Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
@tomhjp tomhjp requested a review from bradfitz April 16, 2026 10:51
@tomhjp
Copy link
Copy Markdown
Member Author

tomhjp commented Apr 16, 2026

I implemented omitting CRC-32s in github.com/tomhjp/synthzip@v0.2.0 (the CRC-32s are zeroed in the zip file, which archive/zip handles fine; it just skips checksums), which strips away a lot of the complexity that #26 had to handle. I spun up a local CI runner with this version of gomodfs to test go mod download and go mod verify for real too, but I think the existing new test from #26 is already pretty good coverage for this repo.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants