Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: goccy/go-yaml
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.15.23
Choose a base ref
...
head repository: goccy/go-yaml
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.16.0
Choose a head ref
  • 5 commits
  • 10 files changed
  • 3 contributors

Commits on Feb 16, 2025

  1. Keep reference of anchor's value (#660)

    * keep reference of anchor's value
    
    * add test case
    goccy authored Feb 16, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    b46780d View commit details
  2. support smart anchor option (#662)

    goccy authored Feb 16, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    abc7083 View commit details

Commits on Feb 25, 2025

  1. Add AutoInt option (#671)

    shuheiktgw authored Feb 25, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    944206a View commit details

Commits on Mar 7, 2025

  1. encodeMap() error handling and TestEncoder_UnmarshallableTypes() (#674)

    * encodeMap() error handling and TestEncoder_UnmarshallableTypes()
    
    * more TestEncoder_UnmarshallableTypes test cases
    dorencambia authored Mar 7, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    9671363 View commit details

Commits on Mar 16, 2025

  1. Fix tab character handling ( if ignore the tab character, do not incr…

    …ement the column number ) (#676)
    
    * if ignore the tab character, do not increment the column number
    
    * apply `npm audit fix`
    
    * fix lint error
    goccy authored Mar 16, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    100fa23 View commit details
Showing with 1,032 additions and 543 deletions.
  1. +21 −1 context.go
  2. +88 −87 decode.go
  3. +22 −0 decode_test.go
  4. +432 −432 docs/playground/package-lock.json
  5. +135 −15 encode.go
  6. +124 −0 encode_test.go
  7. +21 −0 option.go
  8. +25 −6 parser/parser_test.go
  9. +7 −2 scanner/scanner.go
  10. +157 −0 yaml_test.go
22 changes: 21 additions & 1 deletion context.go
Original file line number Diff line number Diff line change
@@ -2,7 +2,10 @@ package yaml

import "context"

type ctxMergeKey struct{}
type (
ctxMergeKey struct{}
ctxAnchorKey struct{}
)

func withMerge(ctx context.Context) context.Context {
return context.WithValue(ctx, ctxMergeKey{}, true)
@@ -15,3 +18,20 @@ func isMerge(ctx context.Context) bool {
}
return v
}

func withAnchor(ctx context.Context, name string) context.Context {
anchorMap := getAnchorMap(ctx)
if anchorMap == nil {
anchorMap = make(map[string]struct{})
}
anchorMap[name] = struct{}{}
return context.WithValue(ctx, ctxAnchorKey{}, anchorMap)
}

func getAnchorMap(ctx context.Context) map[string]struct{} {
v, ok := ctx.Value(ctxAnchorKey{}).(map[string]struct{})
if !ok {
return nil
}
return v
}
Loading