mirror of
https://github.com/golang/go.git
synced 2025-05-19 14:24:46 +00:00
runtime: import os package in BenchmarkRunningGoProgram
I would like to use BenchmarkRunningGoProgram to measure changes for issue #15588. So the program in the benchmark should import "os" package. It is also reasonable that basic Go program includes "os" package. For #15588. Change-Id: Ida6712eab22c2e79fbe91b6fdd492eaf31756852 Reviewed-on: https://go-review.googlesource.com/37914 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
165a96e281
commit
f2b79cadfd
@ -1037,7 +1037,7 @@ func BenchmarkRunningGoProgram(b *testing.B) {
|
|||||||
defer os.RemoveAll(tmpdir)
|
defer os.RemoveAll(tmpdir)
|
||||||
|
|
||||||
src := filepath.Join(tmpdir, "main.go")
|
src := filepath.Join(tmpdir, "main.go")
|
||||||
err = ioutil.WriteFile(src, []byte(benchmarkRunnigGoProgram), 0666)
|
err = ioutil.WriteFile(src, []byte(benchmarkRunningGoProgram), 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -1060,9 +1060,11 @@ func BenchmarkRunningGoProgram(b *testing.B) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const benchmarkRunnigGoProgram = `
|
const benchmarkRunningGoProgram = `
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
import _ "os" // average Go program will use "os" package, do the same here
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user