summaryrefslogtreecommitdiffstats
path: root/dependencies/pkg/mod/github.com/goccy
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:41:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:41:39 +0000
commitfcfb5e62f95d625836328131cc5ca851182bcae4 (patch)
tree5309ef2284a82d61ece838d1dd1c97c09df152b8 /dependencies/pkg/mod/github.com/goccy
parentAdding upstream version 1.1.1. (diff)
downloadicingadb-upstream.tar.xz
icingadb-upstream.zip
Adding upstream version 1.2.0.upstream/1.2.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dependencies/pkg/mod/github.com/goccy')
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.codecov.yml (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/.codecov.yml)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/FUNDING.yml (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/.github/FUNDING.yml)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/ISSUE_TEMPLATE/bug_report.md29
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/ISSUE_TEMPLATE/feature_request.md20
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/pull_request_template.md4
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/workflows/go.yml (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/.github/workflows/go.yml)32
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/CHANGELOG.md (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/CHANGELOG.md)23
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/LICENSE (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/LICENSE)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/Makefile (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/Makefile)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/README.md (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/README.md)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/ast/ast.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/ast/ast.go)4
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/ast/ast_test.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/ast/ast_test.go)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/cmd/ycat/ycat.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/cmd/ycat/ycat.go)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/decode.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/decode.go)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/decode_test.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/decode_test.go)36
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/encode.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/encode.go)4
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/encode_test.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/encode_test.go)39
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/error.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/error.go)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/go.mod (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/go.mod)2
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/go.sum (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/go.sum)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/internal/errors/error.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/internal/errors/error.go)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/lexer/lexer.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/lexer/lexer.go)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/lexer/lexer_test.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/lexer/lexer_test.go)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/option.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/option.go)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/context.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/context.go)7
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/parser.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/parser.go)41
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/parser_test.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/parser_test.go)124
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/testdata/cr.yml (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/testdata/cr.yml)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/testdata/crlf.yml (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/testdata/crlf.yml)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/testdata/lf.yml (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/testdata/lf.yml)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/path.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/path.go)26
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/path_test.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/path_test.go)7
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/printer/printer.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/printer/printer.go)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/printer/printer_test.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/printer/printer_test.go)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/scanner/context.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/scanner/context.go)13
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/scanner/scanner.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/scanner/scanner.go)5
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/stdlib_quote.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/stdlib_quote.go)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/struct.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/struct.go)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/testdata/anchor.yml (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/testdata/anchor.yml)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/token/token.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/token/token.go)4
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/token/token_test.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/token/token_test.go)3
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/validate.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/validate.go)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/validate_test.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/validate_test.go)0
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/yaml.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/yaml.go)62
-rw-r--r--dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/yaml_test.go (renamed from dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/yaml_test.go)89
45 files changed, 501 insertions, 73 deletions
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/.codecov.yml b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.codecov.yml
index 8364eea..8364eea 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/.codecov.yml
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.codecov.yml
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/.github/FUNDING.yml b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/FUNDING.yml
index ab4b632..ab4b632 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/.github/FUNDING.yml
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/FUNDING.yml
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/ISSUE_TEMPLATE/bug_report.md b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..1aad475
--- /dev/null
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,29 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: bug
+assignees: ''
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+
+Please provide a minimum yaml content that can be reproduced.
+We are more than happy to use [Go Playground](https://go.dev/play)
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Version Variables**
+ - Go version: [e.g. 1.21 ]
+ - go-yaml's Version: [e.g. v1.11.1 ]
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/ISSUE_TEMPLATE/feature_request.md b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000..e301d68
--- /dev/null
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,20 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: feature request
+assignees: ''
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/pull_request_template.md b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/pull_request_template.md
new file mode 100644
index 0000000..a1d6c8e
--- /dev/null
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/pull_request_template.md
@@ -0,0 +1,4 @@
+Before submitting your PR, please confirm the following.
+
+- [ ] Describe the purpose for which you created this PR.
+- [ ] Create test code that corresponds to the modification \ No newline at end of file
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/.github/workflows/go.yml b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/workflows/go.yml
index a935b3f..647c692 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/.github/workflows/go.yml
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/.github/workflows/go.yml
@@ -10,15 +10,15 @@ jobs:
strategy:
matrix:
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
- go-version: [ "1.18", "1.19", "1.20" ]
+ go-version: [ "1.19", "1.20", "1.21" ]
runs-on: ${{ matrix.os }}
steps:
+ - name: checkout
+ uses: actions/checkout@v4
- name: setup Go ${{ matrix.go-version }}
- uses: actions/setup-go@v3
+ uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- - name: checkout
- uses: actions/checkout@v3
- name: test
run: |
make test
@@ -28,17 +28,17 @@ jobs:
strategy:
matrix:
os: [ "ubuntu-latest", "windows-latest" ]
- go-version: [ "1.18", "1.19", "1.20" ]
+ go-version: [ "1.19", "1.20", "1.21" ]
runs-on: ${{ matrix.os }}
env:
GOARCH: "386"
steps:
+ - name: checkout
+ uses: actions/checkout@v4
- name: setup Go ${{ matrix.go-version }}
- uses: actions/setup-go@v3
+ uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- - name: checkout
- uses: actions/checkout@v3
- name: test
run: |
make simple-test
@@ -47,12 +47,12 @@ jobs:
name: ycat
runs-on: ubuntu-latest
steps:
+ - name: checkout
+ uses: actions/checkout@v4
- name: setup Go
- uses: actions/setup-go@v3
+ uses: actions/setup-go@v4
with:
- go-version: "1.20"
- - name: checkout
- uses: actions/checkout@v3
+ go-version: "1.21"
- name: build
run: |
make ycat/build
@@ -64,12 +64,12 @@ jobs:
name: Coverage
runs-on: ubuntu-latest
steps:
+ - name: checkout
+ uses: actions/checkout@v4
- name: setup Go
- uses: actions/setup-go@v3
+ uses: actions/setup-go@v4
with:
- go-version: "1.20"
- - name: checkout
- uses: actions/checkout@v3
+ go-version: "1.21"
- name: measure coverage
run: |
make cover
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/CHANGELOG.md b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/CHANGELOG.md
index 2887563..c8f820d 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/CHANGELOG.md
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/CHANGELOG.md
@@ -1,3 +1,26 @@
+# 1.11.2 - 2023-09-15
+
+### Fix bugs
+
+- Fix quoted comments ( #370 )
+- Fix handle of space at start or last ( #376 )
+- Fix sequence with comment ( #390 )
+
+# 1.11.1 - 2023-09-14
+
+### Fix bugs
+
+- Handle `\r` in a double-quoted string the same as `\n` ( #372 )
+- Replace loop with n.Values = append(n.Values, target.Values...) ( #380 )
+- Skip encoding an inline field if it is null ( #386 )
+- Fix comment parsing with null value ( #388 )
+
+# 1.11.0 - 2023-04-03
+
+### Features
+
+- Supports dynamically switch encode and decode processing for a given type
+
# 1.10.1 - 2023-03-28
### Features
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/LICENSE b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/LICENSE
index 04485ce..04485ce 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/LICENSE
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/LICENSE
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/Makefile b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/Makefile
index 1b1d923..1b1d923 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/Makefile
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/Makefile
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/README.md b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/README.md
index 9452349..9452349 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/README.md
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/README.md
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/ast/ast.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/ast/ast.go
index f535a24..b4d5ec4 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/ast/ast.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/ast/ast.go
@@ -1506,9 +1506,7 @@ func (n *SequenceNode) Replace(idx int, value Node) error {
func (n *SequenceNode) Merge(target *SequenceNode) {
column := n.Start.Position.Column - target.Start.Position.Column
target.AddColumn(column)
- for _, value := range target.Values {
- n.Values = append(n.Values, value)
- }
+ n.Values = append(n.Values, target.Values...)
}
// SetIsFlowStyle set value to IsFlowStyle field recursively.
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/ast/ast_test.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/ast/ast_test.go
index e7022b6..e7022b6 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/ast/ast_test.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/ast/ast_test.go
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/cmd/ycat/ycat.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/cmd/ycat/ycat.go
index c70cb3b..c70cb3b 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/cmd/ycat/ycat.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/cmd/ycat/ycat.go
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/decode.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/decode.go
index d3dbabc..d3dbabc 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/decode.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/decode.go
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/decode_test.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/decode_test.go
index 2549bea..cabfd33 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/decode_test.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/decode_test.go
@@ -68,6 +68,18 @@ func TestDecoder(t *testing.T) {
map[string]string{"v": "1.234"},
},
{
+ "v: \" foo\"\n",
+ map[string]string{"v": " foo"},
+ },
+ {
+ "v: \"foo \"\n",
+ map[string]string{"v": "foo "},
+ },
+ {
+ "v: \" foo \"\n",
+ map[string]string{"v": " foo "},
+ },
+ {
"v: false\n",
map[string]bool{"v": false},
},
@@ -425,6 +437,14 @@ func TestDecoder(t *testing.T) {
`"1": "a\x2Fb\u002Fc\U0000002Fd"`,
map[interface{}]interface{}{"1": `a/b/c/d`},
},
+ {
+ "'1': \"2\\n3\"",
+ map[interface{}]interface{}{"1": "2\n3"},
+ },
+ {
+ "'1': \"2\\r\\n3\"",
+ map[interface{}]interface{}{"1": "2\r\n3"},
+ },
{
"a: -b_c",
@@ -841,6 +861,14 @@ func TestDecoder(t *testing.T) {
},
},
{
+ "v:\n- A\n- |-\n B\n C\n\n\n",
+ map[string][]string{
+ "v": {
+ "A", "B\nC",
+ },
+ },
+ },
+ {
"v:\n- A\n- >-\n B\n C\n",
map[string][]string{
"v": {
@@ -849,6 +877,14 @@ func TestDecoder(t *testing.T) {
},
},
{
+ "v:\n- A\n- >-\n B\n C\n\n\n",
+ map[string][]string{
+ "v": {
+ "A", "B C",
+ },
+ },
+ },
+ {
"a: b\nc: d\n",
struct {
A string
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/encode.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/encode.go
index 7d8d81e..3b9b298 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/encode.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/encode.go
@@ -823,6 +823,10 @@ func (e *Encoder) encodeStruct(ctx context.Context, value reflect.Value, column
}
mapNode, ok := value.(ast.MapNode)
if !ok {
+ // if an inline field is null, skip encoding it
+ if _, ok := value.(*ast.NullNode); ok {
+ continue
+ }
return nil, xerrors.Errorf("inline value is must be map or struct type")
}
mapIter := mapNode.MapRange()
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/encode_test.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/encode_test.go
index 74b1aa5..3ff6f1c 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/encode_test.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/encode_test.go
@@ -304,6 +304,21 @@ func TestEncoder(t *testing.T) {
nil,
},
{
+ "a: \" b\"\n",
+ map[string]string{"a": " b"},
+ nil,
+ },
+ {
+ "a: \"b \"\n",
+ map[string]string{"a": "b "},
+ nil,
+ },
+ {
+ "a: \" b \"\n",
+ map[string]string{"a": " b "},
+ nil,
+ },
+ {
"a: 100.5\n",
map[string]interface{}{
"a": 100.5,
@@ -980,6 +995,30 @@ c: true
}
}
+func TestEncoder_InlineNil(t *testing.T) {
+ type base struct {
+ A int
+ B string
+ }
+ var buf bytes.Buffer
+ enc := yaml.NewEncoder(&buf)
+ if err := enc.Encode(struct {
+ *base `yaml:",inline"`
+ C bool
+ }{
+ C: true,
+ }); err != nil {
+ t.Fatalf("%+v", err)
+ }
+ expect := `
+c: true
+`
+ actual := "\n" + buf.String()
+ if expect != actual {
+ t.Fatalf("inline marshal error: expect=[%s] actual=[%s]", expect, actual)
+ }
+}
+
func TestEncoder_Flow(t *testing.T) {
var buf bytes.Buffer
enc := yaml.NewEncoder(&buf, yaml.Flow(true))
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/error.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/error.go
index 163dcc5..163dcc5 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/error.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/error.go
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/go.mod b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/go.mod
index f6e74c3..4550ff3 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/go.mod
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/go.mod
@@ -1,6 +1,6 @@
module github.com/goccy/go-yaml
-go 1.18
+go 1.19
require (
github.com/fatih/color v1.10.0
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/go.sum b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/go.sum
index 7249df6..7249df6 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/go.sum
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/go.sum
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/internal/errors/error.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/internal/errors/error.go
index 7f1ea9a..7f1ea9a 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/internal/errors/error.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/internal/errors/error.go
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/lexer/lexer.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/lexer/lexer.go
index 3207f4f..3207f4f 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/lexer/lexer.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/lexer/lexer.go
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/lexer/lexer_test.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/lexer/lexer_test.go
index 0d8f648..0d8f648 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/lexer/lexer_test.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/lexer/lexer_test.go
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/option.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/option.go
index eab5d43..eab5d43 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/option.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/option.go
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/context.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/context.go
index 99f18b1..42cc4f8 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/context.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/context.go
@@ -13,7 +13,6 @@ type context struct {
idx int
size int
tokens token.Tokens
- mode Mode
path string
}
@@ -56,7 +55,6 @@ func (c *context) copy() *context {
idx: c.idx,
size: c.size,
tokens: append(token.Tokens{}, c.tokens...),
- mode: c.mode,
path: c.path,
}
}
@@ -145,10 +143,6 @@ func (c *context) afterNextNotCommentToken() *token.Token {
return nil
}
-func (c *context) enabledComment() bool {
- return c.mode&ParseComments != 0
-}
-
func (c *context) isCurrentCommentToken() bool {
tk := c.currentToken()
if tk == nil {
@@ -193,7 +187,6 @@ func newContext(tokens token.Tokens, mode Mode) *context {
idx: 0,
size: len(filteredTokens),
tokens: token.Tokens(filteredTokens),
- mode: mode,
path: "$",
}
}
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/parser.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/parser.go
index 568e6ad..13ada50 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/parser.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/parser.go
@@ -156,15 +156,38 @@ func (p *parser) createMapValueNode(ctx *context, key ast.MapKeyNode, colonToken
ctx.insertToken(ctx.idx, nullToken)
return ast.Null(nullToken), nil
}
-
+ var comment *ast.CommentGroupNode
+ if tk.Type == token.CommentType {
+ comment = p.parseCommentOnly(ctx)
+ if comment != nil {
+ comment.SetPath(ctx.withChild(key.GetToken().Value).path)
+ }
+ tk = ctx.currentToken()
+ }
if tk.Position.Column == key.GetToken().Position.Column && tk.Type == token.StringType {
// in this case,
// ----
// key: <value does not defined>
// next
+
nullToken := p.createNullToken(colonToken)
ctx.insertToken(ctx.idx, nullToken)
- return ast.Null(nullToken), nil
+ nullNode := ast.Null(nullToken)
+
+ if comment != nil {
+ nullNode.SetComment(comment)
+ } else {
+ // If there is a comment, it is already bound to the key node,
+ // so remove the comment from the key to bind it to the null value.
+ keyComment := key.GetComment()
+ if keyComment != nil {
+ if err := key.SetComment(nil); err != nil {
+ return nil, err
+ }
+ nullNode.SetComment(keyComment)
+ }
+ }
+ return nullNode, nil
}
if tk.Position.Column < key.GetToken().Position.Column {
@@ -174,13 +197,20 @@ func (p *parser) createMapValueNode(ctx *context, key ast.MapKeyNode, colonToken
// next
nullToken := p.createNullToken(colonToken)
ctx.insertToken(ctx.idx, nullToken)
- return ast.Null(nullToken), nil
+ nullNode := ast.Null(nullToken)
+ if comment != nil {
+ nullNode.SetComment(comment)
+ }
+ return nullNode, nil
}
value, err := p.parseToken(ctx, ctx.currentToken())
if err != nil {
return nil, errors.Wrapf(err, "failed to parse mapping 'value' node")
}
+ if comment != nil {
+ value.SetComment(comment)
+ }
return value, nil
}
@@ -304,10 +334,9 @@ func (p *parser) parseSequenceEntry(ctx *context) (*ast.SequenceNode, error) {
if tk.Type == token.CommentType {
comment = p.parseCommentOnly(ctx)
tk = ctx.currentToken()
- if tk.Type != token.SequenceEntryType {
- break
+ if tk.Type == token.SequenceEntryType {
+ ctx.progress(1) // skip sequence token
}
- ctx.progress(1) // skip sequence token
}
value, err := p.parseToken(ctx.withIndex(uint(len(sequenceNode.Values))), ctx.currentToken())
if err != nil {
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/parser_test.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/parser_test.go
index 6044699..8d697e8 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/parser_test.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/parser_test.go
@@ -7,6 +7,7 @@ import (
"strings"
"testing"
+ "github.com/goccy/go-yaml"
"github.com/goccy/go-yaml/ast"
"github.com/goccy/go-yaml/lexer"
"github.com/goccy/go-yaml/parser"
@@ -808,6 +809,125 @@ foo: > # comment
}
}
+func TestCommentWithNull(t *testing.T) {
+ t.Run("same line", func(t *testing.T) {
+ content := `
+foo:
+ bar: # comment
+ baz: 1
+`
+ expected := `
+foo:
+ bar: null # comment
+ baz: 1`
+ f, err := parser.ParseBytes([]byte(content), parser.ParseComments)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(f.Docs) != 1 {
+ t.Fatal("failed to parse content with same line comment")
+ }
+ if f.Docs[0].String() != strings.TrimPrefix(expected, "\n") {
+ t.Fatal("failed to parse comment")
+ }
+ })
+ t.Run("next line", func(t *testing.T) {
+ content := `
+foo:
+ bar:
+ # comment
+ baz: 1
+`
+ expected := `
+foo:
+ bar: null # comment
+ baz: 1`
+ f, err := parser.ParseBytes([]byte(content), parser.ParseComments)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(f.Docs) != 1 {
+ t.Fatal("failed to parse content with next line comment")
+ }
+ if f.Docs[0].String() != strings.TrimPrefix(expected, "\n") {
+ t.Fatal("failed to parse comment")
+ }
+ })
+ t.Run("next line and different indent", func(t *testing.T) {
+ content := `
+foo:
+ bar:
+ # comment
+baz: 1`
+ f, err := parser.ParseBytes([]byte(content), parser.ParseComments)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(f.Docs) != 1 {
+ t.Fatal("failed to parse content with next line comment")
+ }
+ expected := `
+foo:
+ bar: null # comment
+baz: 1`
+ if f.Docs[0].String() != strings.TrimPrefix(expected, "\n") {
+ t.Fatal("failed to parse comment")
+ }
+ })
+}
+
+func TestSequenceComment(t *testing.T) {
+ content := `
+foo:
+ - # comment
+ bar: 1
+baz:
+ - xxx
+`
+ f, err := parser.ParseBytes([]byte(content), parser.ParseComments)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(f.Docs) != 1 {
+ t.Fatal("failed to parse content with next line with sequence")
+ }
+ expected := `
+foo:
+ # comment
+ - bar: 1
+baz:
+ - xxx`
+ if f.Docs[0].String() != strings.TrimPrefix(expected, "\n") {
+ t.Fatal("failed to parse comment")
+ }
+ t.Run("foo[0].bar", func(t *testing.T) {
+ path, err := yaml.PathString("$.foo[0].bar")
+ if err != nil {
+ t.Fatal(err)
+ }
+ v, err := path.FilterFile(f)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if v.String() != "1" {
+ t.Fatal("failed to get foo[0].bar value")
+ }
+ })
+ t.Run("baz[0]", func(t *testing.T) {
+ path, err := yaml.PathString("$.baz[0]")
+ if err != nil {
+ t.Fatal(err)
+ }
+ v, err := path.FilterFile(f)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if v.String() != "xxx" {
+ t.Fatal("failed to get baz[0] value")
+ }
+ })
+}
+
func TestNodePath(t *testing.T) {
yml := `
a: # commentA
@@ -824,6 +944,8 @@ a: # commentA
i: fuga # commentI
j: piyo # commentJ
k.l.m.n: moge # commentKLMN
+o#p: hogera # commentOP
+q#.r: hogehoge # commentQR
`
f, err := parser.ParseBytes([]byte(yml), parser.ParseComments)
if err != nil {
@@ -854,6 +976,8 @@ k.l.m.n: moge # commentKLMN
"$.a.i",
"$.j",
"$.'k.l.m.n'",
+ "$.o#p",
+ "$.'q#.r'",
}
if !reflect.DeepEqual(expectedPaths, commentPaths) {
t.Fatalf("failed to get YAMLPath to the comment node:\nexpected[%s]\ngot [%s]", expectedPaths, commentPaths)
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/testdata/cr.yml b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/testdata/cr.yml
index 37b52a6..37b52a6 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/testdata/cr.yml
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/testdata/cr.yml
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/testdata/crlf.yml b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/testdata/crlf.yml
index 85929f9..85929f9 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/testdata/crlf.yml
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/testdata/crlf.yml
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/testdata/lf.yml b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/testdata/lf.yml
index d2fe51f..d2fe51f 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/parser/testdata/lf.yml
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/parser/testdata/lf.yml
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/path.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/path.go
index 7a0c3b1..72554bd 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/path.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/path.go
@@ -500,11 +500,29 @@ func newSelectorNode(selector string) *selectorNode {
}
func (n *selectorNode) filter(node ast.Node) (ast.Node, error) {
+ selector := n.selector
+ if len(selector) > 1 && selector[0] == '\'' && selector[len(selector)-1] == '\'' {
+ selector = selector[1 : len(selector)-1]
+ }
switch node.Type() {
case ast.MappingType:
for _, value := range node.(*ast.MappingNode).Values {
key := value.Key.GetToken().Value
- if key == n.selector {
+ if len(key) > 0 {
+ switch key[0] {
+ case '"':
+ var err error
+ key, err = strconv.Unquote(key)
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to unquote")
+ }
+ case '\'':
+ if len(key) > 1 && key[len(key)-1] == '\'' {
+ key = key[1 : len(key)-1]
+ }
+ }
+ }
+ if key == selector {
if n.child == nil {
return value.Value, nil
}
@@ -518,7 +536,7 @@ func (n *selectorNode) filter(node ast.Node) (ast.Node, error) {
case ast.MappingValueType:
value := node.(*ast.MappingValueNode)
key := value.Key.GetToken().Value
- if key == n.selector {
+ if key == selector {
if n.child == nil {
return value.Value, nil
}
@@ -571,7 +589,9 @@ func (n *selectorNode) replace(node ast.Node, target ast.Node) error {
}
func (n *selectorNode) String() string {
- s := fmt.Sprintf(".%s", n.selector)
+ var builder PathBuilder
+ selector := builder.normalizeSelectorName(n.selector)
+ s := fmt.Sprintf(".%s", selector)
if n.child != nil {
s += n.child.String()
}
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/path_test.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/path_test.go
index 4271da5..c0073ce 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/path_test.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/path_test.go
@@ -61,6 +61,8 @@ store:
bicycle:
color: red
price: 19.95
+ bicycle*unicycle:
+ price: 20.25
`
tests := []struct {
name string
@@ -97,6 +99,11 @@ store:
path: builder().Root().Child("store").Child("bicycle").Child("price").Build(),
expected: float64(19.95),
},
+ {
+ name: `$.store.'bicycle*unicycle'.price`,
+ path: builder().Root().Child("store").Child(`bicycle*unicycle`).Child("price").Build(),
+ expected: float64(20.25),
+ },
}
t.Run("PathString", func(t *testing.T) {
for _, test := range tests {
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/printer/printer.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/printer/printer.go
index d5e25dc..d5e25dc 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/printer/printer.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/printer/printer.go
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/printer/printer_test.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/printer/printer_test.go
index 2afa74f..2afa74f 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/printer/printer_test.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/printer/printer_test.go
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/scanner/context.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/scanner/context.go
index 09d0a2d..3aaec56 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/scanner/context.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/scanner/context.go
@@ -196,9 +196,16 @@ func (c *Context) existsBuffer() bool {
func (c *Context) bufferedSrc() []rune {
src := c.buf[:c.notSpaceCharPos]
- if len(src) > 0 && src[len(src)-1] == '\n' && c.isDocument() && c.literalOpt == "-" {
- // remove end '\n' character
- src = src[:len(src)-1]
+ if c.isDocument() && c.literalOpt == "-" {
+ // remove end '\n' character and trailing empty lines
+ // https://yaml.org/spec/1.2.2/#8112-block-chomping-indicator
+ for {
+ if len(src) > 0 && src[len(src)-1] == '\n' {
+ src = src[:len(src)-1]
+ continue
+ }
+ break
+ }
}
return src
}
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/scanner/scanner.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/scanner/scanner.go
index ce9c665..b0eac48 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/scanner/scanner.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/scanner/scanner.go
@@ -339,6 +339,11 @@ func (s *Scanner) scanDoubleQuote(ctx *Context) (tk *token.Token, pos int) {
value = append(value, '\n')
idx++
continue
+ case 'r':
+ ctx.addOriginBuf(nextChar)
+ value = append(value, '\r')
+ idx++
+ continue
case 'v':
ctx.addOriginBuf(nextChar)
value = append(value, '\v')
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/stdlib_quote.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/stdlib_quote.go
index be50ae6..be50ae6 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/stdlib_quote.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/stdlib_quote.go
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/struct.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/struct.go
index a3da8dd..a3da8dd 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/struct.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/struct.go
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/testdata/anchor.yml b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/testdata/anchor.yml
index c016c7f..c016c7f 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/testdata/anchor.yml
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/testdata/anchor.yml
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/token/token.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/token/token.go
index 182f4be..c86caab 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/token/token.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/token/token.go
@@ -623,12 +623,12 @@ func IsNeedQuoted(value string) bool {
}
first := value[0]
switch first {
- case '*', '&', '[', '{', '}', ']', ',', '!', '|', '>', '%', '\'', '"', '@':
+ case '*', '&', '[', '{', '}', ']', ',', '!', '|', '>', '%', '\'', '"', '@', ' ':
return true
}
last := value[len(value)-1]
switch last {
- case ':':
+ case ':', ' ':
return true
}
if looksLikeTimeValue(value) {
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/token/token_test.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/token/token_test.go
index 4f5764f..dc1b4df 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/token/token_test.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/token/token_test.go
@@ -118,6 +118,9 @@ func TestIsNeedQuoted(t *testing.T) {
"Off",
"OFF",
"@test",
+ " a",
+ " a ",
+ "a ",
}
for i, test := range needQuotedTests {
if !token.IsNeedQuoted(test) {
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/validate.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/validate.go
index 20a2d6d..20a2d6d 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/validate.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/validate.go
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/validate_test.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/validate_test.go
index 265deb8..265deb8 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/validate_test.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/validate_test.go
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/yaml.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/yaml.go
index 2e541d8..25b1056 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/yaml.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/yaml.go
@@ -89,43 +89,42 @@ func (s MapSlice) ToMap() map[interface{}]interface{} {
//
// The field tag format accepted is:
//
-// `(...) yaml:"[<key>][,<flag1>[,<flag2>]]" (...)`
+// `(...) yaml:"[<key>][,<flag1>[,<flag2>]]" (...)`
//
// The following flags are currently supported:
//
-// omitempty Only include the field if it's not set to the zero
-// value for the type or to empty slices or maps.
-// Zero valued structs will be omitted if all their public
-// fields are zero, unless they implement an IsZero
-// method (see the IsZeroer interface type), in which
-// case the field will be included if that method returns true.
+// omitempty Only include the field if it's not set to the zero
+// value for the type or to empty slices or maps.
+// Zero valued structs will be omitted if all their public
+// fields are zero, unless they implement an IsZero
+// method (see the IsZeroer interface type), in which
+// case the field will be included if that method returns true.
//
-// flow Marshal using a flow style (useful for structs,
-// sequences and maps).
+// flow Marshal using a flow style (useful for structs,
+// sequences and maps).
//
-// inline Inline the field, which must be a struct or a map,
-// causing all of its fields or keys to be processed as if
-// they were part of the outer struct. For maps, keys must
-// not conflict with the yaml keys of other struct fields.
+// inline Inline the field, which must be a struct or a map,
+// causing all of its fields or keys to be processed as if
+// they were part of the outer struct. For maps, keys must
+// not conflict with the yaml keys of other struct fields.
//
-// anchor Marshal with anchor. If want to define anchor name explicitly, use anchor=name style.
-// Otherwise, if used 'anchor' name only, used the field name lowercased as the anchor name
+// anchor Marshal with anchor. If want to define anchor name explicitly, use anchor=name style.
+// Otherwise, if used 'anchor' name only, used the field name lowercased as the anchor name
//
-// alias Marshal with alias. If want to define alias name explicitly, use alias=name style.
-// Otherwise, If omitted alias name and the field type is pointer type,
-// assigned anchor name automatically from same pointer address.
+// alias Marshal with alias. If want to define alias name explicitly, use alias=name style.
+// Otherwise, If omitted alias name and the field type is pointer type,
+// assigned anchor name automatically from same pointer address.
//
// In addition, if the key is "-", the field is ignored.
//
// For example:
//
-// type T struct {
-// F int `yaml:"a,omitempty"`
-// B int
-// }
-// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n"
-// yaml.Marshal(&T{F: 1}) // Returns "a: 1\nb: 0\n"
-//
+// type T struct {
+// F int `yaml:"a,omitempty"`
+// B int
+// }
+// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n"
+// yaml.Marshal(&T{F: 1}) // Returns "a: 1\nb: 0\n"
func Marshal(v interface{}) ([]byte, error) {
return MarshalWithOptions(v)
}
@@ -167,16 +166,15 @@ func ValueToNode(v interface{}, opts ...EncodeOption) (ast.Node, error) {
//
// For example:
//
-// type T struct {
-// F int `yaml:"a,omitempty"`
-// B int
-// }
-// var t T
-// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t)
+// type T struct {
+// F int `yaml:"a,omitempty"`
+// B int
+// }
+// var t T
+// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t)
//
// See the documentation of Marshal for the format of tags and a list of
// supported tag options.
-//
func Unmarshal(data []byte, v interface{}) error {
return UnmarshalWithOptions(data, v)
}
diff --git a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/yaml_test.go b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/yaml_test.go
index 5828629..4446d31 100644
--- a/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.0/yaml_test.go
+++ b/dependencies/pkg/mod/github.com/goccy/go-yaml@v1.11.3/yaml_test.go
@@ -2,6 +2,7 @@ package yaml_test
import (
"bytes"
+ "strings"
"testing"
"github.com/google/go-cmp/cmp"
@@ -1161,6 +1162,94 @@ hoge:
})
}
+func TestCommentMapRoundTrip(t *testing.T) {
+ // test that an unmarshal and marshal round trip retains comments.
+ // if expect is empty, the test will use the input as the expected result.
+ tests := []struct {
+ name string
+ source string
+ expect string
+ encodeOptions []yaml.EncodeOption
+ }{
+ {
+ name: "simple map",
+ source: `
+# head
+a: 1 # line
+# foot
+`,
+ },
+ {
+ name: "nesting",
+ source: `
+- 1 # one
+- foo:
+ a: b
+ # c comment
+ c: d # d comment
+ "e#f": g # g comment
+ h.i: j # j comment
+ "k.#l": m # m comment
+`,
+ },
+ {
+ name: "single quotes",
+ source: `'a#b': c # c comment`,
+ encodeOptions: []yaml.EncodeOption{yaml.UseSingleQuote(true)},
+ },
+ {
+ name: "single quotes added in encode",
+ source: `a#b: c # c comment`,
+ encodeOptions: []yaml.EncodeOption{yaml.UseSingleQuote(true)},
+ expect: `'a#b': c # c comment`,
+ },
+ {
+ name: "double quotes quotes transformed to single quotes",
+ source: `"a#b": c # c comment`,
+ encodeOptions: []yaml.EncodeOption{yaml.UseSingleQuote(true)},
+ expect: `'a#b': c # c comment`,
+ },
+ {
+ name: "single quotes quotes transformed to double quotes",
+ source: `'a#b': c # c comment`,
+ expect: `"a#b": c # c comment`,
+ },
+ {
+ name: "single quotes removed",
+ source: `'a': b # b comment`,
+ expect: `a: b # b comment`,
+ },
+ {
+ name: "double quotes removed",
+ source: `"a": b # b comment`,
+ expect: `a: b # b comment`,
+ },
+ }
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ var val any
+ cm := yaml.CommentMap{}
+ source := strings.TrimSpace(test.source)
+ if err := yaml.UnmarshalWithOptions([]byte(source), &val, yaml.CommentToMap(cm)); err != nil {
+ t.Fatalf("%+v", err)
+ }
+ marshaled, err := yaml.MarshalWithOptions(val, append(test.encodeOptions, yaml.WithComment(cm))...)
+ if err != nil {
+ t.Fatalf("%+v", err)
+ }
+ got := strings.TrimSpace(string(marshaled))
+ expect := strings.TrimSpace(test.expect)
+ if expect == "" {
+ expect = source
+ }
+ if got != expect {
+ t.Fatalf("expected:\n%s\ngot:\n%s\n", expect, got)
+ }
+ })
+
+ }
+}
+
func TestRegisterCustomMarshaler(t *testing.T) {
type T struct {
Foo []byte `yaml:"foo"`