Fix error ".\about_allocation.go:18: negative cap argument in make([]int)"
This commit is contained in:
@@ -15,7 +15,7 @@ func aboutAllocation() {
|
||||
slice := make([]int, 3)
|
||||
assert(len(slice) == __int__) // make() creates slices of a given length
|
||||
|
||||
slice = make([]int, 3, __int__) // but can also take an optional capacity
|
||||
slice = make([]int, 3, __positive_int__) // but can also take an optional capacity
|
||||
assert(cap(slice) == 20)
|
||||
|
||||
m := make(map[int]string)
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
const (
|
||||
__string__ string = "impossibly lame value"
|
||||
__int__ int = -1
|
||||
__positive_int__ int = 42
|
||||
__byte__ byte = 255
|
||||
__bool__ bool = false // ugh
|
||||
__boolean__ bool = true // oh well
|
||||
|
||||
Reference in New Issue
Block a user