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

Need to finalize gomplate.Renderer and related types before v4.0.0 #2073

Open
jlambert121 opened this issue May 14, 2024 · 2 comments · May be fixed by #2094
Open

Need to finalize gomplate.Renderer and related types before v4.0.0 #2073

jlambert121 opened this issue May 14, 2024 · 2 comments · May be fixed by #2094
Assignees
Milestone

Comments

@jlambert121
Copy link

It looks like the public interface for using gomplete is in flux as it is moved to version 4 so this is likely a "it's not quite done yet" question.

The deprecated RunTemplates supports passing in InputDir and OutputDir which is super convenient when processing a directory since it builds the list of templates before calling the new gomplate.Renderer#RenderTemplates. This appears to be currently broken on gatherTemplates when cfg.InputDir != "" since the FSProvider is unset on the context.

Is the intent to have something similar to RunTemplates (or Run) with the new Renderer or should I enumerate the list of templates myself and provide it to RenderTemplates?

@hairyhenderson
Copy link
Owner

In concept Run replaces the deprecated RunTemplates function, but the Config type is still internal so it's not usable yet - that's the main thing blocking the v4.0.0 release, actually.

Another way to approach this that should work (?) is to use Renderer and handle the directory reading logic yourself. But keep in mind that it will likely change before v4.0.0 (NewRenderer is especially awkward to use right now as the Options type contains members that are actually non-optional)

If you don't mind I'm going to rename this issue and use it to track finalizing gomplate.Renderer before v4.0 😅

@hairyhenderson hairyhenderson changed the title gomplate.RunTemplates replacement Need to finalize gomplate.Renderer and related types before v4.0.0 May 15, 2024
@hairyhenderson hairyhenderson added this to the v4.0.0 milestone May 15, 2024
@hairyhenderson hairyhenderson self-assigned this May 15, 2024
@jlambert121
Copy link
Author

If Run is intended to be the replacement for RunTemplates, works for me - does exactly what I'm looking for! It currently breaks down here though since ctx is missing fsProviderCtxKey (ultimately in datafs.ResolveLocalPath).

RenderTemplates solves this, but that's too late for Run. Happy to take a stab at a PR, just not quite sure what direction to take for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants