diff --git a/cmd/gotype/gotype.go b/cmd/gotype/gotype.go index bd3721f1..677dbe85 100644 --- a/cmd/gotype/gotype.go +++ b/cmd/gotype/gotype.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package main import ( diff --git a/cmd/ssadump/main.go b/cmd/ssadump/main.go index 42120e89..3d1dea14 100644 --- a/cmd/ssadump/main.go +++ b/cmd/ssadump/main.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - // ssadump: a tool for displaying and interpreting the SSA form of Go programs. package main // import "golang.org/x/tools/cmd/ssadump" diff --git a/go/callgraph/cha/cha.go b/go/callgraph/cha/cha.go index e016649b..68ffffeb 100644 --- a/go/callgraph/cha/cha.go +++ b/go/callgraph/cha/cha.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - // Package cha computes the call graph of a Go program using the Class // Hierarchy Analysis (CHA) algorithm. // diff --git a/go/callgraph/cha/cha_test.go b/go/callgraph/cha/cha_test.go index 332758cf..7e56c063 100644 --- a/go/callgraph/cha/cha_test.go +++ b/go/callgraph/cha/cha_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - // No testdata on Android. // +build !android diff --git a/go/callgraph/rta/rta.go b/go/callgraph/rta/rta.go index 7c9379d6..1a2dadf5 100644 --- a/go/callgraph/rta/rta.go +++ b/go/callgraph/rta/rta.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - // This package provides Rapid Type Analysis (RTA) for Go, a fast // algorithm for call graph construction and discovery of reachable code // (and hence dead code) and runtime types. The algorithm was first diff --git a/go/callgraph/rta/rta_test.go b/go/callgraph/rta/rta_test.go index 50465212..28a00b34 100644 --- a/go/callgraph/rta/rta_test.go +++ b/go/callgraph/rta/rta_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - // No testdata on Android. // +build !android diff --git a/go/loader/cgo.go b/go/loader/cgo.go index c735d112..72c6f502 100644 --- a/go/loader/cgo.go +++ b/go/loader/cgo.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package loader // This file handles cgo preprocessing of files containing `import "C"`. diff --git a/go/loader/example15_test.go b/go/loader/example15_test.go deleted file mode 100644 index 5cf365b1..00000000 --- a/go/loader/example15_test.go +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.5,!go1.6 -// +build !windows - -package loader_test - -import ( - "fmt" - "go/token" - "log" - "path/filepath" - "runtime" - "sort" - "strings" - - "golang.org/x/tools/go/loader" -) - -func printProgram(prog *loader.Program) { - // Created packages are the initial packages specified by a call - // to CreateFromFilenames or CreateFromFiles. - var names []string - for _, info := range prog.Created { - names = append(names, info.Pkg.Path()) - } - fmt.Printf("created: %s\n", names) - - // Imported packages are the initial packages specified by a - // call to Import or ImportWithTests. - names = nil - for _, info := range prog.Imported { - if strings.Contains(info.Pkg.Path(), "internal") { - continue // skip, to reduce fragility - } - names = append(names, info.Pkg.Path()) - } - sort.Strings(names) - fmt.Printf("imported: %s\n", names) - - // InitialPackages contains the union of created and imported. - names = nil - for _, info := range prog.InitialPackages() { - names = append(names, info.Pkg.Path()) - } - sort.Strings(names) - fmt.Printf("initial: %s\n", names) - - // AllPackages contains all initial packages and their dependencies. - names = nil - for pkg := range prog.AllPackages { - names = append(names, pkg.Path()) - } - sort.Strings(names) - fmt.Printf("all: %s\n", names) -} - -func printFilenames(fset *token.FileSet, info *loader.PackageInfo) { - var names []string - for _, f := range info.Files { - names = append(names, filepath.Base(fset.File(f.Pos()).Name())) - } - fmt.Printf("%s.Files: %s\n", info.Pkg.Path(), names) -} - -// This example loads a set of packages and all of their dependencies -// from a typical command-line. FromArgs parses a command line and -// makes calls to the other methods of Config shown in the examples that -// follow. -func ExampleConfig_FromArgs() { - args := []string{"mytool", "unicode/utf8", "errors", "runtime", "--", "foo", "bar"} - const wantTests = false - - var conf loader.Config - rest, err := conf.FromArgs(args[1:], wantTests) - prog, err := conf.Load() - if err != nil { - log.Fatal(err) - } - - fmt.Printf("rest: %s\n", rest) - printProgram(prog) - // Output: - // rest: [foo bar] - // created: [] - // imported: [errors runtime unicode/utf8] - // initial: [errors runtime unicode/utf8] - // all: [errors runtime unicode/utf8 unsafe] -} - -// This example creates and type-checks a single package (without tests) -// from a list of filenames, and loads all of its dependencies. -func ExampleConfig_CreateFromFilenames() { - var conf loader.Config - filename := filepath.Join(runtime.GOROOT(), "src/container/heap/heap.go") - conf.CreateFromFilenames("container/heap", filename) - prog, err := conf.Load() - if err != nil { - log.Fatal(err) - } - - printProgram(prog) - // Output: - // created: [container/heap] - // imported: [] - // initial: [container/heap] - // all: [container/heap sort] -} - -// In the examples below, for stability, the chosen packages are -// relatively small, platform-independent, and low-level (and thus -// infrequently changing). -// The strconv package has internal and external tests. - -const hello = `package main - -import "fmt" - -func main() { - fmt.Println("Hello, world.") -} -` - -// This example creates and type-checks a package from a list of -// already-parsed files, and loads all its dependencies. -func ExampleConfig_CreateFromFiles() { - var conf loader.Config - f, err := conf.ParseFile("hello.go", hello) - if err != nil { - log.Fatal(err) - } - conf.CreateFromFiles("hello", f) - prog, err := conf.Load() - if err != nil { - log.Fatal(err) - } - - printProgram(prog) - printFilenames(prog.Fset, prog.Package("strconv")) - // Output: - // created: [hello] - // imported: [] - // initial: [hello] - // all: [errors fmt hello io math os reflect runtime strconv sync sync/atomic syscall time unicode/utf8 unsafe] - // strconv.Files: [atob.go atof.go atoi.go decimal.go doc.go extfloat.go ftoa.go isprint.go itoa.go quote.go] -} - -// This example imports three packages, including the tests for one of -// them, and loads all their dependencies. -func ExampleConfig_Import() { - // ImportWithTest("strconv") causes strconv to include - // internal_test.go, and creates an external test package, - // strconv_test. - // (Compare with the example of CreateFromFiles.) - - var conf loader.Config - conf.Import("unicode/utf8") - conf.Import("errors") - conf.ImportWithTests("strconv") - prog, err := conf.Load() - if err != nil { - log.Fatal(err) - } - - printProgram(prog) - printFilenames(prog.Fset, prog.Package("strconv")) - printFilenames(prog.Fset, prog.Package("strconv_test")) - // Output: - // created: [strconv_test] - // imported: [errors strconv unicode/utf8] - // initial: [errors strconv strconv_test unicode/utf8] - // all: [bufio bytes errors flag fmt io log math math/rand os reflect runtime runtime/pprof runtime/trace sort strconv strconv_test strings sync sync/atomic syscall testing text/tabwriter time unicode unicode/utf8 unsafe] - // strconv.Files: [atob.go atof.go atoi.go decimal.go doc.go extfloat.go ftoa.go isprint.go itoa.go quote.go internal_test.go] - // strconv_test.Files: [atob_test.go atof_test.go atoi_test.go decimal_test.go example_test.go fp_test.go ftoa_test.go itoa_test.go quote_test.go strconv_test.go] -} diff --git a/go/loader/go16.go b/go/loader/go16.go deleted file mode 100644 index c0ed50f4..00000000 --- a/go/loader/go16.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.6 - -package loader - -import "go/build" - -func init() { - ignoreVendor = build.IgnoreVendor -} diff --git a/go/loader/go16_test.go b/go/loader/go16_test.go deleted file mode 100644 index 71f89b2d..00000000 --- a/go/loader/go16_test.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.6 -// +build !android - -package loader_test - -func init() { - go16 = true -} diff --git a/go/loader/loader.go b/go/loader/loader.go index 0d4c0d14..f03e8f94 100644 --- a/go/loader/loader.go +++ b/go/loader/loader.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package loader // See doc.go for package documentation and implementation notes. @@ -604,7 +602,7 @@ func (conf *Config) Load() (*Program, error) { // Create packages specified by conf.CreatePkgs. for _, cp := range conf.CreatePkgs { - files, errs := parseFiles(conf.fset(), conf.build(), nil, ".", cp.Filenames, conf.ParserMode) + files, errs := parseFiles(conf.fset(), conf.build(), nil, conf.Cwd, cp.Filenames, conf.ParserMode) files = append(files, cp.Files...) path := cp.Path @@ -616,7 +614,7 @@ func (conf *Config) Load() (*Program, error) { } } - dir := "." + dir := conf.Cwd if len(files) > 0 && files[0].Pos().IsValid() { dir = filepath.Dir(conf.fset().File(files[0].Pos()).Name()) } diff --git a/go/loader/loader_test.go b/go/loader/loader_test.go index 540aa4cf..807f798c 100644 --- a/go/loader/loader_test.go +++ b/go/loader/loader_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - // No testdata on Android. // +build !android @@ -26,8 +24,6 @@ import ( "golang.org/x/tools/go/loader" ) -var go16 bool // Go version >= go1.6 - // TestFromArgs checks that conf.FromArgs populates conf correctly. // It does no I/O. func TestFromArgs(t *testing.T) { @@ -400,10 +396,6 @@ func TestCwd(t *testing.T) { } func TestLoad_vendor(t *testing.T) { - if !go16 { - // TODO(adonovan): delete in due course. - t.Skipf("vendoring requires Go 1.6") - } pkgs := map[string]string{ "a": `package a; import _ "x"`, "a/vendor": ``, // mkdir a/vendor @@ -437,10 +429,6 @@ func TestLoad_vendor(t *testing.T) { } func TestVendorCwd(t *testing.T) { - if !go16 { - // TODO(adonovan): delete in due course. - t.Skipf("vendoring requires Go 1.6") - } // Test the interaction of cwd and vendor directories. ctxt := fakeContext(map[string]string{ "net": ``, // mkdir net @@ -454,8 +442,8 @@ func TestVendorCwd(t *testing.T) { }{ {cwd: "/go/src/net", arg: "http"}, // not found {cwd: "/go/src/net", arg: "./http", want: "net/http vendor/hpack"}, - {cwd: "/go/src/net", arg: "hpack", want: "hpack"}, - {cwd: "/go/src/vendor", arg: "hpack", want: "hpack"}, + {cwd: "/go/src/net", arg: "hpack", want: "vendor/hpack"}, + {cwd: "/go/src/vendor", arg: "hpack", want: "vendor/hpack"}, {cwd: "/go/src/vendor", arg: "./hpack", want: "vendor/hpack"}, } { conf := loader.Config{ diff --git a/go/loader/stdlib_test.go b/go/loader/stdlib_test.go index bc1618ef..2cd066f8 100644 --- a/go/loader/stdlib_test.go +++ b/go/loader/stdlib_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package loader_test // This file enumerates all packages beneath $GOROOT, loads them, plus diff --git a/go/pointer/analysis.go b/go/pointer/analysis.go index 9f3476ce..11541823 100644 --- a/go/pointer/analysis.go +++ b/go/pointer/analysis.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package pointer // This file defines the main datatypes and Analyze function of the pointer analysis. diff --git a/go/pointer/api.go b/go/pointer/api.go index 077ef569..8f9ae0ab 100644 --- a/go/pointer/api.go +++ b/go/pointer/api.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package pointer import ( diff --git a/go/pointer/constraint.go b/go/pointer/constraint.go index ea442873..54b54288 100644 --- a/go/pointer/constraint.go +++ b/go/pointer/constraint.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package pointer import "go/types" diff --git a/go/pointer/doc.go b/go/pointer/doc.go index 17d98cb1..22e569cd 100644 --- a/go/pointer/doc.go +++ b/go/pointer/doc.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - /* Package pointer implements Andersen's analysis, an inclusion-based diff --git a/go/pointer/gen.go b/go/pointer/gen.go index 926cd5ec..d62a8cac 100644 --- a/go/pointer/gen.go +++ b/go/pointer/gen.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package pointer // This file defines the constraint generation phase. diff --git a/go/pointer/hvn.go b/go/pointer/hvn.go index 0a5aaa33..812b8a31 100644 --- a/go/pointer/hvn.go +++ b/go/pointer/hvn.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package pointer // This file implements Hash-Value Numbering (HVN), a pre-solver diff --git a/go/pointer/intrinsics.go b/go/pointer/intrinsics.go index 0246f34a..b7e2b140 100644 --- a/go/pointer/intrinsics.go +++ b/go/pointer/intrinsics.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package pointer // This package defines the treatment of intrinsics, i.e. library diff --git a/go/pointer/labels.go b/go/pointer/labels.go index bfe60d2f..7d64ef6a 100644 --- a/go/pointer/labels.go +++ b/go/pointer/labels.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package pointer import ( diff --git a/go/pointer/pointer_test.go b/go/pointer/pointer_test.go index 7cb16d75..8918406b 100644 --- a/go/pointer/pointer_test.go +++ b/go/pointer/pointer_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - // No testdata on Android. // +build !android diff --git a/go/pointer/reflect.go b/go/pointer/reflect.go index bdb22cf9..3439a896 100644 --- a/go/pointer/reflect.go +++ b/go/pointer/reflect.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package pointer // This file implements the generation and resolution rules for diff --git a/go/pointer/solve.go b/go/pointer/solve.go index 3c606854..0fdd098b 100644 --- a/go/pointer/solve.go +++ b/go/pointer/solve.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package pointer // This file defines a naive Andersen-style solver for the inclusion diff --git a/go/pointer/util.go b/go/pointer/util.go index 4d2fa74f..2f184788 100644 --- a/go/pointer/util.go +++ b/go/pointer/util.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package pointer import ( diff --git a/go/ssa/builder_test.go b/go/ssa/builder_test.go index 5f4ff9f2..8b186f39 100644 --- a/go/ssa/builder_test.go +++ b/go/ssa/builder_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa_test import ( diff --git a/go/ssa/const.go b/go/ssa/const.go index 0690463d..2870eea5 100644 --- a/go/ssa/const.go +++ b/go/ssa/const.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.6 - package ssa // This file defines the Const SSA value type. diff --git a/go/ssa/const15.go b/go/ssa/const15.go deleted file mode 100644 index a42b255a..00000000 --- a/go/ssa/const15.go +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.5,!go1.6 - -package ssa - -// This file defines the Const SSA value type. - -import ( - "fmt" - exact "go/constant" - "go/token" - "go/types" - "strconv" -) - -// NewConst returns a new constant of the specified value and type. -// val must be valid according to the specification of Const.Value. -// -func NewConst(val exact.Value, typ types.Type) *Const { - return &Const{typ, val} -} - -// intConst returns an 'int' constant that evaluates to i. -// (i is an int64 in case the host is narrower than the target.) -func intConst(i int64) *Const { - return NewConst(exact.MakeInt64(i), tInt) -} - -// nilConst returns a nil constant of the specified type, which may -// be any reference type, including interfaces. -// -func nilConst(typ types.Type) *Const { - return NewConst(nil, typ) -} - -// stringConst returns a 'string' constant that evaluates to s. -func stringConst(s string) *Const { - return NewConst(exact.MakeString(s), tString) -} - -// zeroConst returns a new "zero" constant of the specified type, -// which must not be an array or struct type: the zero values of -// aggregates are well-defined but cannot be represented by Const. -// -func zeroConst(t types.Type) *Const { - switch t := t.(type) { - case *types.Basic: - switch { - case t.Info()&types.IsBoolean != 0: - return NewConst(exact.MakeBool(false), t) - case t.Info()&types.IsNumeric != 0: - return NewConst(exact.MakeInt64(0), t) - case t.Info()&types.IsString != 0: - return NewConst(exact.MakeString(""), t) - case t.Kind() == types.UnsafePointer: - fallthrough - case t.Kind() == types.UntypedNil: - return nilConst(t) - default: - panic(fmt.Sprint("zeroConst for unexpected type:", t)) - } - case *types.Pointer, *types.Slice, *types.Interface, *types.Chan, *types.Map, *types.Signature: - return nilConst(t) - case *types.Named: - return NewConst(zeroConst(t.Underlying()).Value, t) - case *types.Array, *types.Struct, *types.Tuple: - panic(fmt.Sprint("zeroConst applied to aggregate:", t)) - } - panic(fmt.Sprint("zeroConst: unexpected ", t)) -} - -func (c *Const) RelString(from *types.Package) string { - var s string - if c.Value == nil { - s = "nil" - } else if c.Value.Kind() == exact.String { - s = exact.StringVal(c.Value) - const max = 20 - // TODO(adonovan): don't cut a rune in half. - if len(s) > max { - s = s[:max-3] + "..." // abbreviate - } - s = strconv.Quote(s) - } else { - s = c.Value.String() - } - return s + ":" + relType(c.Type(), from) -} - -func (c *Const) Name() string { - return c.RelString(nil) -} - -func (c *Const) String() string { - return c.Name() -} - -func (c *Const) Type() types.Type { - return c.typ -} - -func (c *Const) Referrers() *[]Instruction { - return nil -} - -func (c *Const) Parent() *Function { return nil } - -func (c *Const) Pos() token.Pos { - return token.NoPos -} - -// IsNil returns true if this constant represents a typed or untyped nil value. -func (c *Const) IsNil() bool { - return c.Value == nil -} - -// TODO(adonovan): move everything below into golang.org/x/tools/go/ssa/interp. - -// Int64 returns the numeric value of this constant truncated to fit -// a signed 64-bit integer. -// -func (c *Const) Int64() int64 { - switch x := c.Value; x.Kind() { - case exact.Int: - if i, ok := exact.Int64Val(x); ok { - return i - } - return 0 - case exact.Float: - f, _ := exact.Float64Val(x) - return int64(f) - } - panic(fmt.Sprintf("unexpected constant value: %T", c.Value)) -} - -// Uint64 returns the numeric value of this constant truncated to fit -// an unsigned 64-bit integer. -// -func (c *Const) Uint64() uint64 { - switch x := c.Value; x.Kind() { - case exact.Int: - if u, ok := exact.Uint64Val(x); ok { - return u - } - return 0 - case exact.Float: - f, _ := exact.Float64Val(x) - return uint64(f) - } - panic(fmt.Sprintf("unexpected constant value: %T", c.Value)) -} - -// Float64 returns the numeric value of this constant truncated to fit -// a float64. -// -func (c *Const) Float64() float64 { - f, _ := exact.Float64Val(c.Value) - return f -} - -// Complex128 returns the complex value of this constant truncated to -// fit a complex128. -// -func (c *Const) Complex128() complex128 { - re, _ := exact.Float64Val(exact.Real(c.Value)) - im, _ := exact.Float64Val(exact.Imag(c.Value)) - return complex(re, im) -} diff --git a/go/ssa/emit.go b/go/ssa/emit.go index 238c0706..66107621 100644 --- a/go/ssa/emit.go +++ b/go/ssa/emit.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa // Helpers for emitting SSA instructions. diff --git a/go/ssa/example_test.go b/go/ssa/example_test.go index 718817cc..31fa5613 100644 --- a/go/ssa/example_test.go +++ b/go/ssa/example_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa_test import ( diff --git a/go/ssa/func.go b/go/ssa/func.go index 88052c32..b21ff4e5 100644 --- a/go/ssa/func.go +++ b/go/ssa/func.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa // This file implements the Function and BasicBlock types. diff --git a/go/ssa/interp/external.go b/go/ssa/interp/external.go index d31d2b33..3af0d22e 100644 --- a/go/ssa/interp/external.go +++ b/go/ssa/interp/external.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package interp // Emulated functions that we cannot interpret because they are @@ -450,7 +448,7 @@ func ext۰testing۰runExample(fr *frame, args []value) value { func ext۰time۰now(fr *frame, args []value) value { nano := time.Now().UnixNano() - return tuple{int64(nano / 1e9), int32(nano % 1e9)} + return tuple{int64(nano / 1e9), int32(nano % 1e9), 0} } func ext۰time۰Sleep(fr *frame, args []value) value { diff --git a/go/ssa/interp/interp.go b/go/ssa/interp/interp.go index 8d93295f..4c8602dc 100644 --- a/go/ssa/interp/interp.go +++ b/go/ssa/interp/interp.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - // Package ssa/interp defines an interpreter for the SSA // representation of Go programs. // diff --git a/go/ssa/interp/interp_test.go b/go/ssa/interp/interp_test.go index f6226661..6e9f7b2f 100644 --- a/go/ssa/interp/interp_test.go +++ b/go/ssa/interp/interp_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - // +build linux darwin package interp_test @@ -246,7 +244,7 @@ func run(t *testing.T, dir, input string, success successPredicate) bool { var out bytes.Buffer interp.CapturedOutput = &out - hint = fmt.Sprintf("To trace execution, run:\n%% go build golang.org/x/tools/cmd/ssadump && ./ssadump -build=C -run --interp=T %s\n", input) + hint = fmt.Sprintf("To trace execution, run:\n%% go build golang.org/x/tools/cmd/ssadump && ./ssadump -build=C -test -run --interp=T %s\n", input) exitCode := interp.Interpret(mainPkg, 0, &types.StdSizes{WordSize: 8, MaxAlign: 8}, inputs[0], []string{}) // The definition of success varies with each file. diff --git a/go/ssa/interp/map.go b/go/ssa/interp/map.go index 577526fd..92ccf903 100644 --- a/go/ssa/interp/map.go +++ b/go/ssa/interp/map.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package interp // Custom hashtable atop map. diff --git a/go/ssa/interp/ops.go b/go/ssa/interp/ops.go index e37ed5f1..f3419ec4 100644 --- a/go/ssa/interp/ops.go +++ b/go/ssa/interp/ops.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package interp import ( diff --git a/go/ssa/interp/reflect.go b/go/ssa/interp/reflect.go index 688f737b..2b828996 100644 --- a/go/ssa/interp/reflect.go +++ b/go/ssa/interp/reflect.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package interp // Emulated "reflect" package. diff --git a/go/ssa/interp/value.go b/go/ssa/interp/value.go index 4f5a7050..4faa7b8f 100644 --- a/go/ssa/interp/value.go +++ b/go/ssa/interp/value.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package interp // Values diff --git a/go/ssa/lift.go b/go/ssa/lift.go index 722d086f..300f4983 100644 --- a/go/ssa/lift.go +++ b/go/ssa/lift.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa // This file defines the lifting pass which tries to "lift" Alloc diff --git a/go/ssa/lvalue.go b/go/ssa/lvalue.go index 85e090f4..4d85be3e 100644 --- a/go/ssa/lvalue.go +++ b/go/ssa/lvalue.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa // lvalues are the union of addressable expressions and map-index diff --git a/go/ssa/methods.go b/go/ssa/methods.go index 7d1fb42b..080dca96 100644 --- a/go/ssa/methods.go +++ b/go/ssa/methods.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa // This file defines utilities for population of method sets. diff --git a/go/ssa/print.go b/go/ssa/print.go index 55c92660..0c1b270b 100644 --- a/go/ssa/print.go +++ b/go/ssa/print.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa // This file implements the String() methods for all Value and diff --git a/go/ssa/sanity.go b/go/ssa/sanity.go index 4babb375..638a2c42 100644 --- a/go/ssa/sanity.go +++ b/go/ssa/sanity.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa // An optional pass for sanity-checking invariants of the SSA representation. diff --git a/go/ssa/source.go b/go/ssa/source.go index 3a6f0392..6d2223ed 100644 --- a/go/ssa/source.go +++ b/go/ssa/source.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa // This file defines utilities for working with source positions diff --git a/go/ssa/source_test.go b/go/ssa/source_test.go index 3fd7ac4a..85b55c21 100644 --- a/go/ssa/source_test.go +++ b/go/ssa/source_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa_test // This file defines tests of source-level debugging utilities. diff --git a/go/ssa/ssa.go b/go/ssa/ssa.go index c547af8a..a5a36f78 100644 --- a/go/ssa/ssa.go +++ b/go/ssa/ssa.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa // This package defines a high-level intermediate representation for diff --git a/go/ssa/ssautil/load.go b/go/ssa/ssautil/load.go index 5eb57a1a..30b8053c 100644 --- a/go/ssa/ssautil/load.go +++ b/go/ssa/ssautil/load.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssautil // This file defines utility functions for constructing programs in SSA form. diff --git a/go/ssa/ssautil/load_test.go b/go/ssa/ssautil/load_test.go index 8ce73bc2..8ccd4637 100644 --- a/go/ssa/ssautil/load_test.go +++ b/go/ssa/ssautil/load_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssautil_test import ( diff --git a/go/ssa/ssautil/switch.go b/go/ssa/ssautil/switch.go index 2fcc1672..db03bf55 100644 --- a/go/ssa/ssautil/switch.go +++ b/go/ssa/ssautil/switch.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssautil // This file implements discovery of switch and type-switch constructs diff --git a/go/ssa/testmain.go b/go/ssa/testmain.go index 2b897246..8391f26d 100644 --- a/go/ssa/testmain.go +++ b/go/ssa/testmain.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa // CreateTestMainPackage synthesizes a main package that runs all the @@ -221,6 +219,7 @@ func (deps) StartCPUProfile(io.Writer) error { return nil } func (deps) StopCPUProfile() {} func (deps) WriteHeapProfile(io.Writer) error { return nil } func (deps) WriteProfileTo(string, io.Writer, int) error { return nil } +func (deps) ImportPath() string { return "" } var match deps {{else}} diff --git a/go/ssa/util.go b/go/ssa/util.go index 317a0130..ddb11846 100644 --- a/go/ssa/util.go +++ b/go/ssa/util.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa // This file defines a number of miscellaneous utility functions. @@ -60,7 +58,7 @@ func recvType(obj *types.Func) types.Type { // // Exported to ssa/interp. // -// TODO(gri): this is a copy of go/types.defaultType; export that function. +// TODO(adonovan): use go/types.DefaultType after 1.8. // func DefaultType(typ types.Type) types.Type { if t, ok := typ.(*types.Basic); ok { diff --git a/go/ssa/wrappers.go b/go/ssa/wrappers.go index 6ca01ab3..701dd90d 100644 --- a/go/ssa/wrappers.go +++ b/go/ssa/wrappers.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package ssa // This file defines synthesis of Functions that delegate to declared diff --git a/go/types/typeutil/example_test.go b/go/types/typeutil/example_test.go index fe496446..86c4d440 100644 --- a/go/types/typeutil/example_test.go +++ b/go/types/typeutil/example_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package typeutil_test import ( diff --git a/go/types/typeutil/imports.go b/go/types/typeutil/imports.go index 4b753f4f..9c441dba 100644 --- a/go/types/typeutil/imports.go +++ b/go/types/typeutil/imports.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package typeutil import "go/types" diff --git a/go/types/typeutil/imports_test.go b/go/types/typeutil/imports_test.go index b846fbb1..c8ef6d6a 100644 --- a/go/types/typeutil/imports_test.go +++ b/go/types/typeutil/imports_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package typeutil_test import ( diff --git a/go/types/typeutil/map.go b/go/types/typeutil/map.go index 81dd556c..c7f75450 100644 --- a/go/types/typeutil/map.go +++ b/go/types/typeutil/map.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - // Package typeutil defines various utilities for types, such as Map, // a mapping from types.Type to interface{} values. package typeutil // import "golang.org/x/tools/go/types/typeutil" diff --git a/go/types/typeutil/map_test.go b/go/types/typeutil/map_test.go index e5dc4e40..34facbed 100644 --- a/go/types/typeutil/map_test.go +++ b/go/types/typeutil/map_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package typeutil_test // TODO(adonovan): diff --git a/go/types/typeutil/methodsetcache.go b/go/types/typeutil/methodsetcache.go index edc3f5b8..32084610 100644 --- a/go/types/typeutil/methodsetcache.go +++ b/go/types/typeutil/methodsetcache.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - // This file implements a cache of method sets. package typeutil diff --git a/go/types/typeutil/ui.go b/go/types/typeutil/ui.go index a9e74473..9849c24c 100644 --- a/go/types/typeutil/ui.go +++ b/go/types/typeutil/ui.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package typeutil // This file defines utilities for user interfaces that display types. diff --git a/go/types/typeutil/ui_test.go b/go/types/typeutil/ui_test.go index 4d5155eb..b5064acf 100644 --- a/go/types/typeutil/ui_test.go +++ b/go/types/typeutil/ui_test.go @@ -1,5 +1,3 @@ -// +build go1.5 - package typeutil_test import ( diff --git a/godoc/analysis/analysis.go b/godoc/analysis/analysis.go index 5ee03425..c185e5ea 100644 --- a/godoc/analysis/analysis.go +++ b/godoc/analysis/analysis.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - // Package analysis performs type and pointer analysis // and generates mark-up for the Go source view. // diff --git a/godoc/analysis/callgraph.go b/godoc/analysis/callgraph.go index 4e97061f..492022d3 100644 --- a/godoc/analysis/callgraph.go +++ b/godoc/analysis/callgraph.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package analysis // This file computes the CALLERS and CALLEES relations from the call diff --git a/godoc/analysis/implements.go b/godoc/analysis/implements.go index 1c856c37..5a295798 100644 --- a/godoc/analysis/implements.go +++ b/godoc/analysis/implements.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package analysis // This file computes the "implements" relation over all pairs of diff --git a/godoc/analysis/peers.go b/godoc/analysis/peers.go index 5b344536..a742f06c 100644 --- a/godoc/analysis/peers.go +++ b/godoc/analysis/peers.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package analysis // This file computes the channel "peers" relation over all pairs of diff --git a/godoc/analysis/typeinfo.go b/godoc/analysis/typeinfo.go index 5796a852..ad945dcf 100644 --- a/godoc/analysis/typeinfo.go +++ b/godoc/analysis/typeinfo.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package analysis // This file computes the markup for information from go/types: diff --git a/refactor/eg/eg_test.go b/refactor/eg/eg_test.go index c2599203..896bc9b0 100644 --- a/refactor/eg/eg_test.go +++ b/refactor/eg/eg_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - // No testdata on Android. // +build !android diff --git a/refactor/eg/rewrite.go b/refactor/eg/rewrite.go index d91a99cc..52084e44 100644 --- a/refactor/eg/rewrite.go +++ b/refactor/eg/rewrite.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package eg // This file defines the AST rewriting pass. diff --git a/refactor/rename/rename.go b/refactor/rename/rename.go index 3e9f797c..127647bf 100644 --- a/refactor/rename/rename.go +++ b/refactor/rename/rename.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - // Package rename contains the implementation of the 'gorename' command // whose main function is in golang.org/x/tools/cmd/gorename. // See the Usage constant for the command documentation. diff --git a/refactor/rename/spec.go b/refactor/rename/spec.go index 259404d6..cc1228c6 100644 --- a/refactor/rename/spec.go +++ b/refactor/rename/spec.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build go1.5 - package rename // This file contains logic related to specifying a renaming: parsing of