Fix: option_test data race (#315)

This commit is contained in:
Loyalsoldier
2021-05-03 03:14:37 +08:00
committed by GitHub
parent 56f5fb53bd
commit 72cf3527e7
+5
View File
@@ -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)