my testing file
func BenchmarkA(b *testing.B) {
res := testing.Benchmark(BenchB)
if res.N <= 25{
b.Fatalf("fail!")
}
func BenchB(b *testing.B) {
for i := 0; i <= b.N; i++{
url := "****"
contentType := "application/x-www-form-urlencoded"
data := strings.NewReader("****")
_, err := http.Post(url, contentType, data)
if err != nil {
b.Fatal("fail ")
}
}
}
when i run
go test -bench=./router_test.go
I get a
fatal error: all goroutines are asleep - deadlock!
if i use "package main" and "func main{}", the program can run successfully.
what should i do next? (forgive my poor english)
Aucun commentaire:
Enregistrer un commentaire