mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
internal/coverage/cfile: remove //go:linkname into testing
This is just looking at a command-line flag. Look directly. For #67401. Change-Id: I7a1c3fc2d9cc85e5ffc5731444bf6db87abf6901 Reviewed-on: https://go-review.googlesource.com/c/go/+/585916 Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
df4e49366c
commit
cd41d71785
2 changed files with 5 additions and 16 deletions
|
|
@ -6,6 +6,7 @@ package cfile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"flag"
|
||||||
"internal/coverage"
|
"internal/coverage"
|
||||||
"internal/goexperiment"
|
"internal/goexperiment"
|
||||||
"internal/testenv"
|
"internal/testenv"
|
||||||
|
|
@ -17,13 +18,11 @@ import (
|
||||||
_ "unsafe"
|
_ "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:linkname testing_testGoCoverDir testing.testGoCoverDir
|
|
||||||
func testing_testGoCoverDir() string
|
|
||||||
|
|
||||||
func testGoCoverDir(t *testing.T) string {
|
func testGoCoverDir(t *testing.T) string {
|
||||||
tgcd := testing_testGoCoverDir()
|
if f := flag.Lookup("test.gocoverdir"); f != nil {
|
||||||
if tgcd != "" {
|
if dir := f.Value.String(); dir != "" {
|
||||||
return tgcd
|
return dir
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return t.TempDir()
|
return t.TempDir()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,16 +46,6 @@ func coverReport2() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// testGoCoverDir is used in runtime/coverage tests.
|
|
||||||
//go:linkname testGoCoverDir
|
|
||||||
|
|
||||||
// testGoCoverDir returns the value passed to the -test.gocoverdir
|
|
||||||
// flag by the Go command, if goexperiment.CoverageRedesign is
|
|
||||||
// in effect.
|
|
||||||
func testGoCoverDir() string {
|
|
||||||
return *gocoverdir
|
|
||||||
}
|
|
||||||
|
|
||||||
// coverage2 returns a rough "coverage percentage so far"
|
// coverage2 returns a rough "coverage percentage so far"
|
||||||
// number to support the testing.Coverage() function.
|
// number to support the testing.Coverage() function.
|
||||||
func coverage2() float64 {
|
func coverage2() float64 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue