mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-19 03:50:11 +08:00
tiny fix
This commit is contained in:
@@ -74,7 +74,7 @@ allNewBMWs := allCars.FindAll(func(car *Car) bool {
|
||||
4)我们也可以根据入参返回不同的函数。也许我们想根据不同的厂商添加汽车到不同的集合,但是这可能会是多变的。所以我们可以定义一个函数来产生特定的添加函数和 map 集:
|
||||
|
||||
```go
|
||||
funcMakeSortedAppender(manufacturers[]string)(func(car*Car),map[string]Cars) {
|
||||
func MakeSortedAppender(manufacturers[]string)(func(car*Car),map[string]Cars) {
|
||||
// Prepare maps of sorted cars.
|
||||
sortedCars := make(map[string]Cars)
|
||||
for _, m := range manufacturers {
|
||||
@@ -213,4 +213,4 @@ We have 2 BMWs
|
||||
|
||||
- [目录](directory.md)
|
||||
- 上一节:[Go 中的面向对象](11.13.md)
|
||||
- 下一章:[读写数据](12.0.md)
|
||||
- 下一章:[读写数据](12.0.md)
|
||||
|
Reference in New Issue
Block a user