Skip to content

Commit 88a3548

Browse files
committed
gopls/coverage: repair coverage.go
Coverage.go computes the test coverage from running all the gopls tests. This CL accounts for the changed source tree (internal/lsp is gone) and new actions returned by go test -json ('pause' and 'cont'). Change-Id: I970b3ec107746ce02e3dcdcad9f8c19cffad8d11 Reviewed-on: https://go-review.googlesource.com/c/tools/+/448295 Run-TryBot: Peter Weinberger <[email protected]> Reviewed-by: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 8e0240a commit 88a3548

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

gopls/internal/coverage/coverage.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,12 @@ func maybePrint(m result) {
188188
if *verbose > 3 {
189189
fmt.Printf("%s %s %q %.3f\n", m.Action, m.Test, m.Output, m.Elapsed)
190190
}
191+
case "pause", "cont":
192+
if *verbose > 2 {
193+
fmt.Printf("%s %s %.3f\n", m.Action, m.Test, m.Elapsed)
194+
}
191195
default:
196+
fmt.Printf("%#v\n", m)
192197
log.Fatalf("unknown action %s\n", m.Action)
193198
}
194199
}
@@ -228,7 +233,7 @@ func checkCwd() {
228233
if err != nil {
229234
log.Fatal(err)
230235
}
231-
// we expect to be a the root of golang.org/x/tools
236+
// we expect to be at the root of golang.org/x/tools
232237
cmd := exec.Command("go", "list", "-m", "-f", "{{.Dir}}", "golang.org/x/tools")
233238
buf, err := cmd.Output()
234239
buf = bytes.Trim(buf, "\n \t") // remove \n at end
@@ -243,10 +248,6 @@ func checkCwd() {
243248
if err != nil {
244249
log.Fatalf("expected a gopls directory, %v", err)
245250
}
246-
_, err = os.Stat("internal/lsp")
247-
if err != nil {
248-
log.Fatalf("expected to see internal/lsp, %v", err)
249-
}
250251
}
251252

252253
func listDirs(dir string) []string {

0 commit comments

Comments
 (0)