From 1332eb5b6210e16601ff8d049885e41a6e16908d Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9my=20Oudompheng?= Date: Mon, 21 Apr 2014 17:21:09 +0200 Subject: [PATCH] runtime/race: add test for issue 7561. LGTM=dvyukov R=rsc, iant, khr, dvyukov CC=golang-codereviews https://golang.org/cl/76520045 --- src/pkg/runtime/race/testdata/map_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/pkg/runtime/race/testdata/map_test.go b/src/pkg/runtime/race/testdata/map_test.go index 9ba74b1419..98e2a5f105 100644 --- a/src/pkg/runtime/race/testdata/map_test.go +++ b/src/pkg/runtime/race/testdata/map_test.go @@ -198,6 +198,7 @@ func TestRaceMapDeletePartKey(t *testing.T) { delete(m, *k) <-ch } + func TestRaceMapInsertPartKey(t *testing.T) { k := &Big{} m := make(map[Big]bool) @@ -209,6 +210,7 @@ func TestRaceMapInsertPartKey(t *testing.T) { m[*k] = true <-ch } + func TestRaceMapInsertPartVal(t *testing.T) { v := &Big{} m := make(map[int]Big) @@ -220,3 +222,19 @@ func TestRaceMapInsertPartVal(t *testing.T) { m[1] = *v <-ch } + +// Test for issue 7561. +func TestRaceMapAssignMultipleReturn(t *testing.T) { + connect := func() (int, error) { return 42, nil } + conns := make(map[int][]int) + conns[1] = []int{0} + ch := make(chan bool, 1) + var err error + go func() { + conns[1][0], err = connect() + ch <- true + }() + x := conns[1][0] + _ = x + <-ch +} -- 2.50.0