mirror of
https://github.com/golang/go
synced 2024-11-25 01:27:56 -07:00
tests: remove two misuses of nil pointers
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/12858044
This commit is contained in:
parent
ff86d222be
commit
08fdf00906
@ -136,7 +136,9 @@ func TestGcRescan(t *testing.T) {
|
|||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
p := &Y{}
|
p := &Y{}
|
||||||
p.c = make(chan error)
|
p.c = make(chan error)
|
||||||
p.nextx = &head.X
|
if head != nil {
|
||||||
|
p.nextx = &head.X
|
||||||
|
}
|
||||||
p.nexty = head
|
p.nexty = head
|
||||||
p.p = new(int)
|
p.p = new(int)
|
||||||
*p.p = 42
|
*p.p = 42
|
||||||
|
@ -64,7 +64,8 @@ func main() {
|
|||||||
|
|
||||||
i = 99999
|
i = 99999
|
||||||
var sl []int
|
var sl []int
|
||||||
check("array-bounds", func() { println(p[i]) }, "index out of range")
|
p1 := new([10]int)
|
||||||
|
check("array-bounds", func() { println(p1[i]) }, "index out of range")
|
||||||
check("slice-bounds", func() { println(sl[i]) }, "index out of range")
|
check("slice-bounds", func() { println(sl[i]) }, "index out of range")
|
||||||
|
|
||||||
var inter interface{}
|
var inter interface{}
|
||||||
|
Loading…
Reference in New Issue
Block a user