-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
panic when parsing an empty CSV as a datasource #311
Comments
that's expected, and could be protected by the new function suggested in #286
gomplate explicitly checks here that there's more than 0 bytes in the datasource. That was part of a fix for #200. This could also be protected by the new function suggested in #286
So... the crash is ugly, and needs to be fixed (I'm on it). The irony is that because you're trying to reference columns that don't exist, gomplate will error with |
As a side-note, the same crash can be achieved with: $ gomplate -i '{{ data.CSV "" }}' |
Thank you! |
🙇 |
@blimmer just FYI, I've relaxed that check since an empty CSV really shouldn't cause gomplate to error out. That's going in #316 |
I sometimes have an empty or missing datasource that a script tries to pass through as a datasource.
(the important part there is the
-d dependencies
)and then that's used in this section of my template:
If the datasource file is not present, gomplate fails out with this error:
2018/05/02 11:15:06 Can't stat /Users/blimmer/code/foo/dependencies.csv: &os.PathError{Op:"stat", Path:"/Users/blimmer/code/foo/dependencies.csv", Err:0x2}
If the datasource is empty, I get this error:
2018/05/02 11:19:42 No value found for [] from datasource 'dependencies'
If the datasource has any contents:
I get this crash:
This might be related to #286 , but any suggestions on how to work around this scenario?
The text was updated successfully, but these errors were encountered: