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

Append() get file already closed when trying to append a second io.Reader #324

Open
EdoaLive opened this issue May 31, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@EdoaLive
Copy link

EdoaLive commented May 31, 2022

Version

v1.66.6

Describe the bug

Passing an io.Reader to Append() adds the Reader to the dataSources, but the Reload() closes the Reader after parse (file.go line 296).
Calling Append() a second time will call again Reload() which try to re-parse all dataSources and find the previous io.Reader closed, returning error.

To reproduce

  • Call Append() passing an io.Reader
  • Call Append() again with another source (any?)

Expected behavior

I don't think the Append() method was designed to be called just once, so I think this is an unexpected behavior.
I expected to be able to call Append() many times.

@EdoaLive EdoaLive added the bug Something isn't working label May 31, 2022
@unknwon
Copy link
Member

unknwon commented Jun 3, 2022

Hmm, how can io.Reader be read more than once? I don't think that's an expected behavior of the interface either. I'm wondering if we should just ignore the EOF error, if the original data source is not a type capable of being re-read (e.g. io.Reader, io.ReadCloser).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants