From 54ad9f0454dcadfd702b727749b54fad38328d37 Mon Sep 17 00:00:00 2001 From: Tinywan <756684177@qq.com> Date: Thu, 9 Aug 2018 19:20:08 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8E=9F=E6=96=87](https://golangbot.com/)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tinywan <756684177@qq.com> --- README.md | 7 +------ demo/point/map01.go | 15 ++++++++++++--- demo/point/map02.go | 1 + 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6402161..8633be3 100644 --- a/README.md +++ b/README.md @@ -73,13 +73,8 @@ $ go get github.com/Tinywan/golang-tutorial ### 34 - 反射 ### 35 - 读文件 -## 官方文档 +## 其他文档 * [如何编写Go代码](/docs/how_to_write_go_code.md) - -###### HELP * [原文](https://golangbot.com/) -* [译者一](http://blog.csdn.net/u011304970/article/details/74797939) -* [译者二](https://www.studygolang.com/gctt/Noluye) -本文由 [GCTT](https://github.com/studygolang/GCTT) 原创翻译,[Go语言中文网](https://studygolang.com/)首发。 \ No newline at end of file diff --git a/demo/point/map01.go b/demo/point/map01.go index 1650646..811d9a7 100644 --- a/demo/point/map01.go +++ b/demo/point/map01.go @@ -1,15 +1,24 @@ package main import ( + "time" "fmt" ) -func main(){ +func main() { // map[KeyType]ValueType 集合类型 - var personSalary map[string]int + var personSalary map[string]int // go的三个引用类型 map slice chan if personSalary == nil { fmt.Println("map is nil. Going to make one.") personSalary = make(map[string]int) + fmt.Printf(format string, a ...interface{}) + time.Microsecond + fmt.Printf(format string, a ...interface{}) + fmt.Print(a ...interface{}) + time.Millisecond(); + fmt.Print(a) + fmt.Println(a) + fmt.Printf(format, a) } -} \ No newline at end of file +} diff --git a/demo/point/map02.go b/demo/point/map02.go index d40be64..718707b 100644 --- a/demo/point/map02.go +++ b/demo/point/map02.go @@ -33,6 +33,7 @@ func main(){ }else{ fmt.Println(newEmp,"not found") } + fmt.Println("----------------遍历 map 中所有的元素---------------------") for key,value := range personSalary { fmt.Printf("personSalary[%s] = %d \n",key,value)