feat: WritableFS-based vendor operations#3
Merged
Conversation
149f4ef to
3ce636e
Compare
…pport
Breaking API changes:
- FileSystemLoader.Folders is now []FSFolder (was []string + []fs.FS)
- FSFolder{FS, Path}: pairs filesystem with folder path
- FSFolder.resolve(): auto-creates LocalFS if FS is nil
- NewFileSystemLoader(...FSFolder): takes FSFolder varargs
- LocalFolder(dir): convenience for local OS directories
- LocalFolders(dirs...): batch convenience for migration
- VendorConfig.FS: required WritableFS for template resolution
- SourceLoader uses config.FS for all template + vendor resolution
WritableFS vendor operations:
- FetchSourceFS, FetchAllSourcesFS, extractTarGzFS
- WriteLockFileFS, WriteVendorReadmeFS, LoadLockFileFS
- Data flows: HTTP → gzip → tar → fsys.WriteFile (zero temp files)
Test improvements:
- Shared makeTestTarGz(t, TarGzOpts, files): unified tarball helper
- namespace_test.go: rewritten with MemFS (0 os.* calls)
- vendoring_test.go: lock/readme/fallback tests → MemFS
- fetch_test.go: extract tests → MemFS via extractTarGzFS
- loadAndRender() helper for template loading via MemFS
Fixed: FileSystemLoader path handling for "." root folder with FS
Skipped: TestSourceLoader_RelativePathsInVendoredTemplates (#4)
Updated: examples/main.go, utils/basic-server.go, cmd/templar/debug.go
87 core tests passing.
3ce636e to
ebaa5cd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds WritableFS-based versions of all vendor/fetch operations. Data flows from network through decompression through tar parsing directly into WritableFS — zero temp files, zero os.* calls.
New API
Pipeline
No intermediate files. All writes go through
WritableFS.Test utilities
Unified
makeTestTarGz(t, TarGzOpts, files)replaces the two separate helpers:TarGzOpts.TopDir— GitHub-style nested directoryTarGzOpts.IncludePAX— PAX global header for edge case testing5 new MemFS-based tests. All existing tests updated to shared helper.
Old path-based functions kept for backward compatibility.