]> Cypherpunks repositories - gostls13.git/commitdiff
internal/txtar: bring back to main repo, for tests in std
authorRuss Cox <rsc@golang.org>
Sat, 29 Jan 2022 20:58:19 +0000 (15:58 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 16 Mar 2022 16:06:15 +0000 (16:06 +0000)
This used to be cmd/go/internal/txtar,
and then it was moved to golang.org/x/tools/txtar
and revendored from there into cmd/vendor/golang.org/x/tools/txtar.

We have a use for txtar in a new test in the standard library,
which cannot access cmd/vendor. But we also don't really want
to vendor it into the standard library as is, because that would
be the first vendoring of x/tools in std, and it would be better
to keep std separate from x/tools, even for testing.

Instead, since a little copying is better than a little dependency,
just make a copy in internal/txtar. The package does not change.

Having done that, replace the uses in cmd/go so that there's
only one copy in the main repo.

Change-Id: I70b5cc05da3f6ebcc0fd9052ebcb3d369fb57956
Reviewed-on: https://go-review.googlesource.com/c/go/+/384254
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/go/internal/fsys/fsys_test.go
src/cmd/go/proxy_test.go
src/cmd/go/script_test.go
src/cmd/go/testdata/addmod.go
src/cmd/go/testdata/savedir.go
src/cmd/go/testdata/script/README
src/cmd/vendor/modules.txt
src/go/build/deps_test.go
src/internal/txtar/archive.go [moved from src/cmd/vendor/golang.org/x/tools/txtar/archive.go with 100% similarity]

index c080c14987c37cad5928771d49bb0a4b1b602953..8cfe1d89e693b22c9d33390eae9bec302aad1059 100644 (file)
@@ -5,14 +5,13 @@ import (
        "errors"
        "fmt"
        "internal/testenv"
+       "internal/txtar"
        "io"
        "io/fs"
        "os"
        "path/filepath"
        "reflect"
        "testing"
-
-       "golang.org/x/tools/txtar"
 )
 
 // initOverlay resets the overlay state to reflect the config.
index 517a88554282de5f133b8fc1196e112abf5a0d87..fc256968b74bd1faa0f41237765a830abc3cc688 100644 (file)
@@ -11,6 +11,7 @@ import (
        "errors"
        "flag"
        "fmt"
+       "internal/txtar"
        "io"
        "io/fs"
        "log"
@@ -30,7 +31,6 @@ import (
        "golang.org/x/mod/semver"
        "golang.org/x/mod/sumdb"
        "golang.org/x/mod/sumdb/dirhash"
-       "golang.org/x/tools/txtar"
 )
 
 var (
index eff221352575e68d9b5966ff77a972a386dbcc1b..90ab3a6501b248f7e790b4cae15f65ecdd1d2159 100644 (file)
@@ -15,6 +15,7 @@ import (
        "fmt"
        "go/build"
        "internal/testenv"
+       "internal/txtar"
        "io/fs"
        "os"
        "os/exec"
@@ -33,8 +34,6 @@ import (
        "cmd/go/internal/robustio"
        "cmd/go/internal/work"
        "cmd/internal/sys"
-
-       "golang.org/x/tools/txtar"
 )
 
 var testSum = flag.String("testsum", "", `may be tidy, listm, or listall. If set, TestScript generates a go.sum file at the beginning of each test and updates test files if they pass.`)
index eac2a7ad449a2fea361545cd27a712bfe0821a92..41997a52fff4912f174cd8d7bf5ad6747eaa02f8 100644 (file)
@@ -24,13 +24,12 @@ import (
        "flag"
        "fmt"
        exec "internal/execabs"
+       "internal/txtar"
        "io/fs"
        "log"
        "os"
        "path/filepath"
        "strings"
-
-       "golang.org/x/tools/txtar"
 )
 
 func usage() {
index 53c78cfb00bbac391b9b1f818a566a0d8d786555..eaafc5e4939b383dc8a24fae18ceca3c78de6a90 100644 (file)
@@ -18,14 +18,13 @@ package main
 import (
        "flag"
        "fmt"
+       "internal/txtar"
        "io/fs"
        "log"
        "os"
        "path/filepath"
        "strings"
        "unicode/utf8"
-
-       "golang.org/x/tools/txtar"
 )
 
 func usage() {
index b2a7fd19156d096131a3b91a22a069b958d51a2c..17b582d6627706c2409894609671f9ace9291ddd 100644 (file)
@@ -7,7 +7,7 @@ In general script files should have short names: a few words, not whole sentence
 The first word should be the general category of behavior being tested,
 often the name of a go subcommand (list, build, test, ...) or concept (vendor, pattern).
 
-Each script is a text archive (go doc cmd/go/internal/txtar).
+Each script is a text archive (go doc internal/txtar).
 The script begins with an actual command script to run
 followed by the content of zero or more supporting files to
 create in the script's temporary file system before it starts executing.
index f2cd884b820ce95fa4584709068e23161e33d94b..c373ca05b19973c8ea590f772a3cfa3cf4397e78 100644 (file)
@@ -96,7 +96,6 @@ golang.org/x/tools/go/types/typeutil
 golang.org/x/tools/internal/analysisinternal
 golang.org/x/tools/internal/lsp/fuzzy
 golang.org/x/tools/internal/typeparams
-golang.org/x/tools/txtar
 # golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
 ## explicit; go 1.11
 golang.org/x/xerrors
index 6b2c2933f82afb9d855acbf53f5c4434e4ce3cd7..ed40f43c9daf39c3e2db50accaa2dbecb59d0a7f 100644 (file)
@@ -553,6 +553,9 @@ var depsRules = `
 
        FMT, container/heap, math/rand
        < internal/trace;
+
+       FMT
+       < internal/txtar;
 `
 
 // listStdPkgs returns the same list of packages as "go list std".