Skip to content

Instantly share code, notes, and snippets.

@mohae
Created December 20, 2016 23:42
Show Gist options
  • Select an option

  • Save mohae/54c1b0e2cba548e61e9ad73df0d8d5e3 to your computer and use it in GitHub Desktop.

Select an option

Save mohae/54c1b0e2cba548e61e9ad73df0d8d5e3 to your computer and use it in GitHub Desktop.
3 parm vs 2 parm slice make
package main
import (
"fmt"
)
func main() {
b := make([]byte, 0, 4096)
fmt.Printf("len: %d\t\tcap: %d\t%#v\n", len(b), cap(b), b)
// make it shorter for printout reasons;
b = make([]byte, 128)
fmt.Printf("len: %d\tcap: %d\t%#02v\n", len(b), cap(b), b)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment