Skip to content

Commit 2c8de77

Browse files
committed
调整 WithArgs 方法,支持多参数传递
1 parent 10005a1 commit 2c8de77

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

README.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func main() {
4444

4545
// Also, we provide some useful information carrier for you.
4646
// For examples, you can carry an error, caller information or some args.
47-
// Remember args should be a field slice with string keys and any values.
47+
// Remember the count of args should be odd and their keys should be a string.
4848
err = errors.Wrap(9999, "io timeout").With(io.EOF).WithCaller().WithArgs("user_id", 123, "timeout", "200ms")
4949
fmt.Println(err)
5050
fmt.Println(errors.CodeMessage(err, 6666, "default message"))

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func main() {
4444

4545
// Also, we provide some useful information carrier for you.
4646
// For examples, you can carry an error, caller information or some args.
47-
// Remember args should be a field slice with string keys and any values.
47+
// Remember the count of args should be odd and their keys should be a string.
4848
err = errors.Wrap(9999, "io timeout").With(io.EOF).WithCaller().WithArgs("user_id", 123, "timeout", "200ms")
4949
fmt.Println(err)
5050
fmt.Println(errors.CodeMessage(err, 6666, "default message"))

_examples/basic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func main() {
3030

3131
// Also, we provide some useful information carrier for you.
3232
// For examples, you can carry an error, caller information or some args.
33-
// Remember args should be a field slice with string keys and any values.
33+
// Remember the count of args should be odd and their keys should be a string.
3434
err = errors.Wrap(9999, "io timeout").With(io.EOF).WithCaller().WithArgs("user_id", 123, "timeout", "200ms")
3535
fmt.Println(err)
3636
fmt.Println(errors.CodeMessage(err, 6666, "default message"))

0 commit comments

Comments
 (0)