mirror of
https://github.com/golang/go
synced 2024-11-18 15:04:44 -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:
parent
850afc6bb5
commit
9872f0d268
@ -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")
|
||||
|
@ -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," }'
|
||||
*/
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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"
|
||||
|
@ -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))
|
||||
}
|
||||
|
18
go/types/testdata/shifts.src
vendored
18
go/types/testdata/shifts.src
vendored
@ -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<<d.width - 1))
|
||||
}
|
||||
|
||||
// from src/pkg/debug/dwarf/buf.go:116
|
||||
// from src/debug/dwarf/buf.go:116
|
||||
{
|
||||
var ux uint64
|
||||
var bits uint
|
||||
@ -263,13 +263,13 @@ func shifts9() {
|
||||
if x&(1<<(bits-1)) != 0 {}
|
||||
}
|
||||
|
||||
// from src/pkg/encoding/asn1/asn1.go:160
|
||||
// from src/encoding/asn1/asn1.go:160
|
||||
{
|
||||
var bytes []byte
|
||||
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 mantissa uint64
|
||||
@ -277,7 +277,7 @@ func shifts9() {
|
||||
_ = mantissa & (1<<shift - 1)
|
||||
}
|
||||
|
||||
// from src/pkg/net/interface.go:51
|
||||
// from src/net/interface.go:51
|
||||
{
|
||||
type Flags uint
|
||||
var f Flags
|
||||
@ -285,21 +285,21 @@ func shifts9() {
|
||||
if f&(1<<uint(i)) != 0 {}
|
||||
}
|
||||
|
||||
// from src/pkg/runtime/softfloat64.go:234
|
||||
// from src/runtime/softfloat64.go:234
|
||||
{
|
||||
var gm uint64
|
||||
var shift uint
|
||||
_ = gm & (1<<shift - 1)
|
||||
}
|
||||
|
||||
// from src/pkg/strconv/atof.go:326
|
||||
// from src/strconv/atof.go:326
|
||||
{
|
||||
var mant uint64
|
||||
var mantbits uint
|
||||
if mant == 2<<mantbits {}
|
||||
}
|
||||
|
||||
// from src/pkg/syscall/route_bsd.go:82
|
||||
// from src/route_bsd.go:82
|
||||
{
|
||||
var Addrs int32
|
||||
const rtaRtMask = 1
|
||||
@ -307,7 +307,7 @@ func shifts9() {
|
||||
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 ch rune
|
||||
|
@ -306,7 +306,7 @@ func reduceScope(pos string, conf *loader.Config) {
|
||||
|
||||
// Check that the queried file appears in the package:
|
||||
// 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()) {
|
||||
return // not found
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user