title: Why slice length greater than capacity gives runtime error?
body: <p>Made a slice where capacity is less than the length</p>
  
  <pre>
  
      package main
  
      import fmt "fmt"
  
      func main(){
  
       type b []int
       var k = make([]b, 10, 5)
       fmt.Printf("%d\n",k[8])
       }
  
  </pre>
  
  <p>This when tried to run gives following error.</p>
  
  <pre>
  
      panic: runtime error: makeslice: cap out of range
  
      runtime.panic+0x9e /go/src/pkg/runtime/proc.c:1060
              runtime.panic(0x453b00, 0x30020390)
      runtime.panicstring+0x94 /go/src/pkg/runtime/runtime.c:116
              runtime.panicstring(0x4afd6c, 0x40d80c)
      runtime.makeslice+0x70 /go/src/pkg/runtime/slice.c:24
              runtime.makeslice(0x44302c, 0xa, 0x0, 0x5, 0x0, ...)
      main.main+0x45 C:/GOEXCE~1/basics/DATATY~1/slice.go:8
              main.main()
      runtime.mainstart+0xf 386/asm.s:93
              runtime.mainstart()
      runtime.goexit /go/src/pkg/runtime/proc.c:178
              runtime.goexit()
      ----- goroutine created by -----
      _rt0_386+0xbf 386/asm.s:80
  
  </pre>
  
  <p>My question is can capacity be less than length?<br><br></p>
  
  <p>If 'Yes' then why this error came? <br>
  And if 'No'then why this is a runtime error and why not a compile time?</p>