Source file
test/fixedbugs/issue75327.go
1
2
3 package main
4
5 import (
6 "fmt"
7 "strings"
8 )
9
10 func main() {
11 defer func() {
12 err := recover()
13 txt := fmt.Sprintf("%s", err)
14 if !strings.HasSuffix(txt, "with length 1") {
15 panic("bad error: " + txt)
16 }
17 }()
18 foo([]uint64{0})
19 }
20
21
22 func foo(haystack []uint64) {
23 for n := range len(haystack) {
24 _ = n
25 _ = haystack[1]
26 }
27
28 xxx := haystack[0:len(haystack)]
29 sink(xxx)
30 }
31
32
33 func sink([]uint64) {}
34
View as plain text