From 9490a5390d048d707a54b8e5dca3bf3d4367cff8 Mon Sep 17 00:00:00 2001 From: HengYi Wei Date: Sat, 8 Oct 2022 13:52:56 +0800 Subject: [PATCH] Update ch6-01.md typo --- ch6/ch6-01.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch6/ch6-01.md b/ch6/ch6-01.md index 679e99d..9dbadc8 100644 --- a/ch6/ch6-01.md +++ b/ch6/ch6-01.md @@ -85,4 +85,4 @@ fmt.Println(geometry.PathDistance(perim)) // "12", standalone function fmt.Println(perim.Distance()) // "12", method of geometry.Path ``` -**译注:** 如果我们要用方法去计算perim的distance,还需要去写全geometry的包名,和其函数名,但是因为Path这个类型定义了一个可以直接用的Distance方法,所以我们可以直接写perim.Distance()。相当于可以少打很多字,作者应该是这个意思。因为在Go里包外调用函数需要带上包名,还是挺麻烦的。 +**译注:** 如果我们要用函数去计算perim的distance,还需要去写全geometry的包名,和其函数名,但是因为Path这个类型定义了一个可以直接用的Distance方法,所以我们可以直接写perim.Distance()。相当于可以少打很多字,作者应该是这个意思。因为在Go里包外调用函数需要带上包名,还是挺麻烦的。