Fix error ".\about_allocation.go:18: negative cap argument in make([]int)"

This commit is contained in:
Matt Hickford
2014-06-17 20:11:36 +01:00
parent 84819eab71
commit 7fba0583f1
2 changed files with 2 additions and 1 deletions

View File

@@ -15,7 +15,7 @@ func aboutAllocation() {
slice := make([]int, 3) slice := make([]int, 3)
assert(len(slice) == __int__) // make() creates slices of a given length 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) assert(cap(slice) == 20)
m := make(map[int]string) m := make(map[int]string)

View File

@@ -13,6 +13,7 @@ import (
const ( const (
__string__ string = "impossibly lame value" __string__ string = "impossibly lame value"
__int__ int = -1 __int__ int = -1
__positive_int__ int = 42
__byte__ byte = 255 __byte__ byte = 255
__bool__ bool = false // ugh __bool__ bool = false // ugh
__boolean__ bool = true // oh well __boolean__ bool = true // oh well