magiconair / properties

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

Allow disable expansion during the load #26

Closed kmala closed 6 years ago

kmala commented 6 years ago

This will allow the users to disable expansion of the values during the load and read as just key value.

magiconair commented 6 years ago

Hi @kmala, Thanks for the patch but you cannot change the signature of existing functions like Load since this would break everybody else's code. Maybe adding another function which loads into an existing Properties object is a better approach. I have to think about this a bit more.

magiconair commented 6 years ago

@kmala are you still going to work on that?

kmala commented 6 years ago

Yes.i want to work on this..What do you think about have these new functions as receivers for Properties struct since that already has Disable expansion flag.

func (p *Properties)  Load(buf []byte, enc Encoding) error {
}
kmala commented 6 years ago

@magiconair i made changes to add a new Load function to the properties such that existing methods need not change.

magiconair commented 6 years ago

In general that looks fine but something doesn't sit right with me on this approach but I can't put my finger on it. I'll think about this for 1-2 more days and if I can't come up with something better I'll merge it. Thank you!

kmala commented 6 years ago

@magiconair did you get a chance to look into this?

magiconair commented 6 years ago

Sorry for the long delay. I'm relocating to another country with the family and that burns a lot of energy. After looking at this I think the right solution is to replace the loadXXX functions with a Loader which has parameters. I'll merge this and work on that so that I get to play with properties again.