Skip to content

Conversation

@nakabonne
Copy link
Member

What this PR does / why we need it:
This PR adds a new package which includes functions:

  • to give back the value placed at a given path
  • to replace the value placed at a given path

It will depend on the goccy/go-yaml package which lets us handle the yaml AST.
And Let me know another cool name other than yamlutil if there is.

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

NONE

Comment on lines 175 to 184
name: "there is an useless blank line",
yml: `
foo:
- bar
- baz`,
path: "$.foo[0]",
value: "new-text",
want: []byte(`foo:
- new-text
- baz`),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another consideration is this package removes useless empty lines if there is. What do you think about it?

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 33.69%. This pull request increases coverage by 0.21%.

File Function Base Head Diff
pkg/yamlutil/yamlutil.go GetValue -- 100.00% +100.00%
pkg/yamlutil/yamlutil.go ReplaceValue -- 73.91% +73.91%

@khanhtc1202
Copy link
Member

khanhtc1202 commented Dec 11, 2020

/lgtm
(the name yamlutil is good to me 😂)

@nakabonne
Copy link
Member Author

Thank you :-)

@pipecd-bot pipecd-bot removed the lgtm label Dec 11, 2020
@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 33.69%. This pull request increases coverage by 0.21%.

File Function Base Head Diff
pkg/yamlutil/yamlutil.go GetValue -- 100.00% +100.00%
pkg/yamlutil/yamlutil.go ReplaceValue -- 73.91% +73.91%

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 33.72%. This pull request increases coverage by 0.23%.

File Function Base Head Diff
pkg/yamlutil/yamlutil.go GetValue -- 100.00% +100.00%
pkg/yamlutil/yamlutil.go ReplaceValue -- 90.00% +90.00%

@nakabonne
Copy link
Member Author

Thanks. Fixed them.

@nghialv
Copy link
Member

nghialv commented Dec 14, 2020

/approve

@pipecd-bot
Copy link
Collaborator

APPROVE

This pull request is APPROVED by nghialv.

Approvers can cancel the approval by writing /approve cancel in a comment. Any additional commits also will change this pull request to be not-approved.

@pipecd-bot pipecd-bot merged commit 6e376a8 into master Dec 14, 2020
@pipecd-bot pipecd-bot deleted the yamlutil branch December 14, 2020 05:19
@pipecd-bot pipecd-bot mentioned this pull request Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants