{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/9642","labels_url":"https://api.github.com/repos/golang/go/issues/9642/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/9642/comments","events_url":"https://api.github.com/repos/golang/go/issues/9642/events","html_url":"https://github.com/golang/go/issues/9642","id":54860576,"number":9642,"title":"https://tour.golang.org/moretypes/11 cap=6 vs cap=8","user":{"login":"nbari","id":364199,"avatar_url":"https://avatars.githubusercontent.com/u/364199?v=3","gravatar_id":"","url":"https://api.github.com/users/nbari","html_url":"https://github.com/nbari","followers_url":"https://api.github.com/users/nbari/followers","following_url":"https://api.github.com/users/nbari/following{/other_user}","gists_url":"https://api.github.com/users/nbari/gists{/gist_id}","starred_url":"https://api.github.com/users/nbari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbari/subscriptions","organizations_url":"https://api.github.com/users/nbari/orgs","repos_url":"https://api.github.com/users/nbari/repos","events_url":"https://api.github.com/users/nbari/events{/privacy}","received_events_url":"https://api.github.com/users/nbari/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-20T09:28:17Z","updated_at":"2015-01-20T10:29:35Z","closed_at":null,"body":"Following the tour [Adding elements to a slice](https://tour.golang.org/moretypes/11) I notice that if I run the code on my system, I got this output:\r\n\r\n     a len=0 cap=0 []\r\n     a len=1 cap=1 [0]\r\n     a len=2 cap=2 [0 1]\r\n     a len=5 cap=6 [0 1 2 3 4]\r\n\r\nBut running the code on the browser the last line prints a diferente capacity **cap=8**\r\n\r\n     a len=0 cap=0 []\r\n     a len=1 cap=2 [0]  \r\n     a len=2 cap=2 [0 1]\r\n     a len=5 cap=8 [0 1 2 3 4]\r\n\r\n\r\nAny idea of why this happens ?\r\n\r\n    > go version \r\n    go version go1.4.1 darwin/amd64\r\n\r\nI tested on google chrome version 39.0.2171.99 (64-bit) and Safari Version 8.0.2 (10600.2.5) but in both browser cap is always 8 while in the terminal running and building always gives 5\r\n\r\nThis is the code in question:\r\n\r\n    package main\r\n\r\n    import \"fmt\"\r\n\r\n    func main() {\r\n        var a []int\r\n        printSlice(\"a\", a)\r\n\r\n        // append works on nil slices.\r\n        a = append(a, 0)\r\n        printSlice(\"a\", a)\r\n\r\n        // the slice grows as needed.\r\n        a = append(a, 1)\r\n        printSlice(\"a\", a)\r\n\r\n        // we can add more than one element at a time.\r\n        a = append(a, 2, 3, 4)\r\n        printSlice(\"a\", a)\r\n    }\r\n\r\n    func printSlice(s string, x []int) {\r\n        fmt.Printf(\"%s len=%d cap=%d %v\\n\",\r\n            s, len(x), cap(x), x)\r\n    }"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/70633635","html_url":"https://github.com/golang/go/issues/9642#issuecomment-70633635","issue_url":"https://api.github.com/repos/golang/go/issues/9642","id":70633635,"user":{"login":"nbari","id":364199,"avatar_url":"https://avatars.githubusercontent.com/u/364199?v=3","gravatar_id":"","url":"https://api.github.com/users/nbari","html_url":"https://github.com/nbari","followers_url":"https://api.github.com/users/nbari/followers","following_url":"https://api.github.com/users/nbari/following{/other_user}","gists_url":"https://api.github.com/users/nbari/gists{/gist_id}","starred_url":"https://api.github.com/users/nbari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbari/subscriptions","organizations_url":"https://api.github.com/users/nbari/orgs","repos_url":"https://api.github.com/users/nbari/repos","events_url":"https://api.github.com/users/nbari/events{/privacy}","received_events_url":"https://api.github.com/users/nbari/received_events","type":"User","site_admin":false},"created_at":"2015-01-20T10:29:35Z","updated_at":"2015-01-20T10:29:35Z","body":"This happens only on the playground or affect other systems as well also any idea of what practice should I follow to create cross-platform code ?"}}