Merge pull request #217 from smartczy/master

修正拼写错误
This commit is contained in:
Unknwon
2016-01-20 17:45:58 +08:00
5 changed files with 6 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ var map1 map[keytype]valuetype
var map1 map[string]int
```
`[keytype]`` 和 `valuetype` 之间允许有空格,但是 gofmt 移除了空格)
`[keytype]``valuetype` 之间允许有空格,但是 gofmt 移除了空格)
在声明的时候不需要知道 map 的长度map 是可以动态增长的。

File diff suppressed because one or more lines are too long

View File

@@ -95,8 +95,8 @@ p.i
或者:
```go
var mt struct1
ms := struct1{10, 15.5, "Chris"}
var ms struct1
ms = struct1{10, 15.5, "Chris"}
```
混合字面量语法composite literal syntax`&struct1{a, b, c}` 是一种简写,底层仍然会调用 `new ()`,这里值的顺序必须按照字段顺序来写。在下面的例子中能看到可以通过在值的前面放上字段名来初始化字段的方式。表达式 `new(Type)``&Type{}` 是等价的。

View File

@@ -19,7 +19,7 @@ func NewFile(fd int, name string) *File {
return nil
}
return &File(fd, name)
return &File{fd, name}
}
```

View File

@@ -43,7 +43,7 @@ func main() {
// 使用结构体字面量
outer2 := outerS{6, 7.5, 60, innerS{5, 10}}
fmt.Printf("outer2 is:", outer2)
fmt.Println("outer2 is:", outer2)
}
```