gopls/internal/regtest: eliminate GoSumDiagnostic

Remove the redundant GoSumDiagnostic.

Updates golang/go#39384

Change-Id: I742fbe5d32dd55288c7632bed335f0d33e1015d5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/461916
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
diff --git a/gopls/internal/lsp/regtest/expectation.go b/gopls/internal/lsp/regtest/expectation.go
index a86dfe1..43c9af2 100644
--- a/gopls/internal/lsp/regtest/expectation.go
+++ b/gopls/internal/lsp/regtest/expectation.go
@@ -13,7 +13,6 @@
 	"golang.org/x/tools/gopls/internal/lsp"
 	"golang.org/x/tools/gopls/internal/lsp/fake"
 	"golang.org/x/tools/gopls/internal/lsp/protocol"
-	"golang.org/x/tools/internal/testenv"
 )
 
 // An Expectation asserts that the state of the editor at a point in time
@@ -875,19 +874,3 @@
 func DiagnosticAt(name string, line, col int) DiagnosticExpectation {
 	return DiagnosticExpectation{path: name, pos: &fake.Pos{Line: line, Column: col}, present: true}
 }
-
-// GoSumDiagnostic asserts that a "go.sum is out of sync" diagnostic for the
-// given module (as formatted in a go.mod file, e.g. "example.com v1.0.0") is
-// present.
-//
-// TODO(rfindley): remove this.
-func (e *Env) GoSumDiagnostic(name, module string) Expectation {
-	e.T.Helper()
-	// In 1.16, go.sum diagnostics should appear on the relevant module. Earlier
-	// errors have no information and appear on the module declaration.
-	if testenv.Go1Point() >= 16 {
-		return e.DiagnosticAtRegexpWithMessage(name, module, "go.sum is out of sync")
-	} else {
-		return e.DiagnosticAtRegexpWithMessage(name, `module`, "go.sum is out of sync")
-	}
-}
diff --git a/gopls/internal/regtest/modfile/modfile_test.go b/gopls/internal/regtest/modfile/modfile_test.go
index 21fd417..9c2ad63 100644
--- a/gopls/internal/regtest/modfile/modfile_test.go
+++ b/gopls/internal/regtest/modfile/modfile_test.go
@@ -893,7 +893,10 @@
 		d := &protocol.PublishDiagnosticsParams{}
 		env.OpenFile("go.mod")
 		env.AfterChange(
-			env.GoSumDiagnostic("go.mod", `example.com v1.2.3`),
+			Diagnostics(
+				env.AtRegexp("go.mod", `example.com v1.2.3`),
+				WithMessageContaining("go.sum is out of sync"),
+			),
 			ReadDiagnostics("go.mod", d),
 		)
 		env.ApplyQuickFixes("go.mod", d.Diagnostics)
@@ -1098,7 +1101,10 @@
 		params := &protocol.PublishDiagnosticsParams{}
 		env.Await(
 			OnceMet(
-				env.GoSumDiagnostic("go.mod", "example.com"),
+				Diagnostics(
+					env.AtRegexp("go.mod", `example.com`),
+					WithMessageContaining("go.sum is out of sync"),
+				),
 				ReadDiagnostics("go.mod", params),
 			),
 		)
diff --git a/gopls/internal/regtest/workspace/workspace_test.go b/gopls/internal/regtest/workspace/workspace_test.go
index 49e9e27..1708263 100644
--- a/gopls/internal/regtest/workspace/workspace_test.go
+++ b/gopls/internal/regtest/workspace/workspace_test.go
@@ -972,7 +972,10 @@
 		params := &protocol.PublishDiagnosticsParams{}
 		env.OpenFile("b/go.mod")
 		env.AfterChange(
-			env.GoSumDiagnostic("b/go.mod", `example.com v1.2.3`),
+			Diagnostics(
+				env.AtRegexp("go.mod", `example.com v1.2.3`),
+				WithMessageContaining("go.sum is out of sync"),
+			),
 			ReadDiagnostics("b/go.mod", params),
 		)
 		for _, d := range params.Diagnostics {