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

"merge" datasource breaks with "stdin:" input (gomplate 4.x) #2273

Closed
aivajoe opened this issue Dec 3, 2024 · 1 comment · Fixed by #2287
Closed

"merge" datasource breaks with "stdin:" input (gomplate 4.x) #2273

aivajoe opened this issue Dec 3, 2024 · 1 comment · Fixed by #2287
Assignees
Labels
Milestone

Comments

@aivajoe
Copy link

aivajoe commented Dec 3, 2024

I just upgraded from 3.x to 4.x, and all of my gomplate scripts which use merge: have broken. I ran some tests and it does seem as though there is a difference when one of the datasources being merged is a stdin: datasource. This issue does not seem to be present when both datasources are files.

Invocation:

echo -n '{"key1": "val1"}' | gomplate -i '{{ ds "cfg" }}' -d cfg1=stdin:///foo.json -d cfg2=test_input2.json -d 'cfg=merge:cfg1|cfg2'

gomplate 3.11.8 output:

map[key1:val1 key2:val2]

gomplate 4.2.0 output:

map[key2:val2]

gomplate 4.x seems to fail to merge in the data coming from the stdin: datasource.

@hairyhenderson hairyhenderson self-assigned this Dec 16, 2024
@hairyhenderson hairyhenderson added this to the v4.3.0 milestone Dec 16, 2024
@hairyhenderson
Copy link
Owner

I've had a look at this, and it seems to not be a bug with merge per se, but rather a bug with the stdin filesystem support.

The root issue is that the stdin content is being read once and discarded, and the next time it needs to be read, the buffer's empty.

I'll work on fixing this now.

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

Successfully merging a pull request may close this issue.

2 participants