From 9872f0d268f2a312a77e14a5164cd5ee3b11722d Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Mon, 8 Sep 2014 13:24:38 -0400 Subject: [PATCH] go.tools/*: replace $GOROOT/src/pkg with $GOROOT/src where appropriate. (godoc is excluded from this CL since it will continue to use /src/pkg in its URL namespace, making the necessary cleanup more subtle.) LGTM=gri R=gri CC=golang-codereviews https://golang.org/cl/141770043 --- cmd/oracle/main.go | 2 +- cmd/vet/whitelist/whitelist.go | 4 ++-- go/loader/cgo.go | 4 ++-- go/loader/loader.go | 2 +- go/loader/loader_test.go | 2 +- go/loader/stdlib_test.go | 2 +- go/pointer/stdlib_test.go | 2 +- go/ssa/interp/interp_test.go | 8 ++++---- go/ssa/stdlib_test.go | 2 +- go/ssa/testmain.go | 2 +- go/types/stdlib_test.go | 2 +- go/types/testdata/shifts.src | 18 +++++++++--------- oracle/oracle.go | 2 +- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/cmd/oracle/main.go b/cmd/oracle/main.go index d99f9dc1a5..580fd6c86b 100644 --- a/cmd/oracle/main.go +++ b/cmd/oracle/main.go @@ -73,7 +73,7 @@ Describe the syntax at offset 530 in this file (an import spec): code.google.com/p/go.tools/cmd/oracle Print the callgraph of the trivial web-server in JSON format: -% oracle -format=json src/pkg/net/http/triv.go callgraph +% oracle -format=json $GOROOT/src/net/http/triv.go callgraph ` + loader.FromArgsUsage var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file") diff --git a/cmd/vet/whitelist/whitelist.go b/cmd/vet/whitelist/whitelist.go index 7aa0d30d7f..975c9e3780 100644 --- a/cmd/vet/whitelist/whitelist.go +++ b/cmd/vet/whitelist/whitelist.go @@ -11,8 +11,8 @@ package whitelist // library's exported slice types. var UnkeyedLiteral = map[string]bool{ /* - find $GOROOT/src/pkg -type f | grep -v _test.go | xargs grep '^type.*\[\]' | \ - grep -v ' map\[' | sed 's,/[^/]*go.type,,' | sed 's,.*src/pkg/,,' | \ + find $GOROOT/src -type f | grep -v _test.go | xargs grep '^type.*\[\]' | \ + grep -v ' map\[' | sed 's,/[^/]*go.type,,' | sed 's,.*src/,,' | \ sed 's, ,.,' | sed 's, .*,,' | grep -v '\.[a-z]' | \ sort | awk '{ print "\"" $0 "\": true," }' */ diff --git a/go/loader/cgo.go b/go/loader/cgo.go index f289d3dbcb..299e72579f 100644 --- a/go/loader/cgo.go +++ b/go/loader/cgo.go @@ -7,8 +7,8 @@ package loader // The approach taken is to run the cgo processor on the package's // CgoFiles and parse the output, faking the filenames of the // resulting ASTs so that the synthetic file containing the C types is -// called "C" (e.g. "~/go/src/pkg/net/C") and the preprocessed files -// have their original names (e.g. "~/go/src/pkg/net/cgo_unix.go"), +// called "C" (e.g. "~/go/src/net/C") and the preprocessed files +// have their original names (e.g. "~/go/src/net/cgo_unix.go"), // not the names of the actual temporary files. // // The advantage of this approach is its fidelity to 'go build'. The diff --git a/go/loader/loader.go b/go/loader/loader.go index d495105ad5..56468c9e7d 100644 --- a/go/loader/loader.go +++ b/go/loader/loader.go @@ -49,7 +49,7 @@ // // An AD-HOC package is one specified as a set of source files on the // command line. In the simplest case, it may consist of a single file -// such as src/pkg/net/http/triv.go. +// such as $GOROOT/src/net/http/triv.go. // // EXTERNAL TEST packages are those comprised of a set of *_test.go // files all with the same 'package foo_test' declaration, all in the diff --git a/go/loader/loader_test.go b/go/loader/loader_test.go index 5843c5d76e..0421ec0816 100644 --- a/go/loader/loader_test.go +++ b/go/loader/loader_test.go @@ -134,7 +134,7 @@ func fakeContext(pkgs map[string]string) *build.Context { ctxt.IsDir = func(path string) bool { return true } ctxt.ReadDir = func(dir string) ([]os.FileInfo, error) { return justXgo[:], nil } ctxt.OpenFile = func(path string) (io.ReadCloser, error) { - path = path[len("/go/src/pkg/"):] + path = path[len("/go/src/"):] return ioutil.NopCloser(bytes.NewBufferString(pkgs[path[0:1]])), nil } return &ctxt diff --git a/go/loader/stdlib_test.go b/go/loader/stdlib_test.go index 8b47c5f93a..3eba7b29b0 100644 --- a/go/loader/stdlib_test.go +++ b/go/loader/stdlib_test.go @@ -30,7 +30,7 @@ import ( func allPackages() []string { var pkgs []string - root := filepath.Join(runtime.GOROOT(), "src/pkg") + string(os.PathSeparator) + root := filepath.Join(runtime.GOROOT(), "src") + string(os.PathSeparator) filepath.Walk(root, func(path string, info os.FileInfo, err error) error { // Prune the search if we encounter any of these names: switch filepath.Base(path) { diff --git a/go/pointer/stdlib_test.go b/go/pointer/stdlib_test.go index c837bf8d5d..f6a2ab4879 100644 --- a/go/pointer/stdlib_test.go +++ b/go/pointer/stdlib_test.go @@ -33,7 +33,7 @@ var runStdlibTest = flag.Bool("stdlib", false, "Run the (slow) stdlib test") // go/{loader,pointer,ssa}/stdlib_test.go and godoc/analysis/analysis.go. func allPackages() []string { var pkgs []string - root := filepath.Join(runtime.GOROOT(), "src/pkg") + string(os.PathSeparator) + root := filepath.Join(runtime.GOROOT(), "src") + string(os.PathSeparator) filepath.Walk(root, func(path string, info os.FileInfo, err error) error { // Prune the search if we encounter any of these names: switch filepath.Base(path) { diff --git a/go/ssa/interp/interp_test.go b/go/ssa/interp/interp_test.go index e04ec066ca..4324b08f8b 100644 --- a/go/ssa/interp/interp_test.go +++ b/go/ssa/interp/interp_test.go @@ -150,8 +150,8 @@ var testdataTests = []string{ "callstack.go", } -// These are files and packages in $GOROOT/src/pkg/. -var gorootSrcPkgTests = []string{ +// These are files and packages in $GOROOT/src/. +var gorootSrcTests = []string{ "encoding/ascii85", "encoding/csv", "encoding/hex", @@ -315,8 +315,8 @@ func TestGorootTest(t *testing.T) { failures = append(failures, input) } } - for _, input := range gorootSrcPkgTests { - if !run(t, filepath.Join(build.Default.GOROOT, "src/pkg")+slash, input, success) { + for _, input := range gorootSrcTests { + if !run(t, filepath.Join(build.Default.GOROOT, "src")+slash, input, success) { failures = append(failures, input) } } diff --git a/go/ssa/stdlib_test.go b/go/ssa/stdlib_test.go index 3ee1b9b086..708c1ae6db 100644 --- a/go/ssa/stdlib_test.go +++ b/go/ssa/stdlib_test.go @@ -25,7 +25,7 @@ import ( func allPackages() []string { var pkgs []string - root := filepath.Join(runtime.GOROOT(), "src/pkg") + string(os.PathSeparator) + root := filepath.Join(runtime.GOROOT(), "src") + string(os.PathSeparator) filepath.Walk(root, func(path string, info os.FileInfo, err error) error { // Prune the search if we encounter any of these names: switch filepath.Base(path) { diff --git a/go/ssa/testmain.go b/go/ssa/testmain.go index 223013d56e..f11e3b719e 100644 --- a/go/ssa/testmain.go +++ b/go/ssa/testmain.go @@ -6,7 +6,7 @@ package ssa // CreateTestMainPackage synthesizes a main package that runs all the // tests of the supplied packages. -// It is closely coupled to src/cmd/go/test.go and src/pkg/testing. +// It is closely coupled to $GOROOT/src/cmd/go/test.go and $GOROOT/src/testing. import ( "go/ast" diff --git a/go/types/stdlib_test.go b/go/types/stdlib_test.go index 8a6a9bb28b..310e11df6f 100644 --- a/go/types/stdlib_test.go +++ b/go/types/stdlib_test.go @@ -32,7 +32,7 @@ var ( ) func TestStdlib(t *testing.T) { - walkDirs(t, filepath.Join(runtime.GOROOT(), "src/pkg")) + walkDirs(t, filepath.Join(runtime.GOROOT(), "src")) if testing.Verbose() { fmt.Println(pkgCount, "packages typechecked in", time.Since(start)) } diff --git a/go/types/testdata/shifts.src b/go/types/testdata/shifts.src index 6c6d8f0f88..7f8ed06fbf 100644 --- a/go/types/testdata/shifts.src +++ b/go/types/testdata/shifts.src @@ -246,7 +246,7 @@ func shifts8() { func shifts9() { // various originally failing snippets of code from the std library - // from src/pkg/compress/lzw/reader.go:90 + // from src/compress/lzw/reader.go:90 { var d struct { bits uint32 @@ -255,7 +255,7 @@ func shifts9() { _ = uint16(d.bits & (1<