From 72cf3527e7d00068cd80a6369a5e1b1525abd491 Mon Sep 17 00:00:00 2001 From: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com> Date: Mon, 3 May 2021 03:14:37 +0800 Subject: [PATCH] Fix: option_test data race (#315) --- url/option_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/url/option_test.go b/url/option_test.go index aec3943d3..47a866292 100644 --- a/url/option_test.go +++ b/url/option_test.go @@ -19,18 +19,23 @@ func TestUrl_Handle(t *testing.T) { "mux=false;listen=127.0.0.1:0", "mux=false;listen=127.0.0.1:0;api=127.0.0.1:0", } + for _, s := range urlCases { for _, option := range optionCases { + s := s + option := option u := &url{ url: &s, option: &option, } u.Name() u.Priority() + errChan := make(chan error, 1) go func() { errChan <- u.Handle() }() + select { case err := <-errChan: t.Fatal(err)