mirror of
https://github.com/golang/go
synced 2024-09-29 11:34:32 -06:00
internal/txtar: bring back to main repo, for tests in std
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>
This commit is contained in:
parent
95395fdbe3
commit
a3fcc755db
@ -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.
|
||||
|
@ -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 (
|
||||
|
@ -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.`)
|
||||
|
3
src/cmd/go/testdata/addmod.go
vendored
3
src/cmd/go/testdata/addmod.go
vendored
@ -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() {
|
||||
|
3
src/cmd/go/testdata/savedir.go
vendored
3
src/cmd/go/testdata/savedir.go
vendored
@ -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() {
|
||||
|
2
src/cmd/go/testdata/script/README
vendored
2
src/cmd/go/testdata/script/README
vendored
@ -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.
|
||||
|
1
src/cmd/vendor/modules.txt
vendored
1
src/cmd/vendor/modules.txt
vendored
@ -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
|
||||
|
@ -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".
|
||||
|
Loading…
Reference in New Issue
Block a user