-
Notifications
You must be signed in to change notification settings - Fork 781
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
Add writeToFile function #1495
Add writeToFile function #1495
Conversation
Thankjs for the PR @anhdat, I know this is frequently requested and will definitely look at this for the next feature release. I'm currently debating about doing a bugfix 0.26.1 release or just jumping to 0.27.0... if the latter I'll definitely include this. |
One thing... I'm not going to consider it a blocker as I'd like to get this feature added, but if you get a chance I'd love to see a test added for this. If you decide to add test(s) there are 2 possible places, in template_tests.go as an entry in the test table in TestTemplate_Execute or you can test it directly in funcs_test.go. Either one would be great and, if you do decide to write the test, I'll leave it to you to pick which you method you prefer. Thanks. |
…l-template into 1077/write-to-file-function
Hi @eikenb, thanks for the guidance. I've added the tests to the |
The build is failing in
Would a retry fix this? |
Thanks for the tests! A re-run did fix that test failure. I've been working to eliminate them, but there are still a number of race conditions lurking in the tests. That dedup one has been particularly annoying. The github-actions CI is still failing due to it finding a data race in a test that passes on every other platform (???)... I'm going to look into that, but I'm only testing github-actions CI at this point so I'm not going to consider it a blocker. I think it really just comes down to the use of t.Parallel() and I plan on removing all of those very soon anyways (they make debugging tests a PITA) and then, maybe, add some back if they actually help. |
Guys, I propose to supplement the code that will function to create nested directories if they are missing.
|
Hey @wavedocs, Thanks for raising your concern. I suggest submitting a PR with this change and linking it back here. Having a PR will make it easy to merge and for others to take a more active part of the discussion. If you do submit a PR with this please add a test for the added functionality in addition to the feature. Thanks. |
Fixes #1077
Based on the implementation of savetofile plugin.
writeToFile
writes the content to a file with username, group name, permissions. There are optional flags to select appending mode or add a newline.For example:
This is my first PR in this repository, please guide me on how to finish this PR. Thank you in advance!