Dear all, I have the following test: https://go.dev/play/p/fQgnvbomlhz (you have to run it locally as it does not work in the playground and it expects /usr/bin/curl as I was not able to reproduce the race using http.Get()).
When I run this with *go test -race -v -count=1 .* I get the following race: WARNING: DATA RACE Read at 0x00c0000922e0 by goroutine 10: race_test.TestRace.func1() /Users/D055539/race/race_test.go:16 +0x130 ... Previous write at 0x00c0000922e0 by goroutine 9: race_test.TestRace.func2() /Users/D055539/race/race_test.go:34 +0x44 This is because I write variable response in each test case function and read the same variable in the handler function. My goal is to define the response of the handler for each test case in the table. How can I achieve that without a race? thanks - Chris -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/CALWqRZrrfs5p-CnMgyDeWZdMC3dMRmgmByxczTL5OiVsA6cbQw%40mail.gmail.com.