/usr/share/gocode/src/github.com/bmizerany/pat/bench_test.go is in golang-github-bmizerany-pat-dev 0.0~git20140625-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | package pat
import (
"net/http"
"testing"
)
func BenchmarkPatternMatching(b *testing.B) {
p := New()
p.Get("/hello/:name", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}))
for n := 0; n < b.N; n++ {
b.StopTimer()
r, err := http.NewRequest("GET", "/hello/blake", nil)
if err != nil {
panic(err)
}
b.StartTimer()
p.ServeHTTP(nil, r)
}
}
|