Closed vadasambar closed 1 year ago
I am not sure if we want to fix this now or even fix this at all because we ran into this issue when we tried converting yaml to json (we might not have to do this anytime soon in the future) and we have a way to work around the issue using json.MarshalIndent
instead of json.Marshal
. I have created this issue for future reference in case anyone runs into a similar issue in the future.
Observed behavior
transposeEvaluators
doesn't behave correctly if the json passed to it doesn't have the right indentation.Expected Behavior
transposeEvaluators
should handle cases where the json passed to it doesn't have the right indentation.Steps to reproduce
fmt.Println
statements just after this line and after this line.json.Marshal
instead ofjson.MarshalIndent
hereflagd
root directory run (example_flags.yaml can be found here):If you check the above log,
Because the trailing brackets are not on newline,
flagd
trims the last two trailing brackets which makes the json invalid. This problem doesn't happen if you usejson.MarshalIndent
like thisTo contrast this with using a json config file,
There is no error. Looking at the log above,
Notice how only the trailing bracket on newline is removed (with the opening bracket on the first line). Resulting json is valid.