magiconair / properties

Java properties scanner for Go
BSD 2-Clause "Simplified" License
323 stars 77 forks source link

Support duplicate expansions in the same value #28

Closed yobert closed 6 years ago

yobert commented 6 years ago

This enables properties like this:

a = b
c = ${a} ${a}

Previously, this would incorrectly throw a circular reference error. Now instead this will correctly evaluate the above as "c = b b".

magiconair commented 6 years ago

Oh wow. Thanks a lot!

magiconair commented 6 years ago

Released https://github.com/magiconair/properties/releases/v1.7.5

yobert commented 6 years ago

Yeah I'm amazed nobody else hit that yet! Thanks for the quick release :D

yobert commented 6 years ago

... I've found some more problems with this. It doesn't work with more than 2 expansions. I think the answer is to refactor that expand() function a little bit to use a stack of previously used key names instead of a shared map. I'll be sending another PR with these fixes soon if that's okay with you.