]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: import os package in BenchmarkRunningGoProgram
authorAlex Brainman <alex.brainman@gmail.com>
Wed, 8 Mar 2017 03:58:41 +0000 (14:58 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Tue, 21 Mar 2017 05:59:45 +0000 (05:59 +0000)
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>
src/runtime/syscall_windows_test.go

index 11e67df100d9f1c67033fa917891e3e5703e7567..099baa2edf1dfe229c582693b364fe1a4a2a54a2 100644 (file)
@@ -1037,7 +1037,7 @@ func BenchmarkRunningGoProgram(b *testing.B) {
        defer os.RemoveAll(tmpdir)
 
        src := filepath.Join(tmpdir, "main.go")
-       err = ioutil.WriteFile(src, []byte(benchmarkRunnigGoProgram), 0666)
+       err = ioutil.WriteFile(src, []byte(benchmarkRunningGoProgram), 0666)
        if err != nil {
                b.Fatal(err)
        }
@@ -1060,9 +1060,11 @@ func BenchmarkRunningGoProgram(b *testing.B) {
        }
 }
 
-const benchmarkRunnigGoProgram = `
+const benchmarkRunningGoProgram = `
 package main
 
+import _ "os" // average Go program will use "os" package, do the same here
+
 func main() {
 }
 `