1
0
mirror of https://github.com/golang/go synced 2024-11-18 14:14:46 -07:00

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
This commit is contained in:
Alan Donovan 2014-09-08 13:24:38 -04:00
parent 850afc6bb5
commit 9872f0d268
13 changed files with 26 additions and 26 deletions

View File

@ -73,7 +73,7 @@ Describe the syntax at offset 530 in this file (an import spec):
code.google.com/p/go.tools/cmd/oracle code.google.com/p/go.tools/cmd/oracle
Print the callgraph of the trivial web-server in JSON format: 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 ` + loader.FromArgsUsage
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file") var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")

View File

@ -11,8 +11,8 @@ package whitelist
// library's exported slice types. // library's exported slice types.
var UnkeyedLiteral = map[string]bool{ var UnkeyedLiteral = map[string]bool{
/* /*
find $GOROOT/src/pkg -type f | grep -v _test.go | xargs grep '^type.*\[\]' | \ find $GOROOT/src -type f | grep -v _test.go | xargs grep '^type.*\[\]' | \
grep -v ' map\[' | sed 's,/[^/]*go.type,,' | sed 's,.*src/pkg/,,' | \ grep -v ' map\[' | sed 's,/[^/]*go.type,,' | sed 's,.*src/,,' | \
sed 's, ,.,' | sed 's, .*,,' | grep -v '\.[a-z]' | \ sed 's, ,.,' | sed 's, .*,,' | grep -v '\.[a-z]' | \
sort | awk '{ print "\"" $0 "\": true," }' sort | awk '{ print "\"" $0 "\": true," }'
*/ */

View File

@ -7,8 +7,8 @@ package loader
// The approach taken is to run the cgo processor on the package's // The approach taken is to run the cgo processor on the package's
// CgoFiles and parse the output, faking the filenames of the // CgoFiles and parse the output, faking the filenames of the
// resulting ASTs so that the synthetic file containing the C types is // 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 // called "C" (e.g. "~/go/src/net/C") and the preprocessed files
// have their original names (e.g. "~/go/src/pkg/net/cgo_unix.go"), // have their original names (e.g. "~/go/src/net/cgo_unix.go"),
// not the names of the actual temporary files. // not the names of the actual temporary files.
// //
// The advantage of this approach is its fidelity to 'go build'. The // The advantage of this approach is its fidelity to 'go build'. The

View File

@ -49,7 +49,7 @@
// //
// An AD-HOC package is one specified as a set of source files on the // 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 // 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 // EXTERNAL TEST packages are those comprised of a set of *_test.go
// files all with the same 'package foo_test' declaration, all in the // files all with the same 'package foo_test' declaration, all in the

View File

@ -134,7 +134,7 @@ func fakeContext(pkgs map[string]string) *build.Context {
ctxt.IsDir = func(path string) bool { return true } ctxt.IsDir = func(path string) bool { return true }
ctxt.ReadDir = func(dir string) ([]os.FileInfo, error) { return justXgo[:], nil } ctxt.ReadDir = func(dir string) ([]os.FileInfo, error) { return justXgo[:], nil }
ctxt.OpenFile = func(path string) (io.ReadCloser, error) { 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 ioutil.NopCloser(bytes.NewBufferString(pkgs[path[0:1]])), nil
} }
return &ctxt return &ctxt

View File

@ -30,7 +30,7 @@ import (
func allPackages() []string { func allPackages() []string {
var pkgs []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 { filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
// Prune the search if we encounter any of these names: // Prune the search if we encounter any of these names:
switch filepath.Base(path) { switch filepath.Base(path) {

View File

@ -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. // go/{loader,pointer,ssa}/stdlib_test.go and godoc/analysis/analysis.go.
func allPackages() []string { func allPackages() []string {
var pkgs []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 { filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
// Prune the search if we encounter any of these names: // Prune the search if we encounter any of these names:
switch filepath.Base(path) { switch filepath.Base(path) {

View File

@ -150,8 +150,8 @@ var testdataTests = []string{
"callstack.go", "callstack.go",
} }
// These are files and packages in $GOROOT/src/pkg/. // These are files and packages in $GOROOT/src/.
var gorootSrcPkgTests = []string{ var gorootSrcTests = []string{
"encoding/ascii85", "encoding/ascii85",
"encoding/csv", "encoding/csv",
"encoding/hex", "encoding/hex",
@ -315,8 +315,8 @@ func TestGorootTest(t *testing.T) {
failures = append(failures, input) failures = append(failures, input)
} }
} }
for _, input := range gorootSrcPkgTests { for _, input := range gorootSrcTests {
if !run(t, filepath.Join(build.Default.GOROOT, "src/pkg")+slash, input, success) { if !run(t, filepath.Join(build.Default.GOROOT, "src")+slash, input, success) {
failures = append(failures, input) failures = append(failures, input)
} }
} }

View File

@ -25,7 +25,7 @@ import (
func allPackages() []string { func allPackages() []string {
var pkgs []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 { filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
// Prune the search if we encounter any of these names: // Prune the search if we encounter any of these names:
switch filepath.Base(path) { switch filepath.Base(path) {

View File

@ -6,7 +6,7 @@ package ssa
// CreateTestMainPackage synthesizes a main package that runs all the // CreateTestMainPackage synthesizes a main package that runs all the
// tests of the supplied packages. // 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 ( import (
"go/ast" "go/ast"

View File

@ -32,7 +32,7 @@ var (
) )
func TestStdlib(t *testing.T) { func TestStdlib(t *testing.T) {
walkDirs(t, filepath.Join(runtime.GOROOT(), "src/pkg")) walkDirs(t, filepath.Join(runtime.GOROOT(), "src"))
if testing.Verbose() { if testing.Verbose() {
fmt.Println(pkgCount, "packages typechecked in", time.Since(start)) fmt.Println(pkgCount, "packages typechecked in", time.Since(start))
} }

View File

@ -246,7 +246,7 @@ func shifts8() {
func shifts9() { func shifts9() {
// various originally failing snippets of code from the std library // 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 { var d struct {
bits uint32 bits uint32
@ -255,7 +255,7 @@ func shifts9() {
_ = uint16(d.bits & (1<<d.width - 1)) _ = uint16(d.bits & (1<<d.width - 1))
} }
// from src/pkg/debug/dwarf/buf.go:116 // from src/debug/dwarf/buf.go:116
{ {
var ux uint64 var ux uint64
var bits uint var bits uint
@ -263,13 +263,13 @@ func shifts9() {
if x&(1<<(bits-1)) != 0 {} if x&(1<<(bits-1)) != 0 {}
} }
// from src/pkg/encoding/asn1/asn1.go:160 // from src/encoding/asn1/asn1.go:160
{ {
var bytes []byte var bytes []byte
if bytes[len(bytes)-1]&((1<<bytes[0])-1) != 0 {} if bytes[len(bytes)-1]&((1<<bytes[0])-1) != 0 {}
} }
// from src/pkg/math/big/rat.go:140 // from src/math/big/rat.go:140
{ {
var exp int var exp int
var mantissa uint64 var mantissa uint64
@ -277,7 +277,7 @@ func shifts9() {
_ = mantissa & (1<<shift - 1) _ = mantissa & (1<<shift - 1)
} }
// from src/pkg/net/interface.go:51 // from src/net/interface.go:51
{ {
type Flags uint type Flags uint
var f Flags var f Flags
@ -285,21 +285,21 @@ func shifts9() {
if f&(1<<uint(i)) != 0 {} if f&(1<<uint(i)) != 0 {}
} }
// from src/pkg/runtime/softfloat64.go:234 // from src/runtime/softfloat64.go:234
{ {
var gm uint64 var gm uint64
var shift uint var shift uint
_ = gm & (1<<shift - 1) _ = gm & (1<<shift - 1)
} }
// from src/pkg/strconv/atof.go:326 // from src/strconv/atof.go:326
{ {
var mant uint64 var mant uint64
var mantbits uint var mantbits uint
if mant == 2<<mantbits {} if mant == 2<<mantbits {}
} }
// from src/pkg/syscall/route_bsd.go:82 // from src/route_bsd.go:82
{ {
var Addrs int32 var Addrs int32
const rtaRtMask = 1 const rtaRtMask = 1
@ -307,7 +307,7 @@ func shifts9() {
if Addrs&rtaRtMask&(1<<i) == 0 {} if Addrs&rtaRtMask&(1<<i) == 0 {}
} }
// from src/pkg/text/scanner/scanner.go:540 // from src/text/scanner/scanner.go:540
{ {
var s struct { Whitespace uint64 } var s struct { Whitespace uint64 }
var ch rune var ch rune

View File

@ -306,7 +306,7 @@ func reduceScope(pos string, conf *loader.Config) {
// Check that the queried file appears in the package: // Check that the queried file appears in the package:
// it might be a '// +build ignore' from an ad-hoc main // it might be a '// +build ignore' from an ad-hoc main
// package, e.g. $GOROOT/src/pkg/net/http/triv.go. // package, e.g. $GOROOT/src/net/http/triv.go.
if !pkgContainsFile(bp, fqpos.fset.File(fqpos.start).Name()) { if !pkgContainsFile(bp, fqpos.fset.File(fqpos.start).Name()) {
return // not found return // not found
} }