Operating System
Windows amd64 (the errors below are Go syntax/type-check errors).
Go Version
go1.26.3 windows/amd64; repository tests also pass with Go 1.24.7.
Package Version
Current main, ad5fd39710451e9707dbcc2a0311cba9ef9b3d1d.
Reproduction Steps
Compile these expressions from README.md and README.zh-CN.md in a small program importing the corresponding gg packages:
gslice.Reduce([]int{1, 2, 3, 4, 5}, gvalue.Add[int].Value())
gslice.Index([]int{1, 2, 3, 4, 5}, 3.Value())
The custom-codec sections in both READMEs call gson.MarshalString(codec, testcase), whereas MarshalString accepts only the value. This can be reproduced without either optional codec dependency:
type standardCodec struct{}
func (standardCodec) Marshal(v any) ([]byte, error) { return json.Marshal(v) }
// Import encoding/json and github.com/bytedance/gg/gson.
// Inside main:
gson.MarshalString(standardCodec{}, map[string]int{"age": 10})
Finally, the Chinese README's gcond.Switch[string](3) example ends with Default("other")), with an extra closing parenthesis.
Expected Behavior
The documented expressions compile. Extract .Value() from the result of Reduce/Index, use the existing MarshalStringBy API when passing a codec, and balance the Chinese conditional example's parentheses.
Actual Behavior
- Reduce:
gvalue.Add[int].Value undefined (type func(x int, y int) int has no field or method Value).
- Index: syntax error at
Value in 3.Value().
- Both codec examples:
too many arguments in call to gson.MarshalString.
- Chinese conditional: unexpected
).
These are nine failing snippets across the two README files. The ordinary one-argument gson.MarshalString(testcase) example is correct and should remain unchanged.
Additional Context
This affects copying the introductory examples, not the implementation of the APIs. A focused documentation-only correction is sufficient. The codec reproduction substitutes a standard-library-backed implementation of the existing Marshaler interface; it is not an integration test of Sonic or Jsoniter. Searches found no matching issue or PR; open PRs #18 and #41 edit other README sections.
Operating System
Windows amd64 (the errors below are Go syntax/type-check errors).
Go Version
go1.26.3 windows/amd64; repository tests also pass with Go 1.24.7.
Package Version
Current main,
ad5fd39710451e9707dbcc2a0311cba9ef9b3d1d.Reproduction Steps
Compile these expressions from README.md and README.zh-CN.md in a small program importing the corresponding gg packages:
The custom-codec sections in both READMEs call
gson.MarshalString(codec, testcase), whereasMarshalStringaccepts only the value. This can be reproduced without either optional codec dependency:Finally, the Chinese README's
gcond.Switch[string](3)example ends withDefault("other")), with an extra closing parenthesis.Expected Behavior
The documented expressions compile. Extract
.Value()from the result ofReduce/Index, use the existingMarshalStringByAPI when passing a codec, and balance the Chinese conditional example's parentheses.Actual Behavior
gvalue.Add[int].Value undefined (type func(x int, y int) int has no field or method Value).Valuein3.Value().too many arguments in call to gson.MarshalString.).These are nine failing snippets across the two README files. The ordinary one-argument
gson.MarshalString(testcase)example is correct and should remain unchanged.Additional Context
This affects copying the introductory examples, not the implementation of the APIs. A focused documentation-only correction is sufficient. The codec reproduction substitutes a standard-library-backed implementation of the existing Marshaler interface; it is not an integration test of Sonic or Jsoniter. Searches found no matching issue or PR; open PRs #18 and #41 edit other README sections.