a8m / envsubst

Environment variables substitution for Go
MIT License
768 stars 83 forks source link

Allow default value expression starting with operators #42

Closed neiser closed 1 year ago

neiser commented 1 year ago

Fixes #41

I hope that I got the lexing right and I think (according to the added test cases) that it actually fixes the issue without introducing new bugs. The trick was to only lex the any subsitition operator first and then continue with anything after the subsitution (such as constant text or another variable, which may in turn contain a substitution I suppose).

neiser commented 1 year ago

@a8m thanks for merging! Do you have any plans to release this fix soon? My actual goal is to get it fixed in yq as well which uses this library AFAIK.

a8m commented 1 year ago

@a8m thanks for merging! Do you have any plans to release this fix soon? My actual goal is to get it fixed in yq as well which uses this library AFAIK.

yq uses envsubst as a package, which means it can be updated as follows:

go get github.com/a8m/envsubst@master

But I'll tag master anyway. Thanks again for the contribution.