github.com/llvm-mirror/llgo@v0.0.0-20190322182713-bf6f0a60fce1/test/execution/literals/slice.go (about) 1 // RUN: llgo -o %t %s 2 // RUN: %t 2>&1 | FileCheck %s 3 4 // CHECK: abc 5 // CHECK-NEXT: 123 6 // CHECK-NEXT: abc 7 // CHECK-NEXT: 123 8 9 package main 10 11 func main() { 12 x := []string{"abc", "123"} 13 println(x[0]) 14 println(x[1]) 15 16 // Elements are composite literals, so the '&' can be elided. 17 type S struct{ string } 18 y := []*S{{"abc"}, {"123"}} 19 println(y[0].string) 20 println(y[1].string) 21 }