-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Remove github.com/valyala/fasttemplate
dependency
#7810
Comments
valyala/fasttemplate
dependencygithub.com/valyala/fasttemplate
dependency
Maybe expr too? Been a while since the last release. |
I was limiting my search to dependencies that have not released in the last 2 years. expr has recent commits so perhaps they release yearly. |
Hi @blkperl , I took a look at replacing the mentioned pkg with
funcMap := template.FuncMap{
"execFunc": execFunc
}
tmpl, err := template.New("templateTest").Funcs(funcMap).Parse(s)
// ...
replacedTmpl := &bytes.Buffer{}
err = tmpl.Execute(replacedTmpl, struct{}{}) // no data needed.
// ... |
Hi @djdongjin, Thanks for taking a look at this. Would you like to open a PR with your proposal? If we would could benchmark the change as well then I think that would help with getting it merged. @alexec @terrytangyuan any thoughts on the implementation detailed above? |
Hi @blkperl, Yes, will open a PR. Just want to see if there is any suggestion before implementation. :) Also is there existing test/benchmarks for the template, or should be included in the PR as well. Thanks. |
There should be a lot of test coverage for templates, so it should be easy to know if this is backwards compatible. I'm not expecting this to impact performance, but that can be verified by reading stress.md, capturing the profiles and seeing there is anything odd in "allocs" or "cpu" profiles. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Is anyone working on this issue? It looks stale, so I would like to pick it up. |
OK, so this is what I have so far. It is probably a bit rough and it still doesn't work for nested templates yet. However, it is passing on all tests in template_test.go. Also, other than the tests in My next step is to work out how to manage nested templates. For that, it seems to me that I am going to have to convert a nested template, e.g., here, to be in the form that text/template expects, e.g., as in this section. Does that seem reasonable? Also, would be greatly appreciated if someone could look at what I have done so far to see if it is semi-sensible. :) |
Summary
We should investigate whether
valyala/fasttemplate
can be replaced with the standard librarytext/template
or a maintained alternative.https://pkg.go.dev/text/template
Message from the maintainers:
Love this enhancement proposal? Give it a 👍. We prioritise the proposals with the most 👍.
The text was updated successfully, but these errors were encountered: