Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get comment command returns comment concatenated with "#" symbol if no space between "#" and comment text #2171

Open
dmvolod opened this issue Oct 14, 2024 · 0 comments
Labels

Comments

@dmvolod
Copy link

dmvolod commented Oct 14, 2024

Describe the bug
Comments in YAML are denoted by the "#" symbol and are ignored by the interpreter when the code is executed. No special requirements, that space should be placed between "#" symbol and comment text, however it can be validated with linter, but not required. But in this case, yq can't separate comment and "#" symbol if no spaces was provided.

Version of yq: v4.44.3
Operating system: linux
Installed via: go install

Input Yaml
Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)
data1.yml:

spec:
   cpu: 1000m #nospace comment
   memory: 500Mi # space comment

Command
The command you ran:

yq ".spec.cpu | line_comment" data1.yaml
yq ".spec.memory | line_comment" data1.yaml

Actual behavior

#nospace comment
space comment

Expected behavior

nospace comment
space comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@dmvolod and others