Skip to content

Commit cb1f345

Browse files
authored
Update Visitor-and-Patch.md (#369)
Stringer example fixed.
1 parent c71396e commit cb1f345

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/Visitor-and-Patch.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ func (p *patcher) Visit(node *ast.Node) {
9191
}
9292
```
9393

94-
Type information is also available. Here is an example, there all `fmt.Stringer`
95-
interface automatically converted to `string` type.
94+
Type information is also available. In the following example, any struct
95+
implementing the `fmt.Stringer` interface is automatically converted to `string` type.
9696

9797
```go
9898
func main() {
@@ -136,6 +136,7 @@ func (p *stringerPatcher) Visit(node *ast.Node) {
136136
Callee: &ast.MemberNode{
137137
Node: *node,
138138
Field: "String",
139+
Property: &ast.StringNode{Value: "String"},
139140
},
140141
})
141142
}

0 commit comments

Comments
 (0)