From ca2b41b3fd2db2ab2bdcb5aab0ea106d2d990884 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Wed, 6 Nov 2024 14:21:19 -0500 Subject: [PATCH] x/tools: use internal/expect instead of go/expect The only remaining uses of go/expect are from packagestest. Updates golang/go#70229 Change-Id: I5a8c835b761381747fbd3f936d261ed773b536e3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/625919 Auto-Submit: Alan Donovan Reviewed-by: Robert Findley LUCI-TryBot-Result: Go LUCI --- README.md | 3 --- go/ssa/builder_generic_test.go | 4 ++-- go/ssa/builder_test.go | 2 +- go/ssa/source_test.go | 2 +- gopls/internal/cache/mod_tidy.go | 2 +- gopls/internal/test/marker/doc.go | 4 ++-- gopls/internal/test/marker/marker_test.go | 2 +- internal/refactor/inline/inline_test.go | 2 +- 8 files changed, 9 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 4dbf6d69a..a10e1f7ea 100644 --- a/README.md +++ b/README.md @@ -51,9 +51,6 @@ Selected packages: - `go/cfg` provides a simple control-flow graph (CFG) for a Go function. -- `go/expect` reads Go source files used as test inputs and interprets - special comments within them as queries or assertions for testing. - - `go/gcexportdata` and `go/gccgoexportdata` read and write the binary files containing type information used by the standard and `gccgo` compilers. diff --git a/go/ssa/builder_generic_test.go b/go/ssa/builder_generic_test.go index 5b8767c33..af16036df 100644 --- a/go/ssa/builder_generic_test.go +++ b/go/ssa/builder_generic_test.go @@ -13,9 +13,9 @@ import ( "sort" "testing" - "golang.org/x/tools/go/expect" "golang.org/x/tools/go/loader" "golang.org/x/tools/go/ssa" + "golang.org/x/tools/internal/expect" ) // TestGenericBodies tests that bodies of generic functions and methods containing @@ -29,7 +29,7 @@ import ( // // where a, b and c are the types of the arguments to the print call // serialized using go/types.Type.String(). -// See x/tools/go/expect for details on the syntax. +// See x/tools/internal/expect for details on the syntax. func TestGenericBodies(t *testing.T) { for _, content := range []string{ ` diff --git a/go/ssa/builder_test.go b/go/ssa/builder_test.go index f001fffb4..59d8a91ea 100644 --- a/go/ssa/builder_test.go +++ b/go/ssa/builder_test.go @@ -25,10 +25,10 @@ import ( "golang.org/x/sync/errgroup" "golang.org/x/tools/go/analysis/analysistest" - "golang.org/x/tools/go/expect" "golang.org/x/tools/go/packages" "golang.org/x/tools/go/ssa" "golang.org/x/tools/go/ssa/ssautil" + "golang.org/x/tools/internal/expect" "golang.org/x/tools/internal/testenv" ) diff --git a/go/ssa/source_test.go b/go/ssa/source_test.go index bd156cbc5..3d0bfe4cd 100644 --- a/go/ssa/source_test.go +++ b/go/ssa/source_test.go @@ -18,8 +18,8 @@ import ( "testing" "golang.org/x/tools/go/ast/astutil" - "golang.org/x/tools/go/expect" "golang.org/x/tools/go/ssa" + "golang.org/x/tools/internal/expect" ) func TestObjValueLookup(t *testing.T) { diff --git a/gopls/internal/cache/mod_tidy.go b/gopls/internal/cache/mod_tidy.go index 8532d1c74..67a3e9c7e 100644 --- a/gopls/internal/cache/mod_tidy.go +++ b/gopls/internal/cache/mod_tidy.go @@ -267,7 +267,7 @@ func missingModuleDiagnostics(ctx context.Context, snapshot *Snapshot, pm *Parse // Example: // // import ( - // "golang.org/x/tools/go/expect" + // "golang.org/x/tools/internal/expect" // "golang.org/x/tools/go/packages" // ) // They both are related to the same module: "golang.org/x/tools". diff --git a/gopls/internal/test/marker/doc.go b/gopls/internal/test/marker/doc.go index ca4dcc75f..00ee8655b 100644 --- a/gopls/internal/test/marker/doc.go +++ b/gopls/internal/test/marker/doc.go @@ -10,7 +10,7 @@ Use this command to run the tests: $ go test ./gopls/internal/test/marker [-update] -A marker test uses the '//@' marker syntax of the x/tools/go/expect package +A marker test uses the '//@' marker syntax of the x/tools/internal/expect package to annotate source code with various information such as locations and arguments of LSP operations to be executed by the test. The syntax following '@' is parsed as a comma-separated list of ordinary Go function calls, for @@ -277,7 +277,7 @@ The following markers are supported within marker tests: # Argument conversion -Marker arguments are first parsed by the go/expect package, which accepts +Marker arguments are first parsed by the internal/expect package, which accepts the following tokens as defined by the Go spec: - string, int64, float64, and rune literals - true and false diff --git a/gopls/internal/test/marker/marker_test.go b/gopls/internal/test/marker/marker_test.go index 032b4e846..cb0e93038 100644 --- a/gopls/internal/test/marker/marker_test.go +++ b/gopls/internal/test/marker/marker_test.go @@ -30,7 +30,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "golang.org/x/tools/go/expect" "golang.org/x/tools/gopls/internal/cache" "golang.org/x/tools/gopls/internal/debug" "golang.org/x/tools/gopls/internal/lsprpc" @@ -42,6 +41,7 @@ import ( "golang.org/x/tools/gopls/internal/util/safetoken" "golang.org/x/tools/internal/diff" "golang.org/x/tools/internal/diff/myers" + "golang.org/x/tools/internal/expect" "golang.org/x/tools/internal/jsonrpc2" "golang.org/x/tools/internal/jsonrpc2/servertest" "golang.org/x/tools/internal/testenv" diff --git a/internal/refactor/inline/inline_test.go b/internal/refactor/inline/inline_test.go index 1ae72feec..8da5fa98c 100644 --- a/internal/refactor/inline/inline_test.go +++ b/internal/refactor/inline/inline_test.go @@ -23,10 +23,10 @@ import ( "unsafe" "golang.org/x/tools/go/ast/astutil" - "golang.org/x/tools/go/expect" "golang.org/x/tools/go/packages" "golang.org/x/tools/go/types/typeutil" "golang.org/x/tools/internal/diff" + "golang.org/x/tools/internal/expect" "golang.org/x/tools/internal/refactor/inline" "golang.org/x/tools/internal/testenv" "golang.org/x/tools/txtar"