Skip to content

Preserve requested filename for cached loader fallback - #387

Open
stareezy-1 wants to merge 1 commit into
flosch:masterfrom
stareezy-1:fix/cache-loader-fallback
Open

stareezy-1 wants to merge 1 commit into
flosch:masterfrom
stareezy-1:fix/cache-loader-fallback

Conversation

@stareezy-1

@stareezy-1 stareezy-1 commented Oct 9, 2026 •

Copy link
Copy Markdown

FromCache currently passes a filename resolved by the first loader into FromFile. When a later loader uses a different namespace (for example an embedded fs.FS after a local filesystem loader), a path that works with FromFile fails with FromCache.

Pass the original requested filename to FromFile on a cache miss so each loader resolves it independently. Cache keys and invalidation behavior remain unchanged.

Fixes #313.

The fstest regression checks fallback rendering, cached reuse, CleanCache, and debug mode; it fails before the fix. go test -race ./... and go vet ./... pass. Full golangci-lint reports 12 findings in unchanged upstream files; golangci-lint run --new-from-rev=origin/master passes with zero new findings.

@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

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.

TemplateSet.FromCache would get error result when use multi loaders

1 participant