mirror of
https://github.com/golang/go
synced 2024-11-17 06:54:48 -07: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"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"internal/testenv"
|
"internal/testenv"
|
||||||
|
"internal/txtar"
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"golang.org/x/tools/txtar"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// initOverlay resets the overlay state to reflect the config.
|
// initOverlay resets the overlay state to reflect the config.
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"internal/txtar"
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"log"
|
"log"
|
||||||
@ -30,7 +31,6 @@ import (
|
|||||||
"golang.org/x/mod/semver"
|
"golang.org/x/mod/semver"
|
||||||
"golang.org/x/mod/sumdb"
|
"golang.org/x/mod/sumdb"
|
||||||
"golang.org/x/mod/sumdb/dirhash"
|
"golang.org/x/mod/sumdb/dirhash"
|
||||||
"golang.org/x/tools/txtar"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"go/build"
|
"go/build"
|
||||||
"internal/testenv"
|
"internal/testenv"
|
||||||
|
"internal/txtar"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -33,8 +34,6 @@ import (
|
|||||||
"cmd/go/internal/robustio"
|
"cmd/go/internal/robustio"
|
||||||
"cmd/go/internal/work"
|
"cmd/go/internal/work"
|
||||||
"cmd/internal/sys"
|
"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.`)
|
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"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
exec "internal/execabs"
|
exec "internal/execabs"
|
||||||
|
"internal/txtar"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/tools/txtar"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func usage() {
|
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 (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"internal/txtar"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"golang.org/x/tools/txtar"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func usage() {
|
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,
|
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).
|
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
|
The script begins with an actual command script to run
|
||||||
followed by the content of zero or more supporting files to
|
followed by the content of zero or more supporting files to
|
||||||
create in the script's temporary file system before it starts executing.
|
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/analysisinternal
|
||||||
golang.org/x/tools/internal/lsp/fuzzy
|
golang.org/x/tools/internal/lsp/fuzzy
|
||||||
golang.org/x/tools/internal/typeparams
|
golang.org/x/tools/internal/typeparams
|
||||||
golang.org/x/tools/txtar
|
|
||||||
# golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
|
# golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
|
||||||
## explicit; go 1.11
|
## explicit; go 1.11
|
||||||
golang.org/x/xerrors
|
golang.org/x/xerrors
|
||||||
|
@ -553,6 +553,9 @@ var depsRules = `
|
|||||||
|
|
||||||
FMT, container/heap, math/rand
|
FMT, container/heap, math/rand
|
||||||
< internal/trace;
|
< internal/trace;
|
||||||
|
|
||||||
|
FMT
|
||||||
|
< internal/txtar;
|
||||||
`
|
`
|
||||||
|
|
||||||
// listStdPkgs returns the same list of packages as "go list std".
|
// listStdPkgs returns the same list of packages as "go list std".
|
||||||
|
Loading…
Reference in New Issue
Block a user