{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/28731","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/28731/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/28731/comments","events_url":"https://api.github.com/repos/golang/go/issues/28731/events","html_url":"https://github.com/golang/go/issues/28731","id":379629829,"node_id":"MDU6SXNzdWUzNzk2Mjk4Mjk=","number":28731,"title":"slice expression with low-index out of range and omitted high index doesn't give \"slice bounds out of range\" error","user":{"login":"dencoded","id":33698537,"node_id":"MDQ6VXNlcjMzNjk4NTM3","avatar_url":"https://avatars1.githubusercontent.com/u/33698537?v=4","gravatar_id":"","url":"https://api.github.com/users/dencoded","html_url":"https://github.com/dencoded","followers_url":"https://api.github.com/users/dencoded/followers","following_url":"https://api.github.com/users/dencoded/following{/other_user}","gists_url":"https://api.github.com/users/dencoded/gists{/gist_id}","starred_url":"https://api.github.com/users/dencoded/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dencoded/subscriptions","organizations_url":"https://api.github.com/users/dencoded/orgs","repos_url":"https://api.github.com/users/dencoded/repos","events_url":"https://api.github.com/users/dencoded/events{/privacy}","received_events_url":"https://api.github.com/users/dencoded/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-12T05:45:37Z","updated_at":"2018-11-12T06:02:03Z","closed_at":"2018-11-12T06:02:03Z","author_association":"NONE","body":"<!-- Please answer these questions before submitting your issue. Thanks! -->\r\n\r\n### What version of Go are you using (`go version`)?\r\n\r\n<pre>\r\n$ go version\r\ngo version go1.11.2 darwin/amd64\r\n</pre>\r\n\r\n### Does this issue reproduce with the latest release?\r\nyes\r\n\r\n\r\n### What operating system and processor architecture are you using (`go env`)?\r\n\r\n<details><summary><code>go env</code> Output</summary><br><pre>\r\n$ go env\r\nGOARCH=\"amd64\"\r\nGOBIN=\"\"\r\nGOCACHE=\"/Users/dencoded/Library/Caches/go-build\"\r\nGOEXE=\"\"\r\nGOFLAGS=\"\"\r\nGOHOSTARCH=\"amd64\"\r\nGOHOSTOS=\"darwin\"\r\nGOOS=\"darwin\"\r\nGOPATH=\"/Users/dencoded/go\"\r\nGOPROXY=\"\"\r\nGORACE=\"\"\r\nGOROOT=\"/usr/local/go\"\r\nGOTMPDIR=\"\"\r\nGOTOOLDIR=\"/usr/local/go/pkg/tool/darwin_amd64\"\r\nGCCGO=\"gccgo\"\r\nCC=\"clang\"\r\nCXX=\"clang++\"\r\nCGO_ENABLED=\"1\"\r\nGOMOD=\"\"\r\nCGO_CFLAGS=\"-g -O2\"\r\nCGO_CPPFLAGS=\"\"\r\nCGO_CXXFLAGS=\"-g -O2\"\r\nCGO_FFLAGS=\"-g -O2\"\r\nCGO_LDFLAGS=\"-g -O2\"\r\nPKG_CONFIG=\"pkg-config\"\r\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/9z/xzkhmlmx63nc49srq6glx6cw0000gn/T/go-build613348640=/tmp/go-build -gno-record-gcc-switches -fno-common\"\r\n</pre></details>\r\n\r\n### What did you do?\r\nhttps://play.golang.org/p/GrgeaBAXGkp\r\nThis happens only if we specify low-index as len of slice\r\n\r\ni.e. this gives proper error:\r\nhttps://play.golang.org/p/Ax4khdrwotW\r\n\r\n### What did you expect to see?\r\n<pre>\r\npanic: runtime error: slice bounds out of range\r\n</pre>\r\n\r\n\r\n\r\n### What did you see instead?\r\n<pre>\r\nlen: 1\r\ncap: 1\r\n[]\r\n</pre>\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/437766366","html_url":"https://github.com/golang/go/issues/28731#issuecomment-437766366","issue_url":"https://api.github.com/repos/golang/go/issues/28731","id":437766366,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzc2NjM2Ng==","user":{"login":"dominikh","id":39825,"node_id":"MDQ6VXNlcjM5ODI1","avatar_url":"https://avatars0.githubusercontent.com/u/39825?v=4","gravatar_id":"","url":"https://api.github.com/users/dominikh","html_url":"https://github.com/dominikh","followers_url":"https://api.github.com/users/dominikh/followers","following_url":"https://api.github.com/users/dominikh/following{/other_user}","gists_url":"https://api.github.com/users/dominikh/gists{/gist_id}","starred_url":"https://api.github.com/users/dominikh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dominikh/subscriptions","organizations_url":"https://api.github.com/users/dominikh/orgs","repos_url":"https://api.github.com/users/dominikh/repos","events_url":"https://api.github.com/users/dominikh/events{/privacy}","received_events_url":"https://api.github.com/users/dominikh/received_events","type":"User","site_admin":false},"created_at":"2018-11-12T06:02:03Z","updated_at":"2018-11-12T06:02:03Z","author_association":"MEMBER","body":"This is working as intended:\r\n\r\n> For arrays or strings, the indices are in range if 0 <= low <= high <= len(a), otherwise they are out of range. For slices, the upper index bound is the slice capacity cap(a) rather than the length.\r\n"}}
{"actor":{"display_login":"dominikh"}}