Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think it's still there.

    package main

    func main() {
        slice := []string{"first", "second", "third"}
        println(slice[1])
        slice = slice[0:2]
        println(slice[2])
    }
Compile with

    go build -gcflags -B wat.go
    ./wat
Output

    second
    third
Without the `-B` you'll get a runtime panic. I'm on Go 1.1. (Maybe it's removed in tip?)


Ah ok, I was trying to locate it via the browser.

Next time I better checkout and do a proper grep.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: