Newline characters changed to \n in bitrise.yml view
Closed this issue · 13 comments
Hi @koral--
This is unfortunately a bit out of our control. Both representations are correct from a YML spec perspective, and so it depends on the serializer how it serializes that string content.
Added the wontfix
label as we probably won't have enough time to dig into the go yaml lib (https://github.com/go-yaml/yaml), but of course contributions / PRs are always welcome!
Isn't it possible to just force particular style when content is modified in Workflow tab?
E.g. use multiline block beginning with |-
.
If you find an option in the docs (http://godoc.org/gopkg.in/yaml.v2 / https://github.com/go-yaml/yaml) please let us know! ;)
I guess PR should go there. Even if such will be made that lib does not seem to be contributor friendly: several dozens of issues and PRs opened for months and this: go-yaml/yaml#261
It's quite a stable lib, we never had any issue with it, that might explain the lack of activity there, but of course there's always room for improvement.. To be honest this is like the de factor Go standard YAML lib, switching to any other would be quite a risk
I've managed to determine the scenario in which content is "squashed".
It happens when there is a chain of whitespaces at the end of an input beginning with space character. For example: one space, space + newline etc.
It does not happen when there are newlines only.
I guess that if there are only spaces a the end, text may be intentionally enclosed with double quotes to preserve it and this is only valid solution.
However, if there are spaces followed by newlines both block and quoted text can be used.
Right?
I guess that if there are only spaces a the end, text may be intentionally enclosed with double quotes to preserve it and this is only valid solution.
That would make sense. Technically it'd be possible to keep the line ending spaces in the non double quoted form I believe, but the double quoted form is definitely more reliable / less error prone as a serialized form.
However, if there are spaces followed by newlines both block and quoted text can be used. Right?
I think technically that should be possible.
I've just checked case when trailing sequence of whitespaces contains spaces between newlines and quotes were also used.
So, to sum up, it seems that the only feasible action for this is to fill an issue on https://github.com/go-yaml/yaml asking them to prefer block notation if text ends with newline character or in other words use quotes only if space is at the end but not in any position of trailing whitespace sequence.
So, to sum up, it seems that the only feasible action for this is to fill an issue on https://github.com/go-yaml/yaml
Indeed. I believe we tried to find another YAML lib for Go initially when we saw this same issue, but did not find any suitable alternative.
@koral-- are you still facing the issue?
Yep, just checked and it is still present. Moreover, it seems that now text is a single, quoted line always if there is any whitespace at the end including single newline.
This is still an issue and super-annoying. Unfortunately, Bitrise seems to have many of these little bugs (also UI/UX issues) that might cause our company to choose another option.
Workaround: Just avoid having a space at the end of any line.