Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor virtual file cache #268

Merged
merged 2 commits into from
Sep 2, 2022
Merged

Refactor virtual file cache #268

merged 2 commits into from
Sep 2, 2022

Conversation

matthewmueller
Copy link
Contributor

@matthewmueller matthewmueller commented Sep 2, 2022

This PR fixes an issue on main where generators may run multiple times because fs.ReadDir(fsys, "bud/public") would end up generating bud/public/public.go, but not using the cached version because "bud/public" doesn't match the cache key "bud/public/public.go".

This PR does 2 things:

  • Makes the target in the internal Generate(target path) (fs.File, error) an absolute path instead of a relative path
  • Now caches calls to Generate, so generating is only called once regardless of whether it's called from opening the file directly or reading the file from a directory.

Replaces: #264

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.

1 participant