Repository navigation
feat: take the template source as an fs.FS - #66
Merged
Merged
Conversation
Templates embedded in a binary with embed.FS had to be copied to a temporary directory before scaffolding, because the walk read only from disk. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
alecthomas
reviewed
Oct 22, 2026
Having one source type keeps a single scaffolding path for directories, embedded files, and fetched remote sources. BREAKING CHANGE: Scaffold takes an fs.FS, ScaffoldFS and WithContext are removed, remote sources are opened with Open, and Config.Source returns an fs.FS. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
alecthomas
reviewed
Oct 22, 2026
| } | ||
|
|
||
| // WithContext sets the context for remote source fetching via getit. | ||
| func WithContext(ctx context.Context) Option { |
Collaborator
There was a problem hiding this comment.
Do we want to get rid of this?
Contributor
Author
There was a problem hiding this comment.
🤖 Restored. Since fetching now takes its context from Open, WithContext cancels scaffolding itself: it's checked before each entry.
alecthomas
approved these changes
Oct 22, 2026
jvmakine
marked this pull request as draft
October 22, 2026 04:20
Callers that already pass a context should still be able to stop a large scaffold, now that fetching moved to Open. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Templates embedded in a binary with
embed.FScurrently have to be copied to a temporary directory before scaffolding, because the walk reads only from disk.Scaffoldnow takes the template as anfs.FS. This is a breaking change:os.DirFS(dir)for a local directory.Open(ctx, source), which returns anfs.FSand a cleanup function. It also accepts a local directory.WithContextnow cancels scaffolding, since fetching takes its context fromOpen.Config.Source()returns thefs.FS, andExcludepatterns match slash-separated paths relative to the source root.--scriptrelative to the template when it is inside it, so it is still left out of the output.Symbolic links are read with
fs.ReadLink, so they work for anyfs.ReadLinkFSsuch asos.DirFSandfstest.MapFS. Files keep the permissions the source reports, soembed.FSfiles come out read-only unless anAfterEachchanges them.🤖 Generated with Claude Code