Source file src/cmd/go/internal/cfg/bench_test.go

     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  	"internal/testenv"
     9  	"testing"
    10  )
    11  
    12  func BenchmarkLookPath(b *testing.B) {
    13  	testenv.MustHaveExecPath(b, "go")
    14  	b.ResetTimer()
    15  	for i := 0; i < b.N; i++ {
    16  		_, err := LookPath("go")
    17  		if err != nil {
    18  			b.Fatal(err)
    19  		}
    20  	}
    21  }
    22  

View as plain text