src/cmd/go/internal/cfg/bench_test.go
raw| 1 | // Copyright 2023 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package cfg |
| 6 | |
| 7 | import ( |
| 8 | "cmd/internal/pathcache" |
| 9 | "internal/testenv" |
| 10 | "testing" |
| 11 | ) |
| 12 | |
| 13 | func BenchmarkLookPath(b *testing.B) { |
| 14 | testenv.MustHaveExecPath(b, "go") |
| 15 | b.ResetTimer() |
| 16 | for i := 0; i < b.N; i++ { |
| 17 | _, err := pathcache.LookPath("go") |
| 18 | if err != nil { |
| 19 | b.Fatal(err) |
| 20 | } |
| 21 | } |
| 22 | } |