diff --git a/.gitignore b/.gitignore index 89267bb10..2cd9cbcdd 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # Folders _obj _test +.idea # Architecture specific extensions/prefixes *.[568vq] diff --git a/eBook/11.14.md b/eBook/11.14.md index 4613590a1..aa8e366ac 100644 --- a/eBook/11.14.md +++ b/eBook/11.14.md @@ -35,10 +35,10 @@ func (cs Cars) FindAll(f func(car *Car) bool) Cars { cars := make([]*Car, 0) cs.Process(func(c *Car) { - if f(c) { - append(cars,c) - } - ) + if f(c) { + cars = append(cars, c) + } + }) return cars } ``` diff --git a/eBook/11.9.md b/eBook/11.9.md index 4a8ada6e6..dc5a54a08 100644 --- a/eBook/11.9.md +++ b/eBook/11.9.md @@ -163,8 +163,8 @@ var interfaceSlice []interface{} = dataSlice ```go var dataSlice []myType = FuncReturnSlice() var interfaceSlice []interface{} = make([]interface{}, len(dataSlice)) -for ix, d := range dataSlice { - interfaceSlice[ix] = d +for i, d := range dataSlice { + interfaceSlice[i] = d } ``` diff --git a/eBook/12.9.md b/eBook/12.9.md index 2dfdf86dc..0f409f61c 100644 --- a/eBook/12.9.md +++ b/eBook/12.9.md @@ -69,7 +69,7 @@ func main() { js, _ := json.Marshal(vc) fmt.Printf("JSON format: %s", js) // using an encoder: - file, _ := os.OpenFile("vcard.json", os.O_CREATE|os.O_WRONLY, 0) + file, _ := os.OpenFile("vcard.json", os.O_CREATE|os.O_WRONLY, 0666) defer file.Close() enc := json.NewEncoder(file) err := enc.Encode(vc)