Skip to content

Commit 53c0997

Browse files
committed
📝 chore: update templates for README generate
1 parent 2a9870c commit 53c0997

File tree

18 files changed

+22
-17
lines changed

18 files changed

+22
-17
lines changed

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,9 @@ envutil.ParseValue("${ENV_NAME | defValue}")
546546
547547
> Package `github.com/gookit/goutil/errorx`
548548
549-
Package errorx provide a enhanced error implements, allow with call stack and wrap another error.
549+
`errorx` 提供了增强的错误报告实现,包含调用堆栈信息并且可以包装上一级错误。
550+
551+
> 在打印 error 时会额外附带调用栈信息, 方便记录日志和查找问题。
550552
551553
552554
<details><summary>Click to see functions</summary>
@@ -604,11 +606,11 @@ func As(err error, target any) bool
604606
</details>
605607
606608
607-
#### Errorx Usage
609+
#### Errorx 使用示例
608610
609-
**Create error with call stack info**
611+
**创建错误带有调用栈信息**
610612
611-
- use the `errorx.New` instead `errors.New`
613+
- 使用 `errorx.New` 替代 `errors.New`
612614
613615
```go
614616
func doSomething() error {
@@ -619,7 +621,7 @@ func doSomething() error {
619621
}
620622
```
621623
622-
- use the `errorx.Newf` or `errorx.Errorf` instead `fmt.Errorf`
624+
- 使用 `errorx.Newf` 或者 `errorx.Errorf` 替代 `fmt.Errorf`
623625
624626
```go
625627
func doSomething() error {
@@ -630,27 +632,27 @@ func doSomething() error {
630632
}
631633
```
632634
633-
**Wrap the previous error**
635+
**包装上一级错误**
634636
635-
used like this before:
637+
之前这样使用:
636638
637639
```go
638640
if err := SomeFunc(); err != nil {
639641
return err
640642
}
641643
```
642644
643-
can be replaced with:
645+
可以替换成:
644646
645647
```go
646648
if err := SomeFunc(); err != nil {
647649
return errors.Stacked(err)
648650
}
649651
```
650652
651-
**Print the errorx.New() error**
653+
**使用效果示例**
652654
653-
Examples for use `errorx` package, more please see [./errorx/README](errorx/README.md)
655+
更多关于 `errorx` 的使用请看 [./errorx/README](errorx/README.md)
654656
655657
```go
656658
err := errorx.New("the error message")
@@ -1218,6 +1220,7 @@ func IEqual(s1, s2 string) bool
12181220
func NoCaseEq(s, t string) bool
12191221
func IContains(s, sub string) bool
12201222
func ContainsByte(s string, c byte) bool
1223+
func ContainsByteOne(s string, bs []byte) bool
12211224
func ContainsOne(s string, subs []string) bool
12221225
func HasOneSub(s string, subs []string) bool
12231226
func IContainsOne(s string, subs []string) bool

README.zh-CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,7 @@ func IEqual(s1, s2 string) bool
12201220
func NoCaseEq(s, t string) bool
12211221
func IContains(s, sub string) bool
12221222
func ContainsByte(s string, c byte) bool
1223+
func ContainsByteOne(s string, bs []byte) bool
12231224
func ContainsOne(s string, subs []string) bool
12241225
func HasOneSub(s string, subs []string) bool
12251226
func IContainsOne(s string, subs []string) bool

internal/gendoc/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ var (
103103
// short name => full name.
104104
pkgNames = make(map[string]string, 16)
105105

106-
// eg: part-errorx-s.md
107-
partDocTplStart = "part-%s-s%s.md"
108-
// eg: part-errorx.md
109-
partDocTplEnd = "part-%s%s.md"
106+
// eg: subpkg/errorx-s.md
107+
partDocTplStart = "subpkg/%s-s%s.md"
108+
// eg: subpkg/errorx.md
109+
partDocTplEnd = "subpkg/%s%s.md"
110110
)
111111

112112
// go run ./internal/gendoc -h

internal/gendoc/template/part-errorx-s.md

Lines changed: 0 additions & 2 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)