diff --git a/src/container-capacity.md b/src/container-capacity.md index 033599c..b141d97 100644 --- a/src/container-capacity.md +++ b/src/container-capacity.md @@ -28,9 +28,9 @@ map, even up to the specified capacity. ```go -m := make(map[string]os.FileInfo) - files, _ := os.ReadDir("./files") + +m := make(map[string]os.DirEntry) for _, f := range files { m[f.Name()] = f } @@ -51,8 +51,8 @@ for _, f := range files { -`m` is created without a size hint; there may be more -allocations at assignment time. +`m` is created without a size hint; the map will resize +dynamically, causing multiple allocations as it grows. diff --git a/style.md b/style.md index 6ffaff4..c831093 100644 --- a/style.md +++ b/style.md @@ -2259,9 +2259,9 @@ map, even up to the specified capacity. ```go -m := make(map[string]os.FileInfo) - files, _ := os.ReadDir("./files") + +m := make(map[string]os.DirEntry) for _, f := range files { m[f.Name()] = f } @@ -2282,8 +2282,8 @@ for _, f := range files { -`m` is created without a size hint; there may be more -allocations at assignment time. +`m` is created without a size hint; the map will resize +dynamically, causing multiple allocations as it grows.