diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
index d5c41227dc..1ec29b1dc1 100644
--- a/Godeps/Godeps.json
+++ b/Godeps/Godeps.json
@@ -114,6 +114,30 @@
"ImportPath": "golang.org/x/text/transform",
"Rev": "c93e7c9fff19fb9139b5ab04ce041833add0134e"
},
+ {
+ "ImportPath": "golang.org/x/tools/go/ast/astutil",
+ "Rev": "69f53eb622e0f41d0e91debd71d6694148b52a30"
+ },
+ {
+ "ImportPath": "golang.org/x/tools/go/buildutil",
+ "Rev": "69f53eb622e0f41d0e91debd71d6694148b52a30"
+ },
+ {
+ "ImportPath": "golang.org/x/tools/go/exact",
+ "Rev": "69f53eb622e0f41d0e91debd71d6694148b52a30"
+ },
+ {
+ "ImportPath": "golang.org/x/tools/go/loader",
+ "Rev": "69f53eb622e0f41d0e91debd71d6694148b52a30"
+ },
+ {
+ "ImportPath": "golang.org/x/tools/go/types",
+ "Rev": "69f53eb622e0f41d0e91debd71d6694148b52a30"
+ },
+ {
+ "ImportPath": "golang.org/x/tools/imports",
+ "Rev": "69f53eb622e0f41d0e91debd71d6694148b52a30"
+ },
{
"ImportPath": "gopkg.in/check.v1",
"Rev": "64131543e7896d5bcc6bd5a76287eb75ea96c673"
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/enclosing.go b/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/enclosing.go
new file mode 100644
index 0000000000..2de739efad
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/enclosing.go
@@ -0,0 +1,625 @@
+// 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.
+
+package astutil
+
+// This file defines utilities for working with source positions.
+
+import (
+ "fmt"
+ "go/ast"
+ "go/token"
+ "sort"
+)
+
+// PathEnclosingInterval returns the node that encloses the source
+// interval [start, end), and all its ancestors up to the AST root.
+//
+// The definition of "enclosing" used by this function considers
+// additional whitespace abutting a node to be enclosed by it.
+// In this example:
+//
+// z := x + y // add them
+// <-A->
+// <----B----->
+//
+// the ast.BinaryExpr(+) node is considered to enclose interval B
+// even though its [Pos()..End()) is actually only interval A.
+// This behaviour makes user interfaces more tolerant of imperfect
+// input.
+//
+// This function treats tokens as nodes, though they are not included
+// in the result. e.g. PathEnclosingInterval("+") returns the
+// enclosing ast.BinaryExpr("x + y").
+//
+// If start==end, the 1-char interval following start is used instead.
+//
+// The 'exact' result is true if the interval contains only path[0]
+// and perhaps some adjacent whitespace. It is false if the interval
+// overlaps multiple children of path[0], or if it contains only
+// interior whitespace of path[0].
+// In this example:
+//
+// z := x + y // add them
+// <--C--> <---E-->
+// ^
+// D
+//
+// intervals C, D and E are inexact. C is contained by the
+// z-assignment statement, because it spans three of its children (:=,
+// x, +). So too is the 1-char interval D, because it contains only
+// interior whitespace of the assignment. E is considered interior
+// whitespace of the BlockStmt containing the assignment.
+//
+// Precondition: [start, end) both lie within the same file as root.
+// TODO(adonovan): return (nil, false) in this case and remove precond.
+// Requires FileSet; see loader.tokenFileContainsPos.
+//
+// Postcondition: path is never nil; it always contains at least 'root'.
+//
+func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Node, exact bool) {
+ // fmt.Printf("EnclosingInterval %d %d\n", start, end) // debugging
+
+ // Precondition: node.[Pos..End) and adjoining whitespace contain [start, end).
+ var visit func(node ast.Node) bool
+ visit = func(node ast.Node) bool {
+ path = append(path, node)
+
+ nodePos := node.Pos()
+ nodeEnd := node.End()
+
+ // fmt.Printf("visit(%T, %d, %d)\n", node, nodePos, nodeEnd) // debugging
+
+ // Intersect [start, end) with interval of node.
+ if start < nodePos {
+ start = nodePos
+ }
+ if end > nodeEnd {
+ end = nodeEnd
+ }
+
+ // Find sole child that contains [start, end).
+ children := childrenOf(node)
+ l := len(children)
+ for i, child := range children {
+ // [childPos, childEnd) is unaugmented interval of child.
+ childPos := child.Pos()
+ childEnd := child.End()
+
+ // [augPos, augEnd) is whitespace-augmented interval of child.
+ augPos := childPos
+ augEnd := childEnd
+ if i > 0 {
+ augPos = children[i-1].End() // start of preceding whitespace
+ }
+ if i < l-1 {
+ nextChildPos := children[i+1].Pos()
+ // Does [start, end) lie between child and next child?
+ if start >= augEnd && end <= nextChildPos {
+ return false // inexact match
+ }
+ augEnd = nextChildPos // end of following whitespace
+ }
+
+ // fmt.Printf("\tchild %d: [%d..%d)\tcontains interval [%d..%d)?\n",
+ // i, augPos, augEnd, start, end) // debugging
+
+ // Does augmented child strictly contain [start, end)?
+ if augPos <= start && end <= augEnd {
+ _, isToken := child.(tokenNode)
+ return isToken || visit(child)
+ }
+
+ // Does [start, end) overlap multiple children?
+ // i.e. left-augmented child contains start
+ // but LR-augmented child does not contain end.
+ if start < childEnd && end > augEnd {
+ break
+ }
+ }
+
+ // No single child contained [start, end),
+ // so node is the result. Is it exact?
+
+ // (It's tempting to put this condition before the
+ // child loop, but it gives the wrong result in the
+ // case where a node (e.g. ExprStmt) and its sole
+ // child have equal intervals.)
+ if start == nodePos && end == nodeEnd {
+ return true // exact match
+ }
+
+ return false // inexact: overlaps multiple children
+ }
+
+ if start > end {
+ start, end = end, start
+ }
+
+ if start < root.End() && end > root.Pos() {
+ if start == end {
+ end = start + 1 // empty interval => interval of size 1
+ }
+ exact = visit(root)
+
+ // Reverse the path:
+ for i, l := 0, len(path); i < l/2; i++ {
+ path[i], path[l-1-i] = path[l-1-i], path[i]
+ }
+ } else {
+ // Selection lies within whitespace preceding the
+ // first (or following the last) declaration in the file.
+ // The result nonetheless always includes the ast.File.
+ path = append(path, root)
+ }
+
+ return
+}
+
+// tokenNode is a dummy implementation of ast.Node for a single token.
+// They are used transiently by PathEnclosingInterval but never escape
+// this package.
+//
+type tokenNode struct {
+ pos token.Pos
+ end token.Pos
+}
+
+func (n tokenNode) Pos() token.Pos {
+ return n.pos
+}
+
+func (n tokenNode) End() token.Pos {
+ return n.end
+}
+
+func tok(pos token.Pos, len int) ast.Node {
+ return tokenNode{pos, pos + token.Pos(len)}
+}
+
+// childrenOf returns the direct non-nil children of ast.Node n.
+// It may include fake ast.Node implementations for bare tokens.
+// it is not safe to call (e.g.) ast.Walk on such nodes.
+//
+func childrenOf(n ast.Node) []ast.Node {
+ var children []ast.Node
+
+ // First add nodes for all true subtrees.
+ ast.Inspect(n, func(node ast.Node) bool {
+ if node == n { // push n
+ return true // recur
+ }
+ if node != nil { // push child
+ children = append(children, node)
+ }
+ return false // no recursion
+ })
+
+ // Then add fake Nodes for bare tokens.
+ switch n := n.(type) {
+ case *ast.ArrayType:
+ children = append(children,
+ tok(n.Lbrack, len("[")),
+ tok(n.Elt.End(), len("]")))
+
+ case *ast.AssignStmt:
+ children = append(children,
+ tok(n.TokPos, len(n.Tok.String())))
+
+ case *ast.BasicLit:
+ children = append(children,
+ tok(n.ValuePos, len(n.Value)))
+
+ case *ast.BinaryExpr:
+ children = append(children, tok(n.OpPos, len(n.Op.String())))
+
+ case *ast.BlockStmt:
+ children = append(children,
+ tok(n.Lbrace, len("{")),
+ tok(n.Rbrace, len("}")))
+
+ case *ast.BranchStmt:
+ children = append(children,
+ tok(n.TokPos, len(n.Tok.String())))
+
+ case *ast.CallExpr:
+ children = append(children,
+ tok(n.Lparen, len("(")),
+ tok(n.Rparen, len(")")))
+ if n.Ellipsis != 0 {
+ children = append(children, tok(n.Ellipsis, len("...")))
+ }
+
+ case *ast.CaseClause:
+ if n.List == nil {
+ children = append(children,
+ tok(n.Case, len("default")))
+ } else {
+ children = append(children,
+ tok(n.Case, len("case")))
+ }
+ children = append(children, tok(n.Colon, len(":")))
+
+ case *ast.ChanType:
+ switch n.Dir {
+ case ast.RECV:
+ children = append(children, tok(n.Begin, len("<-chan")))
+ case ast.SEND:
+ children = append(children, tok(n.Begin, len("chan<-")))
+ case ast.RECV | ast.SEND:
+ children = append(children, tok(n.Begin, len("chan")))
+ }
+
+ case *ast.CommClause:
+ if n.Comm == nil {
+ children = append(children,
+ tok(n.Case, len("default")))
+ } else {
+ children = append(children,
+ tok(n.Case, len("case")))
+ }
+ children = append(children, tok(n.Colon, len(":")))
+
+ case *ast.Comment:
+ // nop
+
+ case *ast.CommentGroup:
+ // nop
+
+ case *ast.CompositeLit:
+ children = append(children,
+ tok(n.Lbrace, len("{")),
+ tok(n.Rbrace, len("{")))
+
+ case *ast.DeclStmt:
+ // nop
+
+ case *ast.DeferStmt:
+ children = append(children,
+ tok(n.Defer, len("defer")))
+
+ case *ast.Ellipsis:
+ children = append(children,
+ tok(n.Ellipsis, len("...")))
+
+ case *ast.EmptyStmt:
+ // nop
+
+ case *ast.ExprStmt:
+ // nop
+
+ case *ast.Field:
+ // TODO(adonovan): Field.{Doc,Comment,Tag}?
+
+ case *ast.FieldList:
+ children = append(children,
+ tok(n.Opening, len("(")),
+ tok(n.Closing, len(")")))
+
+ case *ast.File:
+ // TODO test: Doc
+ children = append(children,
+ tok(n.Package, len("package")))
+
+ case *ast.ForStmt:
+ children = append(children,
+ tok(n.For, len("for")))
+
+ case *ast.FuncDecl:
+ // TODO(adonovan): FuncDecl.Comment?
+
+ // Uniquely, FuncDecl breaks the invariant that
+ // preorder traversal yields tokens in lexical order:
+ // in fact, FuncDecl.Recv precedes FuncDecl.Type.Func.
+ //
+ // As a workaround, we inline the case for FuncType
+ // here and order things correctly.
+ //
+ children = nil // discard ast.Walk(FuncDecl) info subtrees
+ children = append(children, tok(n.Type.Func, len("func")))
+ if n.Recv != nil {
+ children = append(children, n.Recv)
+ }
+ children = append(children, n.Name)
+ if n.Type.Params != nil {
+ children = append(children, n.Type.Params)
+ }
+ if n.Type.Results != nil {
+ children = append(children, n.Type.Results)
+ }
+ if n.Body != nil {
+ children = append(children, n.Body)
+ }
+
+ case *ast.FuncLit:
+ // nop
+
+ case *ast.FuncType:
+ if n.Func != 0 {
+ children = append(children,
+ tok(n.Func, len("func")))
+ }
+
+ case *ast.GenDecl:
+ children = append(children,
+ tok(n.TokPos, len(n.Tok.String())))
+ if n.Lparen != 0 {
+ children = append(children,
+ tok(n.Lparen, len("(")),
+ tok(n.Rparen, len(")")))
+ }
+
+ case *ast.GoStmt:
+ children = append(children,
+ tok(n.Go, len("go")))
+
+ case *ast.Ident:
+ children = append(children,
+ tok(n.NamePos, len(n.Name)))
+
+ case *ast.IfStmt:
+ children = append(children,
+ tok(n.If, len("if")))
+
+ case *ast.ImportSpec:
+ // TODO(adonovan): ImportSpec.{Doc,EndPos}?
+
+ case *ast.IncDecStmt:
+ children = append(children,
+ tok(n.TokPos, len(n.Tok.String())))
+
+ case *ast.IndexExpr:
+ children = append(children,
+ tok(n.Lbrack, len("{")),
+ tok(n.Rbrack, len("}")))
+
+ case *ast.InterfaceType:
+ children = append(children,
+ tok(n.Interface, len("interface")))
+
+ case *ast.KeyValueExpr:
+ children = append(children,
+ tok(n.Colon, len(":")))
+
+ case *ast.LabeledStmt:
+ children = append(children,
+ tok(n.Colon, len(":")))
+
+ case *ast.MapType:
+ children = append(children,
+ tok(n.Map, len("map")))
+
+ case *ast.ParenExpr:
+ children = append(children,
+ tok(n.Lparen, len("(")),
+ tok(n.Rparen, len(")")))
+
+ case *ast.RangeStmt:
+ children = append(children,
+ tok(n.For, len("for")),
+ tok(n.TokPos, len(n.Tok.String())))
+
+ case *ast.ReturnStmt:
+ children = append(children,
+ tok(n.Return, len("return")))
+
+ case *ast.SelectStmt:
+ children = append(children,
+ tok(n.Select, len("select")))
+
+ case *ast.SelectorExpr:
+ // nop
+
+ case *ast.SendStmt:
+ children = append(children,
+ tok(n.Arrow, len("<-")))
+
+ case *ast.SliceExpr:
+ children = append(children,
+ tok(n.Lbrack, len("[")),
+ tok(n.Rbrack, len("]")))
+
+ case *ast.StarExpr:
+ children = append(children, tok(n.Star, len("*")))
+
+ case *ast.StructType:
+ children = append(children, tok(n.Struct, len("struct")))
+
+ case *ast.SwitchStmt:
+ children = append(children, tok(n.Switch, len("switch")))
+
+ case *ast.TypeAssertExpr:
+ children = append(children,
+ tok(n.Lparen-1, len(".")),
+ tok(n.Lparen, len("(")),
+ tok(n.Rparen, len(")")))
+
+ case *ast.TypeSpec:
+ // TODO(adonovan): TypeSpec.{Doc,Comment}?
+
+ case *ast.TypeSwitchStmt:
+ children = append(children, tok(n.Switch, len("switch")))
+
+ case *ast.UnaryExpr:
+ children = append(children, tok(n.OpPos, len(n.Op.String())))
+
+ case *ast.ValueSpec:
+ // TODO(adonovan): ValueSpec.{Doc,Comment}?
+
+ default:
+ // Includes *ast.BadDecl, *ast.BadExpr, *ast.BadStmt.
+ panic(fmt.Sprintf("unexpected node type %T", n))
+ }
+
+ // TODO(adonovan): opt: merge the logic of ast.Inspect() into
+ // the switch above so we can make interleaved callbacks for
+ // both Nodes and Tokens in the right order and avoid the need
+ // to sort.
+ sort.Sort(byPos(children))
+
+ return children
+}
+
+type byPos []ast.Node
+
+func (sl byPos) Len() int {
+ return len(sl)
+}
+func (sl byPos) Less(i, j int) bool {
+ return sl[i].Pos() < sl[j].Pos()
+}
+func (sl byPos) Swap(i, j int) {
+ sl[i], sl[j] = sl[j], sl[i]
+}
+
+// NodeDescription returns a description of the concrete type of n suitable
+// for a user interface.
+//
+// TODO(adonovan): in some cases (e.g. Field, FieldList, Ident,
+// StarExpr) we could be much more specific given the path to the AST
+// root. Perhaps we should do that.
+//
+func NodeDescription(n ast.Node) string {
+ switch n := n.(type) {
+ case *ast.ArrayType:
+ return "array type"
+ case *ast.AssignStmt:
+ return "assignment"
+ case *ast.BadDecl:
+ return "bad declaration"
+ case *ast.BadExpr:
+ return "bad expression"
+ case *ast.BadStmt:
+ return "bad statement"
+ case *ast.BasicLit:
+ return "basic literal"
+ case *ast.BinaryExpr:
+ return fmt.Sprintf("binary %s operation", n.Op)
+ case *ast.BlockStmt:
+ return "block"
+ case *ast.BranchStmt:
+ switch n.Tok {
+ case token.BREAK:
+ return "break statement"
+ case token.CONTINUE:
+ return "continue statement"
+ case token.GOTO:
+ return "goto statement"
+ case token.FALLTHROUGH:
+ return "fall-through statement"
+ }
+ case *ast.CallExpr:
+ return "function call (or conversion)"
+ case *ast.CaseClause:
+ return "case clause"
+ case *ast.ChanType:
+ return "channel type"
+ case *ast.CommClause:
+ return "communication clause"
+ case *ast.Comment:
+ return "comment"
+ case *ast.CommentGroup:
+ return "comment group"
+ case *ast.CompositeLit:
+ return "composite literal"
+ case *ast.DeclStmt:
+ return NodeDescription(n.Decl) + " statement"
+ case *ast.DeferStmt:
+ return "defer statement"
+ case *ast.Ellipsis:
+ return "ellipsis"
+ case *ast.EmptyStmt:
+ return "empty statement"
+ case *ast.ExprStmt:
+ return "expression statement"
+ case *ast.Field:
+ // Can be any of these:
+ // struct {x, y int} -- struct field(s)
+ // struct {T} -- anon struct field
+ // interface {I} -- interface embedding
+ // interface {f()} -- interface method
+ // func (A) func(B) C -- receiver, param(s), result(s)
+ return "field/method/parameter"
+ case *ast.FieldList:
+ return "field/method/parameter list"
+ case *ast.File:
+ return "source file"
+ case *ast.ForStmt:
+ return "for loop"
+ case *ast.FuncDecl:
+ return "function declaration"
+ case *ast.FuncLit:
+ return "function literal"
+ case *ast.FuncType:
+ return "function type"
+ case *ast.GenDecl:
+ switch n.Tok {
+ case token.IMPORT:
+ return "import declaration"
+ case token.CONST:
+ return "constant declaration"
+ case token.TYPE:
+ return "type declaration"
+ case token.VAR:
+ return "variable declaration"
+ }
+ case *ast.GoStmt:
+ return "go statement"
+ case *ast.Ident:
+ return "identifier"
+ case *ast.IfStmt:
+ return "if statement"
+ case *ast.ImportSpec:
+ return "import specification"
+ case *ast.IncDecStmt:
+ if n.Tok == token.INC {
+ return "increment statement"
+ }
+ return "decrement statement"
+ case *ast.IndexExpr:
+ return "index expression"
+ case *ast.InterfaceType:
+ return "interface type"
+ case *ast.KeyValueExpr:
+ return "key/value association"
+ case *ast.LabeledStmt:
+ return "statement label"
+ case *ast.MapType:
+ return "map type"
+ case *ast.Package:
+ return "package"
+ case *ast.ParenExpr:
+ return "parenthesized " + NodeDescription(n.X)
+ case *ast.RangeStmt:
+ return "range loop"
+ case *ast.ReturnStmt:
+ return "return statement"
+ case *ast.SelectStmt:
+ return "select statement"
+ case *ast.SelectorExpr:
+ return "selector"
+ case *ast.SendStmt:
+ return "channel send"
+ case *ast.SliceExpr:
+ return "slice expression"
+ case *ast.StarExpr:
+ return "*-operation" // load/store expr or pointer type
+ case *ast.StructType:
+ return "struct type"
+ case *ast.SwitchStmt:
+ return "switch statement"
+ case *ast.TypeAssertExpr:
+ return "type assertion"
+ case *ast.TypeSpec:
+ return "type specification"
+ case *ast.TypeSwitchStmt:
+ return "type switch"
+ case *ast.UnaryExpr:
+ return fmt.Sprintf("unary %s operation", n.Op)
+ case *ast.ValueSpec:
+ return "value specification"
+
+ }
+ panic(fmt.Sprintf("unexpected node type: %T", n))
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/enclosing_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/enclosing_test.go
new file mode 100644
index 0000000000..107f87c55c
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/enclosing_test.go
@@ -0,0 +1,195 @@
+// 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.
+
+package astutil_test
+
+// This file defines tests of PathEnclosingInterval.
+
+// TODO(adonovan): exhaustive tests that run over the whole input
+// tree, not just handcrafted examples.
+
+import (
+ "bytes"
+ "fmt"
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "strings"
+ "testing"
+
+ "golang.org/x/tools/go/ast/astutil"
+)
+
+// pathToString returns a string containing the concrete types of the
+// nodes in path.
+func pathToString(path []ast.Node) string {
+ var buf bytes.Buffer
+ fmt.Fprint(&buf, "[")
+ for i, n := range path {
+ if i > 0 {
+ fmt.Fprint(&buf, " ")
+ }
+ fmt.Fprint(&buf, strings.TrimPrefix(fmt.Sprintf("%T", n), "*ast."))
+ }
+ fmt.Fprint(&buf, "]")
+ return buf.String()
+}
+
+// findInterval parses input and returns the [start, end) positions of
+// the first occurrence of substr in input. f==nil indicates failure;
+// an error has already been reported in that case.
+//
+func findInterval(t *testing.T, fset *token.FileSet, input, substr string) (f *ast.File, start, end token.Pos) {
+ f, err := parser.ParseFile(fset, "", input, 0)
+ if err != nil {
+ t.Errorf("parse error: %s", err)
+ return
+ }
+
+ i := strings.Index(input, substr)
+ if i < 0 {
+ t.Errorf("%q is not a substring of input", substr)
+ f = nil
+ return
+ }
+
+ filePos := fset.File(f.Package)
+ return f, filePos.Pos(i), filePos.Pos(i + len(substr))
+}
+
+// Common input for following tests.
+const input = `
+// Hello.
+package main
+import "fmt"
+func f() {}
+func main() {
+ z := (x + y) // add them
+ f() // NB: ExprStmt and its CallExpr have same Pos/End
+}
+`
+
+func TestPathEnclosingInterval_Exact(t *testing.T) {
+ // For the exact tests, we check that a substring is mapped to
+ // the canonical string for the node it denotes.
+ tests := []struct {
+ substr string // first occurrence of this string indicates interval
+ node string // complete text of expected containing node
+ }{
+ {"package",
+ input[11 : len(input)-1]},
+ {"\npack",
+ input[11 : len(input)-1]},
+ {"main",
+ "main"},
+ {"import",
+ "import \"fmt\""},
+ {"\"fmt\"",
+ "\"fmt\""},
+ {"\nfunc f() {}\n",
+ "func f() {}"},
+ {"x ",
+ "x"},
+ {" y",
+ "y"},
+ {"z",
+ "z"},
+ {" + ",
+ "x + y"},
+ {" :=",
+ "z := (x + y)"},
+ {"x + y",
+ "x + y"},
+ {"(x + y)",
+ "(x + y)"},
+ {" (x + y) ",
+ "(x + y)"},
+ {" (x + y) // add",
+ "(x + y)"},
+ {"func",
+ "func f() {}"},
+ {"func f() {}",
+ "func f() {}"},
+ {"\nfun",
+ "func f() {}"},
+ {" f",
+ "f"},
+ }
+ for _, test := range tests {
+ f, start, end := findInterval(t, new(token.FileSet), input, test.substr)
+ if f == nil {
+ continue
+ }
+
+ path, exact := astutil.PathEnclosingInterval(f, start, end)
+ if !exact {
+ t.Errorf("PathEnclosingInterval(%q) not exact", test.substr)
+ continue
+ }
+
+ if len(path) == 0 {
+ if test.node != "" {
+ t.Errorf("PathEnclosingInterval(%q).path: got [], want %q",
+ test.substr, test.node)
+ }
+ continue
+ }
+
+ if got := input[path[0].Pos():path[0].End()]; got != test.node {
+ t.Errorf("PathEnclosingInterval(%q): got %q, want %q (path was %s)",
+ test.substr, got, test.node, pathToString(path))
+ continue
+ }
+ }
+}
+
+func TestPathEnclosingInterval_Paths(t *testing.T) {
+ // For these tests, we check only the path of the enclosing
+ // node, but not its complete text because it's often quite
+ // large when !exact.
+ tests := []struct {
+ substr string // first occurrence of this string indicates interval
+ path string // the pathToString(),exact of the expected path
+ }{
+ {"// add",
+ "[BlockStmt FuncDecl File],false"},
+ {"(x + y",
+ "[ParenExpr AssignStmt BlockStmt FuncDecl File],false"},
+ {"x +",
+ "[BinaryExpr ParenExpr AssignStmt BlockStmt FuncDecl File],false"},
+ {"z := (x",
+ "[AssignStmt BlockStmt FuncDecl File],false"},
+ {"func f",
+ "[FuncDecl File],false"},
+ {"func f()",
+ "[FuncDecl File],false"},
+ {" f()",
+ "[FuncDecl File],false"},
+ {"() {}",
+ "[FuncDecl File],false"},
+ {"// Hello",
+ "[File],false"},
+ {" f",
+ "[Ident FuncDecl File],true"},
+ {"func ",
+ "[FuncDecl File],true"},
+ {"mai",
+ "[Ident File],true"},
+ {"f() // NB",
+ "[CallExpr ExprStmt BlockStmt FuncDecl File],true"},
+ }
+ for _, test := range tests {
+ f, start, end := findInterval(t, new(token.FileSet), input, test.substr)
+ if f == nil {
+ continue
+ }
+
+ path, exact := astutil.PathEnclosingInterval(f, start, end)
+ if got := fmt.Sprintf("%s,%v", pathToString(path), exact); got != test.path {
+ t.Errorf("PathEnclosingInterval(%q): got %q, want %q",
+ test.substr, got, test.path)
+ continue
+ }
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/imports.go b/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/imports.go
new file mode 100644
index 0000000000..29d6d36e5f
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/imports.go
@@ -0,0 +1,359 @@
+// 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.
+
+// Package astutil contains common utilities for working with the Go AST.
+package astutil
+
+import (
+ "fmt"
+ "go/ast"
+ "go/token"
+ "strconv"
+ "strings"
+)
+
+// AddImport adds the import path to the file f, if absent.
+func AddImport(fset *token.FileSet, f *ast.File, ipath string) (added bool) {
+ return AddNamedImport(fset, f, "", ipath)
+}
+
+// AddNamedImport adds the import path to the file f, if absent.
+// If name is not empty, it is used to rename the import.
+//
+// For example, calling
+// AddNamedImport(fset, f, "pathpkg", "path")
+// adds
+// import pathpkg "path"
+func AddNamedImport(fset *token.FileSet, f *ast.File, name, ipath string) (added bool) {
+ if imports(f, ipath) {
+ return false
+ }
+
+ newImport := &ast.ImportSpec{
+ Path: &ast.BasicLit{
+ Kind: token.STRING,
+ Value: strconv.Quote(ipath),
+ },
+ }
+ if name != "" {
+ newImport.Name = &ast.Ident{Name: name}
+ }
+
+ // Find an import decl to add to.
+ // The goal is to find an existing import
+ // whose import path has the longest shared
+ // prefix with ipath.
+ var (
+ bestMatch = -1 // length of longest shared prefix
+ lastImport = -1 // index in f.Decls of the file's final import decl
+ impDecl *ast.GenDecl // import decl containing the best match
+ impIndex = -1 // spec index in impDecl containing the best match
+ )
+ for i, decl := range f.Decls {
+ gen, ok := decl.(*ast.GenDecl)
+ if ok && gen.Tok == token.IMPORT {
+ lastImport = i
+ // Do not add to import "C", to avoid disrupting the
+ // association with its doc comment, breaking cgo.
+ if declImports(gen, "C") {
+ continue
+ }
+
+ // Match an empty import decl if that's all that is available.
+ if len(gen.Specs) == 0 && bestMatch == -1 {
+ impDecl = gen
+ }
+
+ // Compute longest shared prefix with imports in this group.
+ for j, spec := range gen.Specs {
+ impspec := spec.(*ast.ImportSpec)
+ n := matchLen(importPath(impspec), ipath)
+ if n > bestMatch {
+ bestMatch = n
+ impDecl = gen
+ impIndex = j
+ }
+ }
+ }
+ }
+
+ // If no import decl found, add one after the last import.
+ if impDecl == nil {
+ impDecl = &ast.GenDecl{
+ Tok: token.IMPORT,
+ }
+ if lastImport >= 0 {
+ impDecl.TokPos = f.Decls[lastImport].End()
+ } else {
+ // There are no existing imports.
+ // Our new import goes after the package declaration and after
+ // the comment, if any, that starts on the same line as the
+ // package declaration.
+ impDecl.TokPos = f.Package
+
+ file := fset.File(f.Package)
+ pkgLine := file.Line(f.Package)
+ for _, c := range f.Comments {
+ if file.Line(c.Pos()) > pkgLine {
+ break
+ }
+ impDecl.TokPos = c.End()
+ }
+ }
+ f.Decls = append(f.Decls, nil)
+ copy(f.Decls[lastImport+2:], f.Decls[lastImport+1:])
+ f.Decls[lastImport+1] = impDecl
+ }
+
+ // Insert new import at insertAt.
+ insertAt := 0
+ if impIndex >= 0 {
+ // insert after the found import
+ insertAt = impIndex + 1
+ }
+ impDecl.Specs = append(impDecl.Specs, nil)
+ copy(impDecl.Specs[insertAt+1:], impDecl.Specs[insertAt:])
+ impDecl.Specs[insertAt] = newImport
+ pos := impDecl.Pos()
+ if insertAt > 0 {
+ // Assign same position as the previous import,
+ // so that the sorter sees it as being in the same block.
+ pos = impDecl.Specs[insertAt-1].Pos()
+ }
+ if newImport.Name != nil {
+ newImport.Name.NamePos = pos
+ }
+ newImport.Path.ValuePos = pos
+ newImport.EndPos = pos
+
+ // Clean up parens. impDecl contains at least one spec.
+ if len(impDecl.Specs) == 1 {
+ // Remove unneeded parens.
+ impDecl.Lparen = token.NoPos
+ } else if !impDecl.Lparen.IsValid() {
+ // impDecl needs parens added.
+ impDecl.Lparen = impDecl.Specs[0].Pos()
+ }
+
+ f.Imports = append(f.Imports, newImport)
+ return true
+}
+
+// DeleteImport deletes the import path from the file f, if present.
+func DeleteImport(fset *token.FileSet, f *ast.File, path string) (deleted bool) {
+ var delspecs []*ast.ImportSpec
+
+ // Find the import nodes that import path, if any.
+ for i := 0; i < len(f.Decls); i++ {
+ decl := f.Decls[i]
+ gen, ok := decl.(*ast.GenDecl)
+ if !ok || gen.Tok != token.IMPORT {
+ continue
+ }
+ for j := 0; j < len(gen.Specs); j++ {
+ spec := gen.Specs[j]
+ impspec := spec.(*ast.ImportSpec)
+ if importPath(impspec) != path {
+ continue
+ }
+
+ // We found an import spec that imports path.
+ // Delete it.
+ delspecs = append(delspecs, impspec)
+ deleted = true
+ copy(gen.Specs[j:], gen.Specs[j+1:])
+ gen.Specs = gen.Specs[:len(gen.Specs)-1]
+
+ // If this was the last import spec in this decl,
+ // delete the decl, too.
+ if len(gen.Specs) == 0 {
+ copy(f.Decls[i:], f.Decls[i+1:])
+ f.Decls = f.Decls[:len(f.Decls)-1]
+ i--
+ break
+ } else if len(gen.Specs) == 1 {
+ gen.Lparen = token.NoPos // drop parens
+ }
+ if j > 0 {
+ lastImpspec := gen.Specs[j-1].(*ast.ImportSpec)
+ lastLine := fset.Position(lastImpspec.Path.ValuePos).Line
+ line := fset.Position(impspec.Path.ValuePos).Line
+
+ // We deleted an entry but now there may be
+ // a blank line-sized hole where the import was.
+ if line-lastLine > 1 {
+ // There was a blank line immediately preceding the deleted import,
+ // so there's no need to close the hole.
+ // Do nothing.
+ } else {
+ // There was no blank line. Close the hole.
+ fset.File(gen.Rparen).MergeLine(line)
+ }
+ }
+ j--
+ }
+ }
+
+ // Delete them from f.Imports.
+ for i := 0; i < len(f.Imports); i++ {
+ imp := f.Imports[i]
+ for j, del := range delspecs {
+ if imp == del {
+ copy(f.Imports[i:], f.Imports[i+1:])
+ f.Imports = f.Imports[:len(f.Imports)-1]
+ copy(delspecs[j:], delspecs[j+1:])
+ delspecs = delspecs[:len(delspecs)-1]
+ i--
+ break
+ }
+ }
+ }
+
+ if len(delspecs) > 0 {
+ panic(fmt.Sprintf("deleted specs from Decls but not Imports: %v", delspecs))
+ }
+
+ return
+}
+
+// RewriteImport rewrites any import of path oldPath to path newPath.
+func RewriteImport(fset *token.FileSet, f *ast.File, oldPath, newPath string) (rewrote bool) {
+ for _, imp := range f.Imports {
+ if importPath(imp) == oldPath {
+ rewrote = true
+ // record old End, because the default is to compute
+ // it using the length of imp.Path.Value.
+ imp.EndPos = imp.End()
+ imp.Path.Value = strconv.Quote(newPath)
+ }
+ }
+ return
+}
+
+// UsesImport reports whether a given import is used.
+func UsesImport(f *ast.File, path string) (used bool) {
+ spec := importSpec(f, path)
+ if spec == nil {
+ return
+ }
+
+ name := spec.Name.String()
+ switch name {
+ case "":
+ // If the package name is not explicitly specified,
+ // make an educated guess. This is not guaranteed to be correct.
+ lastSlash := strings.LastIndex(path, "/")
+ if lastSlash == -1 {
+ name = path
+ } else {
+ name = path[lastSlash+1:]
+ }
+ case "_", ".":
+ // Not sure if this import is used - err on the side of caution.
+ return true
+ }
+
+ ast.Walk(visitFn(func(n ast.Node) {
+ sel, ok := n.(*ast.SelectorExpr)
+ if ok && isTopName(sel.X, name) {
+ used = true
+ }
+ }), f)
+
+ return
+}
+
+type visitFn func(node ast.Node)
+
+func (fn visitFn) Visit(node ast.Node) ast.Visitor {
+ fn(node)
+ return fn
+}
+
+// imports returns true if f imports path.
+func imports(f *ast.File, path string) bool {
+ return importSpec(f, path) != nil
+}
+
+// importSpec returns the import spec if f imports path,
+// or nil otherwise.
+func importSpec(f *ast.File, path string) *ast.ImportSpec {
+ for _, s := range f.Imports {
+ if importPath(s) == path {
+ return s
+ }
+ }
+ return nil
+}
+
+// importPath returns the unquoted import path of s,
+// or "" if the path is not properly quoted.
+func importPath(s *ast.ImportSpec) string {
+ t, err := strconv.Unquote(s.Path.Value)
+ if err == nil {
+ return t
+ }
+ return ""
+}
+
+// declImports reports whether gen contains an import of path.
+func declImports(gen *ast.GenDecl, path string) bool {
+ if gen.Tok != token.IMPORT {
+ return false
+ }
+ for _, spec := range gen.Specs {
+ impspec := spec.(*ast.ImportSpec)
+ if importPath(impspec) == path {
+ return true
+ }
+ }
+ return false
+}
+
+// matchLen returns the length of the longest path segment prefix shared by x and y.
+func matchLen(x, y string) int {
+ n := 0
+ for i := 0; i < len(x) && i < len(y) && x[i] == y[i]; i++ {
+ if x[i] == '/' {
+ n++
+ }
+ }
+ return n
+}
+
+// isTopName returns true if n is a top-level unresolved identifier with the given name.
+func isTopName(n ast.Expr, name string) bool {
+ id, ok := n.(*ast.Ident)
+ return ok && id.Name == name && id.Obj == nil
+}
+
+// Imports returns the file imports grouped by paragraph.
+func Imports(fset *token.FileSet, f *ast.File) [][]*ast.ImportSpec {
+ var groups [][]*ast.ImportSpec
+
+ for _, decl := range f.Decls {
+ genDecl, ok := decl.(*ast.GenDecl)
+ if !ok || genDecl.Tok != token.IMPORT {
+ break
+ }
+
+ group := []*ast.ImportSpec{}
+
+ var lastLine int
+ for _, spec := range genDecl.Specs {
+ importSpec := spec.(*ast.ImportSpec)
+ pos := importSpec.Path.ValuePos
+ line := fset.Position(pos).Line
+ if lastLine > 0 && pos > 0 && line-lastLine > 1 {
+ groups = append(groups, group)
+ group = []*ast.ImportSpec{}
+ }
+ group = append(group, importSpec)
+ lastLine = line
+ }
+ groups = append(groups, group)
+ }
+
+ return groups
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/imports_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/imports_test.go
new file mode 100644
index 0000000000..9134b193c4
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/imports_test.go
@@ -0,0 +1,946 @@
+// 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.
+
+package astutil
+
+import (
+ "bytes"
+ "go/ast"
+ "go/format"
+ "go/parser"
+ "go/token"
+ "reflect"
+ "strconv"
+ "testing"
+)
+
+var fset = token.NewFileSet()
+
+func parse(t *testing.T, name, in string) *ast.File {
+ file, err := parser.ParseFile(fset, name, in, parser.ParseComments)
+ if err != nil {
+ t.Fatalf("%s parse: %v", name, err)
+ }
+ return file
+}
+
+func print(t *testing.T, name string, f *ast.File) string {
+ var buf bytes.Buffer
+ if err := format.Node(&buf, fset, f); err != nil {
+ t.Fatalf("%s gofmt: %v", name, err)
+ }
+ return string(buf.Bytes())
+}
+
+type test struct {
+ name string
+ renamedPkg string
+ pkg string
+ in string
+ out string
+ broken bool // known broken
+}
+
+var addTests = []test{
+ {
+ name: "leave os alone",
+ pkg: "os",
+ in: `package main
+
+import (
+ "os"
+)
+`,
+ out: `package main
+
+import (
+ "os"
+)
+`,
+ },
+ {
+ name: "import.1",
+ pkg: "os",
+ in: `package main
+`,
+ out: `package main
+
+import "os"
+`,
+ },
+ {
+ name: "import.2",
+ pkg: "os",
+ in: `package main
+
+// Comment
+import "C"
+`,
+ out: `package main
+
+// Comment
+import "C"
+import "os"
+`,
+ },
+ {
+ name: "import.3",
+ pkg: "os",
+ in: `package main
+
+// Comment
+import "C"
+
+import (
+ "io"
+ "utf8"
+)
+`,
+ out: `package main
+
+// Comment
+import "C"
+
+import (
+ "io"
+ "os"
+ "utf8"
+)
+`,
+ },
+ {
+ name: "import.17",
+ pkg: "x/y/z",
+ in: `package main
+
+// Comment
+import "C"
+
+import (
+ "a"
+ "b"
+
+ "x/w"
+
+ "d/f"
+)
+`,
+ out: `package main
+
+// Comment
+import "C"
+
+import (
+ "a"
+ "b"
+
+ "x/w"
+ "x/y/z"
+
+ "d/f"
+)
+`,
+ },
+ {
+ name: "import into singular group",
+ pkg: "bytes",
+ in: `package main
+
+import "os"
+
+`,
+ out: `package main
+
+import (
+ "bytes"
+ "os"
+)
+`,
+ },
+ {
+ name: "import into singular group with comment",
+ pkg: "bytes",
+ in: `package main
+
+import /* why */ /* comment here? */ "os"
+
+`,
+ out: `package main
+
+import /* why */ /* comment here? */ (
+ "bytes"
+ "os"
+)
+`,
+ },
+ {
+ name: "import into group with leading comment",
+ pkg: "strings",
+ in: `package main
+
+import (
+ // comment before bytes
+ "bytes"
+ "os"
+)
+
+`,
+ out: `package main
+
+import (
+ // comment before bytes
+ "bytes"
+ "os"
+ "strings"
+)
+`,
+ },
+ {
+ name: "",
+ renamedPkg: "fmtpkg",
+ pkg: "fmt",
+ in: `package main
+
+import "os"
+
+`,
+ out: `package main
+
+import (
+ fmtpkg "fmt"
+ "os"
+)
+`,
+ },
+ {
+ name: "struct comment",
+ pkg: "time",
+ in: `package main
+
+// This is a comment before a struct.
+type T struct {
+ t time.Time
+}
+`,
+ out: `package main
+
+import "time"
+
+// This is a comment before a struct.
+type T struct {
+ t time.Time
+}
+`,
+ },
+ {
+ name: "issue 8729 import C",
+ pkg: "time",
+ in: `package main
+
+import "C"
+
+// comment
+type T time.Time
+`,
+ out: `package main
+
+import "C"
+import "time"
+
+// comment
+type T time.Time
+`,
+ },
+ {
+ name: "issue 8729 empty import",
+ pkg: "time",
+ in: `package main
+
+import ()
+
+// comment
+type T time.Time
+`,
+ out: `package main
+
+import "time"
+
+// comment
+type T time.Time
+`,
+ },
+ {
+ name: "issue 8729 comment on package line",
+ pkg: "time",
+ in: `package main // comment
+
+type T time.Time
+`,
+ out: `package main // comment
+import "time"
+
+type T time.Time
+`,
+ },
+ {
+ name: "issue 8729 comment after package",
+ pkg: "time",
+ in: `package main
+// comment
+
+type T time.Time
+`,
+ out: `package main
+
+import "time"
+
+// comment
+
+type T time.Time
+`,
+ },
+ {
+ name: "issue 8729 comment before and on package line",
+ pkg: "time",
+ in: `// comment before
+package main // comment on
+
+type T time.Time
+`,
+ out: `// comment before
+package main // comment on
+import "time"
+
+type T time.Time
+`,
+ },
+
+ // Issue 9961: Match prefixes using path segments rather than bytes
+ {
+ name: "issue 9961",
+ pkg: "regexp",
+ in: `package main
+
+import (
+ "flag"
+ "testing"
+
+ "rsc.io/p"
+)
+`,
+ out: `package main
+
+import (
+ "flag"
+ "regexp"
+ "testing"
+
+ "rsc.io/p"
+)
+`,
+ },
+}
+
+func TestAddImport(t *testing.T) {
+ for _, test := range addTests {
+ file := parse(t, test.name, test.in)
+ var before bytes.Buffer
+ ast.Fprint(&before, fset, file, nil)
+ AddNamedImport(fset, file, test.renamedPkg, test.pkg)
+ if got := print(t, test.name, file); got != test.out {
+ if test.broken {
+ t.Logf("%s is known broken:\ngot: %s\nwant: %s", test.name, got, test.out)
+ } else {
+ t.Errorf("%s:\ngot: %s\nwant: %s", test.name, got, test.out)
+ }
+ var after bytes.Buffer
+ ast.Fprint(&after, fset, file, nil)
+
+ t.Logf("AST before:\n%s\nAST after:\n%s\n", before.String(), after.String())
+ }
+ }
+}
+
+func TestDoubleAddImport(t *testing.T) {
+ file := parse(t, "doubleimport", "package main\n")
+ AddImport(fset, file, "os")
+ AddImport(fset, file, "bytes")
+ want := `package main
+
+import (
+ "bytes"
+ "os"
+)
+`
+ if got := print(t, "doubleimport", file); got != want {
+ t.Errorf("got: %s\nwant: %s", got, want)
+ }
+}
+
+func TestDoubleAddNamedImport(t *testing.T) {
+ file := parse(t, "doublenamedimport", "package main\n")
+ AddNamedImport(fset, file, "o", "os")
+ AddNamedImport(fset, file, "i", "io")
+ want := `package main
+
+import (
+ i "io"
+ o "os"
+)
+`
+ if got := print(t, "doublenamedimport", file); got != want {
+ t.Errorf("got: %s\nwant: %s", got, want)
+ }
+}
+
+// Part of issue 8729.
+func TestDoubleAddImportWithDeclComment(t *testing.T) {
+ file := parse(t, "doubleimport", `package main
+
+import (
+)
+
+// comment
+type I int
+`)
+ // The AddImport order here matters.
+ AddImport(fset, file, "golang.org/x/tools/go/ast/astutil")
+ AddImport(fset, file, "os")
+ want := `package main
+
+import (
+ "golang.org/x/tools/go/ast/astutil"
+ "os"
+)
+
+// comment
+type I int
+`
+ if got := print(t, "doubleimport_with_decl_comment", file); got != want {
+ t.Errorf("got: %s\nwant: %s", got, want)
+ }
+}
+
+var deleteTests = []test{
+ {
+ name: "import.4",
+ pkg: "os",
+ in: `package main
+
+import (
+ "os"
+)
+`,
+ out: `package main
+`,
+ },
+ {
+ name: "import.5",
+ pkg: "os",
+ in: `package main
+
+// Comment
+import "C"
+import "os"
+`,
+ out: `package main
+
+// Comment
+import "C"
+`,
+ },
+ {
+ name: "import.6",
+ pkg: "os",
+ in: `package main
+
+// Comment
+import "C"
+
+import (
+ "io"
+ "os"
+ "utf8"
+)
+`,
+ out: `package main
+
+// Comment
+import "C"
+
+import (
+ "io"
+ "utf8"
+)
+`,
+ },
+ {
+ name: "import.7",
+ pkg: "io",
+ in: `package main
+
+import (
+ "io" // a
+ "os" // b
+ "utf8" // c
+)
+`,
+ out: `package main
+
+import (
+ // a
+ "os" // b
+ "utf8" // c
+)
+`,
+ },
+ {
+ name: "import.8",
+ pkg: "os",
+ in: `package main
+
+import (
+ "io" // a
+ "os" // b
+ "utf8" // c
+)
+`,
+ out: `package main
+
+import (
+ "io" // a
+ // b
+ "utf8" // c
+)
+`,
+ },
+ {
+ name: "import.9",
+ pkg: "utf8",
+ in: `package main
+
+import (
+ "io" // a
+ "os" // b
+ "utf8" // c
+)
+`,
+ out: `package main
+
+import (
+ "io" // a
+ "os" // b
+ // c
+)
+`,
+ },
+ {
+ name: "import.10",
+ pkg: "io",
+ in: `package main
+
+import (
+ "io"
+ "os"
+ "utf8"
+)
+`,
+ out: `package main
+
+import (
+ "os"
+ "utf8"
+)
+`,
+ },
+ {
+ name: "import.11",
+ pkg: "os",
+ in: `package main
+
+import (
+ "io"
+ "os"
+ "utf8"
+)
+`,
+ out: `package main
+
+import (
+ "io"
+ "utf8"
+)
+`,
+ },
+ {
+ name: "import.12",
+ pkg: "utf8",
+ in: `package main
+
+import (
+ "io"
+ "os"
+ "utf8"
+)
+`,
+ out: `package main
+
+import (
+ "io"
+ "os"
+)
+`,
+ },
+ {
+ name: "handle.raw.quote.imports",
+ pkg: "os",
+ in: "package main\n\nimport `os`",
+ out: `package main
+`,
+ },
+ {
+ name: "import.13",
+ pkg: "io",
+ in: `package main
+
+import (
+ "fmt"
+
+ "io"
+ "os"
+ "utf8"
+
+ "go/format"
+)
+`,
+ out: `package main
+
+import (
+ "fmt"
+
+ "os"
+ "utf8"
+
+ "go/format"
+)
+`,
+ },
+ {
+ name: "import.14",
+ pkg: "io",
+ in: `package main
+
+import (
+ "fmt" // a
+
+ "io" // b
+ "os" // c
+ "utf8" // d
+
+ "go/format" // e
+)
+`,
+ out: `package main
+
+import (
+ "fmt" // a
+
+ // b
+ "os" // c
+ "utf8" // d
+
+ "go/format" // e
+)
+`,
+ },
+ {
+ name: "import.15",
+ pkg: "double",
+ in: `package main
+
+import (
+ "double"
+ "double"
+)
+`,
+ out: `package main
+`,
+ },
+ {
+ name: "import.16",
+ pkg: "bubble",
+ in: `package main
+
+import (
+ "toil"
+ "bubble"
+ "bubble"
+ "trouble"
+)
+`,
+ out: `package main
+
+import (
+ "toil"
+ "trouble"
+)
+`,
+ },
+ {
+ name: "import.17",
+ pkg: "quad",
+ in: `package main
+
+import (
+ "quad"
+ "quad"
+)
+
+import (
+ "quad"
+ "quad"
+)
+`,
+ out: `package main
+`,
+ },
+}
+
+func TestDeleteImport(t *testing.T) {
+ for _, test := range deleteTests {
+ file := parse(t, test.name, test.in)
+ DeleteImport(fset, file, test.pkg)
+ if got := print(t, test.name, file); got != test.out {
+ t.Errorf("%s:\ngot: %s\nwant: %s", test.name, got, test.out)
+ }
+ }
+}
+
+type rewriteTest struct {
+ name string
+ srcPkg string
+ dstPkg string
+ in string
+ out string
+}
+
+var rewriteTests = []rewriteTest{
+ {
+ name: "import.13",
+ srcPkg: "utf8",
+ dstPkg: "encoding/utf8",
+ in: `package main
+
+import (
+ "io"
+ "os"
+ "utf8" // thanks ken
+)
+`,
+ out: `package main
+
+import (
+ "encoding/utf8" // thanks ken
+ "io"
+ "os"
+)
+`,
+ },
+ {
+ name: "import.14",
+ srcPkg: "asn1",
+ dstPkg: "encoding/asn1",
+ in: `package main
+
+import (
+ "asn1"
+ "crypto"
+ "crypto/rsa"
+ _ "crypto/sha1"
+ "crypto/x509"
+ "crypto/x509/pkix"
+ "time"
+)
+
+var x = 1
+`,
+ out: `package main
+
+import (
+ "crypto"
+ "crypto/rsa"
+ _ "crypto/sha1"
+ "crypto/x509"
+ "crypto/x509/pkix"
+ "encoding/asn1"
+ "time"
+)
+
+var x = 1
+`,
+ },
+ {
+ name: "import.15",
+ srcPkg: "url",
+ dstPkg: "net/url",
+ in: `package main
+
+import (
+ "bufio"
+ "net"
+ "path"
+ "url"
+)
+
+var x = 1 // comment on x, not on url
+`,
+ out: `package main
+
+import (
+ "bufio"
+ "net"
+ "net/url"
+ "path"
+)
+
+var x = 1 // comment on x, not on url
+`,
+ },
+ {
+ name: "import.16",
+ srcPkg: "http",
+ dstPkg: "net/http",
+ in: `package main
+
+import (
+ "flag"
+ "http"
+ "log"
+ "text/template"
+)
+
+var addr = flag.String("addr", ":1718", "http service address") // Q=17, R=18
+`,
+ out: `package main
+
+import (
+ "flag"
+ "log"
+ "net/http"
+ "text/template"
+)
+
+var addr = flag.String("addr", ":1718", "http service address") // Q=17, R=18
+`,
+ },
+}
+
+func TestRewriteImport(t *testing.T) {
+ for _, test := range rewriteTests {
+ file := parse(t, test.name, test.in)
+ RewriteImport(fset, file, test.srcPkg, test.dstPkg)
+ if got := print(t, test.name, file); got != test.out {
+ t.Errorf("%s:\ngot: %s\nwant: %s", test.name, got, test.out)
+ }
+ }
+}
+
+var importsTests = []struct {
+ name string
+ in string
+ want [][]string
+}{
+ {
+ name: "no packages",
+ in: `package foo
+`,
+ want: nil,
+ },
+ {
+ name: "one group",
+ in: `package foo
+
+import (
+ "fmt"
+ "testing"
+)
+`,
+ want: [][]string{{"fmt", "testing"}},
+ },
+ {
+ name: "four groups",
+ in: `package foo
+
+import "C"
+import (
+ "fmt"
+ "testing"
+
+ "appengine"
+
+ "myproject/mylib1"
+ "myproject/mylib2"
+)
+`,
+ want: [][]string{
+ {"C"},
+ {"fmt", "testing"},
+ {"appengine"},
+ {"myproject/mylib1", "myproject/mylib2"},
+ },
+ },
+ {
+ name: "multiple factored groups",
+ in: `package foo
+
+import (
+ "fmt"
+ "testing"
+
+ "appengine"
+)
+import (
+ "reflect"
+
+ "bytes"
+)
+`,
+ want: [][]string{
+ {"fmt", "testing"},
+ {"appengine"},
+ {"reflect"},
+ {"bytes"},
+ },
+ },
+}
+
+func unquote(s string) string {
+ res, err := strconv.Unquote(s)
+ if err != nil {
+ return "could_not_unquote"
+ }
+ return res
+}
+
+func TestImports(t *testing.T) {
+ fset := token.NewFileSet()
+ for _, test := range importsTests {
+ f, err := parser.ParseFile(fset, "test.go", test.in, 0)
+ if err != nil {
+ t.Errorf("%s: %v", test.name, err)
+ continue
+ }
+ var got [][]string
+ for _, group := range Imports(fset, f) {
+ var b []string
+ for _, spec := range group {
+ b = append(b, unquote(spec.Path.Value))
+ }
+ got = append(got, b)
+ }
+ if !reflect.DeepEqual(got, test.want) {
+ t.Errorf("Imports(%s)=%v, want %v", test.name, got, test.want)
+ }
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/util.go b/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/util.go
new file mode 100644
index 0000000000..7630629824
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/ast/astutil/util.go
@@ -0,0 +1,14 @@
+package astutil
+
+import "go/ast"
+
+// Unparen returns e with any enclosing parentheses stripped.
+func Unparen(e ast.Expr) ast.Expr {
+ for {
+ p, ok := e.(*ast.ParenExpr)
+ if !ok {
+ return e
+ }
+ e = p.X
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/allpackages.go b/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/allpackages.go
new file mode 100644
index 0000000000..5ec5b42a33
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/allpackages.go
@@ -0,0 +1,123 @@
+// Copyright 2014 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.
+
+// Package buildutil provides utilities related to the go/build
+// package in the standard library.
+//
+// All I/O is done via the build.Context file system interface, which must
+// be concurrency-safe.
+package buildutil
+
+import (
+ "go/build"
+ "os"
+ "path/filepath"
+ "sort"
+ "strings"
+ "sync"
+)
+
+// AllPackages returns the import path of each Go package in any source
+// directory of the specified build context (e.g. $GOROOT or an element
+// of $GOPATH). Errors are ignored. The results are sorted.
+//
+// The result may include import paths for directories that contain no
+// *.go files, such as "archive" (in $GOROOT/src).
+//
+// All I/O is done via the build.Context file system interface,
+// which must be concurrency-safe.
+//
+func AllPackages(ctxt *build.Context) []string {
+ var list []string
+ ForEachPackage(ctxt, func(pkg string, _ error) {
+ list = append(list, pkg)
+ })
+ sort.Strings(list)
+ return list
+}
+
+// ForEachPackage calls the found function with the import path of
+// each Go package it finds in any source directory of the specified
+// build context (e.g. $GOROOT or an element of $GOPATH).
+//
+// If the package directory exists but could not be read, the second
+// argument to the found function provides the error.
+//
+// All I/O is done via the build.Context file system interface,
+// which must be concurrency-safe.
+//
+func ForEachPackage(ctxt *build.Context, found func(importPath string, err error)) {
+ // We use a counting semaphore to limit
+ // the number of parallel calls to ReadDir.
+ sema := make(chan bool, 20)
+
+ ch := make(chan item)
+
+ var wg sync.WaitGroup
+ for _, root := range ctxt.SrcDirs() {
+ root := root
+ wg.Add(1)
+ go func() {
+ allPackages(ctxt, sema, root, ch)
+ wg.Done()
+ }()
+ }
+ go func() {
+ wg.Wait()
+ close(ch)
+ }()
+
+ // All calls to found occur in the caller's goroutine.
+ for i := range ch {
+ found(i.importPath, i.err)
+ }
+}
+
+type item struct {
+ importPath string
+ err error // (optional)
+}
+
+func allPackages(ctxt *build.Context, sema chan bool, root string, ch chan<- item) {
+ root = filepath.Clean(root) + string(os.PathSeparator)
+
+ var wg sync.WaitGroup
+
+ var walkDir func(dir string)
+ walkDir = func(dir string) {
+ // Avoid .foo, _foo, and testdata directory trees.
+ base := filepath.Base(dir)
+ if base == "" || base[0] == '.' || base[0] == '_' || base == "testdata" {
+ return
+ }
+
+ pkg := filepath.ToSlash(strings.TrimPrefix(dir, root))
+
+ // Prune search if we encounter any of these import paths.
+ switch pkg {
+ case "builtin":
+ return
+ }
+
+ sema <- true
+ files, err := ReadDir(ctxt, dir)
+ <-sema
+ if pkg != "" || err != nil {
+ ch <- item{pkg, err}
+ }
+ for _, fi := range files {
+ fi := fi
+ if fi.IsDir() {
+ wg.Add(1)
+ go func() {
+ walkDir(filepath.Join(dir, fi.Name()))
+ wg.Done()
+ }()
+ }
+ }
+ }
+
+ walkDir(root)
+ wg.Wait()
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/allpackages_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/allpackages_test.go
new file mode 100644
index 0000000000..552ad6c865
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/allpackages_test.go
@@ -0,0 +1,32 @@
+// Copyright 2014 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.
+
+package buildutil_test
+
+import (
+ "go/build"
+ "testing"
+
+ "golang.org/x/tools/go/buildutil"
+)
+
+func TestAllPackages(t *testing.T) {
+ all := buildutil.AllPackages(&build.Default)
+
+ set := make(map[string]bool)
+ for _, pkg := range all {
+ set[pkg] = true
+ }
+
+ const wantAtLeast = 250
+ if len(all) < wantAtLeast {
+ t.Errorf("Found only %d packages, want at least %d", len(all), wantAtLeast)
+ }
+
+ for _, want := range []string{"fmt", "crypto/sha256", "golang.org/x/tools/go/buildutil"} {
+ if !set[want] {
+ t.Errorf("Package %q not found; got %s", want, all)
+ }
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/fakecontext.go b/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/fakecontext.go
new file mode 100644
index 0000000000..24cbcbea2b
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/fakecontext.go
@@ -0,0 +1,108 @@
+package buildutil
+
+import (
+ "fmt"
+ "go/build"
+ "io"
+ "io/ioutil"
+ "os"
+ "path"
+ "path/filepath"
+ "sort"
+ "strings"
+ "time"
+)
+
+// FakeContext returns a build.Context for the fake file tree specified
+// by pkgs, which maps package import paths to a mapping from file base
+// names to contents.
+//
+// The fake Context has a GOROOT of "/go" and no GOPATH, and overrides
+// the necessary file access methods to read from memory instead of the
+// real file system.
+//
+// Unlike a real file tree, the fake one has only two levels---packages
+// and files---so ReadDir("/go/src/") returns all packages under
+// /go/src/ including, for instance, "math" and "math/big".
+// ReadDir("/go/src/math/big") would return all the files in the
+// "math/big" package.
+//
+func FakeContext(pkgs map[string]map[string]string) *build.Context {
+ clean := func(filename string) string {
+ f := path.Clean(filepath.ToSlash(filename))
+ // Removing "/go/src" while respecting segment
+ // boundaries has this unfortunate corner case:
+ if f == "/go/src" {
+ return ""
+ }
+ return strings.TrimPrefix(f, "/go/src/")
+ }
+
+ ctxt := build.Default // copy
+ ctxt.GOROOT = "/go"
+ ctxt.GOPATH = ""
+ ctxt.IsDir = func(dir string) bool {
+ dir = clean(dir)
+ if dir == "" {
+ return true // needed by (*build.Context).SrcDirs
+ }
+ return pkgs[dir] != nil
+ }
+ ctxt.ReadDir = func(dir string) ([]os.FileInfo, error) {
+ dir = clean(dir)
+ var fis []os.FileInfo
+ if dir == "" {
+ // enumerate packages
+ for importPath := range pkgs {
+ fis = append(fis, fakeDirInfo(importPath))
+ }
+ } else {
+ // enumerate files of package
+ for basename := range pkgs[dir] {
+ fis = append(fis, fakeFileInfo(basename))
+ }
+ }
+ sort.Sort(byName(fis))
+ return fis, nil
+ }
+ ctxt.OpenFile = func(filename string) (io.ReadCloser, error) {
+ filename = clean(filename)
+ dir, base := path.Split(filename)
+ content, ok := pkgs[path.Clean(dir)][base]
+ if !ok {
+ return nil, fmt.Errorf("file not found: %s", filename)
+ }
+ return ioutil.NopCloser(strings.NewReader(content)), nil
+ }
+ ctxt.IsAbsPath = func(path string) bool {
+ path = filepath.ToSlash(path)
+ // Don't rely on the default (filepath.Path) since on
+ // Windows, it reports virtual paths as non-absolute.
+ return strings.HasPrefix(path, "/")
+ }
+ return &ctxt
+}
+
+type byName []os.FileInfo
+
+func (s byName) Len() int { return len(s) }
+func (s byName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
+func (s byName) Less(i, j int) bool { return s[i].Name() < s[j].Name() }
+
+type fakeFileInfo string
+
+func (fi fakeFileInfo) Name() string { return string(fi) }
+func (fakeFileInfo) Sys() interface{} { return nil }
+func (fakeFileInfo) ModTime() time.Time { return time.Time{} }
+func (fakeFileInfo) IsDir() bool { return false }
+func (fakeFileInfo) Size() int64 { return 0 }
+func (fakeFileInfo) Mode() os.FileMode { return 0644 }
+
+type fakeDirInfo string
+
+func (fd fakeDirInfo) Name() string { return string(fd) }
+func (fakeDirInfo) Sys() interface{} { return nil }
+func (fakeDirInfo) ModTime() time.Time { return time.Time{} }
+func (fakeDirInfo) IsDir() bool { return true }
+func (fakeDirInfo) Size() int64 { return 0 }
+func (fakeDirInfo) Mode() os.FileMode { return 0755 }
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/tags.go b/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/tags.go
new file mode 100644
index 0000000000..97350940ea
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/tags.go
@@ -0,0 +1,73 @@
+package buildutil
+
+// This logic was copied from stringsFlag from $GOROOT/src/cmd/go/build.go.
+
+import "fmt"
+
+const TagsFlagDoc = "a list of `build tags` to consider satisfied during the build. " +
+ "For more information about build tags, see the description of " +
+ "build constraints in the documentation for the go/build package"
+
+// TagsFlag is an implementation of the flag.Value interface that parses
+// a flag value in the same manner as go build's -tags flag and
+// populates a []string slice.
+//
+// See $GOROOT/src/go/build/doc.go for description of build tags.
+// See $GOROOT/src/cmd/go/doc.go for description of 'go build -tags' flag.
+//
+// Example:
+// flag.Var((*buildutil.TagsFlag)(&build.Default.BuildTags), "tags", buildutil.TagsDoc)
+type TagsFlag []string
+
+func (v *TagsFlag) Set(s string) error {
+ var err error
+ *v, err = splitQuotedFields(s)
+ if *v == nil {
+ *v = []string{}
+ }
+ return err
+}
+
+func splitQuotedFields(s string) ([]string, error) {
+ // Split fields allowing '' or "" around elements.
+ // Quotes further inside the string do not count.
+ var f []string
+ for len(s) > 0 {
+ for len(s) > 0 && isSpaceByte(s[0]) {
+ s = s[1:]
+ }
+ if len(s) == 0 {
+ break
+ }
+ // Accepted quoted string. No unescaping inside.
+ if s[0] == '"' || s[0] == '\'' {
+ quote := s[0]
+ s = s[1:]
+ i := 0
+ for i < len(s) && s[i] != quote {
+ i++
+ }
+ if i >= len(s) {
+ return nil, fmt.Errorf("unterminated %c string", quote)
+ }
+ f = append(f, s[:i])
+ s = s[i+1:]
+ continue
+ }
+ i := 0
+ for i < len(s) && !isSpaceByte(s[i]) {
+ i++
+ }
+ f = append(f, s[:i])
+ s = s[i:]
+ }
+ return f, nil
+}
+
+func (v *TagsFlag) String() string {
+ return ""
+}
+
+func isSpaceByte(c byte) bool {
+ return c == ' ' || c == '\t' || c == '\n' || c == '\r'
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/tags_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/tags_test.go
new file mode 100644
index 0000000000..0fc26180a9
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/tags_test.go
@@ -0,0 +1,28 @@
+package buildutil_test
+
+import (
+ "flag"
+ "go/build"
+ "reflect"
+ "testing"
+
+ "golang.org/x/tools/go/buildutil"
+)
+
+func TestTags(t *testing.T) {
+ f := flag.NewFlagSet("TestTags", flag.PanicOnError)
+ var ctxt build.Context
+ f.Var((*buildutil.TagsFlag)(&ctxt.BuildTags), "tags", buildutil.TagsFlagDoc)
+ f.Parse([]string{"-tags", ` 'one'"two" 'three "four"'`, "rest"})
+
+ // BuildTags
+ want := []string{"one", "two", "three \"four\""}
+ if !reflect.DeepEqual(ctxt.BuildTags, want) {
+ t.Errorf("BuildTags = %q, want %q", ctxt.BuildTags, want)
+ }
+
+ // Args()
+ if want := []string{"rest"}; !reflect.DeepEqual(f.Args(), want) {
+ t.Errorf("f.Args() = %q, want %q", f.Args(), want)
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/util.go b/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/util.go
new file mode 100644
index 0000000000..60eeae2530
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/util.go
@@ -0,0 +1,158 @@
+// Copyright 2014 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.
+
+package buildutil
+
+import (
+ "fmt"
+ "go/ast"
+ "go/build"
+ "go/parser"
+ "go/token"
+ "io"
+ "io/ioutil"
+ "os"
+ "path"
+ "path/filepath"
+ "strings"
+)
+
+// ParseFile behaves like parser.ParseFile,
+// but uses the build context's file system interface, if any.
+//
+// If file is not absolute (as defined by IsAbsPath), the (dir, file)
+// components are joined using JoinPath; dir must be absolute.
+//
+// The displayPath function, if provided, is used to transform the
+// filename that will be attached to the ASTs.
+//
+// TODO(adonovan): call this from go/loader.parseFiles when the tree thaws.
+//
+func ParseFile(fset *token.FileSet, ctxt *build.Context, displayPath func(string) string, dir string, file string, mode parser.Mode) (*ast.File, error) {
+ if !IsAbsPath(ctxt, file) {
+ file = JoinPath(ctxt, dir, file)
+ }
+ rd, err := OpenFile(ctxt, file)
+ if err != nil {
+ return nil, err
+ }
+ defer rd.Close() // ignore error
+ if displayPath != nil {
+ file = displayPath(file)
+ }
+ return parser.ParseFile(fset, file, rd, mode)
+}
+
+// ContainingPackage returns the package containing filename.
+//
+// If filename is not absolute, it is interpreted relative to working directory dir.
+// All I/O is via the build context's file system interface, if any.
+//
+// The '...Files []string' fields of the resulting build.Package are not
+// populated (build.FindOnly mode).
+//
+// TODO(adonovan): call this from oracle when the tree thaws.
+//
+func ContainingPackage(ctxt *build.Context, dir, filename string) (*build.Package, error) {
+ if !IsAbsPath(ctxt, filename) {
+ filename = JoinPath(ctxt, dir, filename)
+ }
+
+ // We must not assume the file tree uses
+ // "/" always,
+ // `\` always,
+ // or os.PathSeparator (which varies by platform),
+ // but to make any progress, we are forced to assume that
+ // paths will not use `\` unless the PathSeparator
+ // is also `\`, thus we can rely on filepath.ToSlash for some sanity.
+
+ dirSlash := path.Dir(filepath.ToSlash(filename)) + "/"
+
+ // We assume that no source root (GOPATH[i] or GOROOT) contains any other.
+ for _, srcdir := range ctxt.SrcDirs() {
+ srcdirSlash := filepath.ToSlash(srcdir) + "/"
+ if strings.HasPrefix(dirSlash, srcdirSlash) {
+ importPath := dirSlash[len(srcdirSlash) : len(dirSlash)-len("/")]
+ return ctxt.Import(importPath, dir, build.FindOnly)
+ }
+ }
+
+ return nil, fmt.Errorf("can't find package containing %s", filename)
+}
+
+// -- Effective methods of file system interface -------------------------
+
+// (go/build.Context defines these as methods, but does not export them.)
+
+// TODO(adonovan): HasSubdir?
+
+// FileExists returns true if the specified file exists,
+// using the build context's file system interface.
+func FileExists(ctxt *build.Context, path string) bool {
+ if ctxt.OpenFile != nil {
+ r, err := ctxt.OpenFile(path)
+ if err != nil {
+ return false
+ }
+ r.Close() // ignore error
+ return true
+ }
+ _, err := os.Stat(path)
+ return err == nil
+}
+
+// OpenFile behaves like os.Open,
+// but uses the build context's file system interface, if any.
+func OpenFile(ctxt *build.Context, path string) (io.ReadCloser, error) {
+ if ctxt.OpenFile != nil {
+ return ctxt.OpenFile(path)
+ }
+ return os.Open(path)
+}
+
+// IsAbsPath behaves like filepath.IsAbs,
+// but uses the build context's file system interface, if any.
+func IsAbsPath(ctxt *build.Context, path string) bool {
+ if ctxt.IsAbsPath != nil {
+ return ctxt.IsAbsPath(path)
+ }
+ return filepath.IsAbs(path)
+}
+
+// JoinPath behaves like filepath.Join,
+// but uses the build context's file system interface, if any.
+func JoinPath(ctxt *build.Context, path ...string) string {
+ if ctxt.JoinPath != nil {
+ return ctxt.JoinPath(path...)
+ }
+ return filepath.Join(path...)
+}
+
+// IsDir behaves like os.Stat plus IsDir,
+// but uses the build context's file system interface, if any.
+func IsDir(ctxt *build.Context, path string) bool {
+ if ctxt.IsDir != nil {
+ return ctxt.IsDir(path)
+ }
+ fi, err := os.Stat(path)
+ return err == nil && fi.IsDir()
+}
+
+// ReadDir behaves like ioutil.ReadDir,
+// but uses the build context's file system interface, if any.
+func ReadDir(ctxt *build.Context, path string) ([]os.FileInfo, error) {
+ if ctxt.ReadDir != nil {
+ return ctxt.ReadDir(path)
+ }
+ return ioutil.ReadDir(path)
+}
+
+// SplitPathList behaves like filepath.SplitList,
+// but uses the build context's file system interface, if any.
+func SplitPathList(ctxt *build.Context, s string) []string {
+ if ctxt.SplitPathList != nil {
+ return ctxt.SplitPathList(s)
+ }
+ return filepath.SplitList(s)
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/util_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/util_test.go
new file mode 100644
index 0000000000..f156829e8b
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/buildutil/util_test.go
@@ -0,0 +1,41 @@
+// Copyright 2014 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.
+
+package buildutil_test
+
+import (
+ "go/build"
+ "os"
+ "path/filepath"
+ "runtime"
+ "testing"
+
+ "golang.org/x/tools/go/buildutil"
+)
+
+func TestContainingPackage(t *testing.T) {
+ // unvirtualized:
+ goroot := runtime.GOROOT()
+ gopath := filepath.SplitList(os.Getenv("GOPATH"))[0]
+
+ for _, test := range [][2]string{
+ {goroot + "/src/fmt/print.go", "fmt"},
+ {goroot + "/src/encoding/json/foo.go", "encoding/json"},
+ {goroot + "/src/encoding/missing/foo.go", "(not found)"},
+ {gopath + "/src/golang.org/x/tools/go/buildutil/util_test.go",
+ "golang.org/x/tools/go/buildutil"},
+ } {
+ file, want := test[0], test[1]
+ bp, err := buildutil.ContainingPackage(&build.Default, ".", file)
+ got := bp.ImportPath
+ if err != nil {
+ got = "(not found)"
+ }
+ if got != want {
+ t.Errorf("ContainingPackage(%q) = %s, want %s", file, got, want)
+ }
+ }
+
+ // TODO(adonovan): test on virtualized GOPATH too.
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/exact/exact.go b/Godeps/_workspace/src/golang.org/x/tools/go/exact/exact.go
new file mode 100644
index 0000000000..e8fbfe974a
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/exact/exact.go
@@ -0,0 +1,920 @@
+// 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.
+
+// Package exact implements Values representing untyped
+// Go constants and the corresponding operations. Values
+// and operations have unlimited precision.
+//
+// A special Unknown value may be used when a value
+// is unknown due to an error. Operations on unknown
+// values produce unknown values unless specified
+// otherwise.
+//
+package exact
+
+import (
+ "fmt"
+ "go/token"
+ "math/big"
+ "strconv"
+)
+
+// Kind specifies the kind of value represented by a Value.
+type Kind int
+
+// Implementation note: Kinds must be enumerated in
+// order of increasing "complexity" (used by match).
+
+const (
+ // unknown values
+ Unknown Kind = iota
+
+ // non-numeric values
+ Bool
+ String
+
+ // numeric values
+ Int
+ Float
+ Complex
+)
+
+// A Value represents a mathematically exact value of a given Kind.
+type Value interface {
+ // Kind returns the value kind; it is always the smallest
+ // kind in which the value can be represented exactly.
+ Kind() Kind
+
+ // String returns a human-readable form of the value.
+ String() string
+
+ // Prevent external implementations.
+ implementsValue()
+}
+
+// ----------------------------------------------------------------------------
+// Implementations
+
+type (
+ unknownVal struct{}
+ boolVal bool
+ stringVal string
+ int64Val int64
+ intVal struct{ val *big.Int }
+ floatVal struct{ val *big.Rat }
+ complexVal struct{ re, im *big.Rat }
+)
+
+func (unknownVal) Kind() Kind { return Unknown }
+func (boolVal) Kind() Kind { return Bool }
+func (stringVal) Kind() Kind { return String }
+func (int64Val) Kind() Kind { return Int }
+func (intVal) Kind() Kind { return Int }
+func (floatVal) Kind() Kind { return Float }
+func (complexVal) Kind() Kind { return Complex }
+
+func (unknownVal) String() string { return "unknown" }
+func (x boolVal) String() string { return fmt.Sprintf("%v", bool(x)) }
+func (x stringVal) String() string { return strconv.Quote(string(x)) }
+func (x int64Val) String() string { return strconv.FormatInt(int64(x), 10) }
+func (x intVal) String() string { return x.val.String() }
+func (x floatVal) String() string { return x.val.String() }
+func (x complexVal) String() string { return fmt.Sprintf("(%s + %si)", x.re, x.im) }
+
+func (unknownVal) implementsValue() {}
+func (boolVal) implementsValue() {}
+func (stringVal) implementsValue() {}
+func (int64Val) implementsValue() {}
+func (intVal) implementsValue() {}
+func (floatVal) implementsValue() {}
+func (complexVal) implementsValue() {}
+
+// int64 bounds
+var (
+ minInt64 = big.NewInt(-1 << 63)
+ maxInt64 = big.NewInt(1<<63 - 1)
+)
+
+func normInt(x *big.Int) Value {
+ if minInt64.Cmp(x) <= 0 && x.Cmp(maxInt64) <= 0 {
+ return int64Val(x.Int64())
+ }
+ return intVal{x}
+}
+
+func normFloat(x *big.Rat) Value {
+ if x.IsInt() {
+ return normInt(x.Num())
+ }
+ return floatVal{x}
+}
+
+func normComplex(re, im *big.Rat) Value {
+ if im.Sign() == 0 {
+ return normFloat(re)
+ }
+ return complexVal{re, im}
+}
+
+// ----------------------------------------------------------------------------
+// Factories
+
+// MakeUnknown returns the Unknown value.
+func MakeUnknown() Value { return unknownVal{} }
+
+// MakeBool returns the Bool value for x.
+func MakeBool(b bool) Value { return boolVal(b) }
+
+// MakeString returns the String value for x.
+func MakeString(s string) Value { return stringVal(s) }
+
+// MakeInt64 returns the Int value for x.
+func MakeInt64(x int64) Value { return int64Val(x) }
+
+// MakeUint64 returns the Int value for x.
+func MakeUint64(x uint64) Value { return normInt(new(big.Int).SetUint64(x)) }
+
+// MakeFloat64 returns the numeric value for x.
+// If x is not finite, the result is unknown.
+func MakeFloat64(x float64) Value {
+ if f := new(big.Rat).SetFloat64(x); f != nil {
+ return normFloat(f)
+ }
+ return unknownVal{}
+}
+
+// MakeFromLiteral returns the corresponding integer, floating-point,
+// imaginary, character, or string value for a Go literal string. The
+// result is nil if the literal string is invalid.
+func MakeFromLiteral(lit string, tok token.Token) Value {
+ switch tok {
+ case token.INT:
+ if x, err := strconv.ParseInt(lit, 0, 64); err == nil {
+ return int64Val(x)
+ }
+ if x, ok := new(big.Int).SetString(lit, 0); ok {
+ return intVal{x}
+ }
+
+ case token.FLOAT:
+ if x, ok := new(big.Rat).SetString(lit); ok {
+ return normFloat(x)
+ }
+
+ case token.IMAG:
+ if n := len(lit); n > 0 && lit[n-1] == 'i' {
+ if im, ok := new(big.Rat).SetString(lit[0 : n-1]); ok {
+ return normComplex(big.NewRat(0, 1), im)
+ }
+ }
+
+ case token.CHAR:
+ if n := len(lit); n >= 2 {
+ if code, _, _, err := strconv.UnquoteChar(lit[1:n-1], '\''); err == nil {
+ return int64Val(code)
+ }
+ }
+
+ case token.STRING:
+ if s, err := strconv.Unquote(lit); err == nil {
+ return stringVal(s)
+ }
+ }
+
+ return nil
+}
+
+// ----------------------------------------------------------------------------
+// Accessors
+//
+// For unknown arguments the result is the zero value for the respective
+// accessor type, except for Sign, where the result is 1.
+
+// BoolVal returns the Go boolean value of x, which must be a Bool or an Unknown.
+// If x is Unknown, the result is false.
+func BoolVal(x Value) bool {
+ switch x := x.(type) {
+ case boolVal:
+ return bool(x)
+ case unknownVal:
+ return false
+ }
+ panic(fmt.Sprintf("%v not a Bool", x))
+}
+
+// StringVal returns the Go string value of x, which must be a String or an Unknown.
+// If x is Unknown, the result is "".
+func StringVal(x Value) string {
+ switch x := x.(type) {
+ case stringVal:
+ return string(x)
+ case unknownVal:
+ return ""
+ }
+ panic(fmt.Sprintf("%v not a String", x))
+}
+
+// Int64Val returns the Go int64 value of x and whether the result is exact;
+// x must be an Int or an Unknown. If the result is not exact, its value is undefined.
+// If x is Unknown, the result is (0, false).
+func Int64Val(x Value) (int64, bool) {
+ switch x := x.(type) {
+ case int64Val:
+ return int64(x), true
+ case intVal:
+ return x.val.Int64(), x.val.BitLen() <= 63
+ case unknownVal:
+ return 0, false
+ }
+ panic(fmt.Sprintf("%v not an Int", x))
+}
+
+// Uint64Val returns the Go uint64 value of x and whether the result is exact;
+// x must be an Int or an Unknown. If the result is not exact, its value is undefined.
+// If x is Unknown, the result is (0, false).
+func Uint64Val(x Value) (uint64, bool) {
+ switch x := x.(type) {
+ case int64Val:
+ return uint64(x), x >= 0
+ case intVal:
+ return x.val.Uint64(), x.val.Sign() >= 0 && x.val.BitLen() <= 64
+ case unknownVal:
+ return 0, false
+ }
+ panic(fmt.Sprintf("%v not an Int", x))
+}
+
+// Float32Val is like Float64Val but for float32 instead of float64.
+func Float32Val(x Value) (float32, bool) {
+ switch x := x.(type) {
+ case int64Val:
+ f := float32(x)
+ return f, int64Val(f) == x
+ case intVal:
+ return ratToFloat32(new(big.Rat).SetFrac(x.val, int1))
+ case floatVal:
+ return ratToFloat32(x.val)
+ case unknownVal:
+ return 0, false
+ }
+ panic(fmt.Sprintf("%v not a Float", x))
+}
+
+// Float64Val returns the nearest Go float64 value of x and whether the result is exact;
+// x must be numeric but not Complex, or Unknown. For values too small (too close to 0)
+// to represent as float64, Float64Val silently underflows to 0. The result sign always
+// matches the sign of x, even for 0.
+// If x is Unknown, the result is (0, false).
+func Float64Val(x Value) (float64, bool) {
+ switch x := x.(type) {
+ case int64Val:
+ f := float64(int64(x))
+ return f, int64Val(f) == x
+ case intVal:
+ return new(big.Rat).SetFrac(x.val, int1).Float64()
+ case floatVal:
+ return x.val.Float64()
+ case unknownVal:
+ return 0, false
+ }
+ panic(fmt.Sprintf("%v not a Float", x))
+}
+
+// BitLen returns the number of bits required to represent
+// the absolute value x in binary representation; x must be an Int or an Unknown.
+// If x is Unknown, the result is 0.
+func BitLen(x Value) int {
+ switch x := x.(type) {
+ case int64Val:
+ return new(big.Int).SetInt64(int64(x)).BitLen()
+ case intVal:
+ return x.val.BitLen()
+ case unknownVal:
+ return 0
+ }
+ panic(fmt.Sprintf("%v not an Int", x))
+}
+
+// Sign returns -1, 0, or 1 depending on whether x < 0, x == 0, or x > 0;
+// x must be numeric or Unknown. For complex values x, the sign is 0 if x == 0,
+// otherwise it is != 0. If x is Unknown, the result is 1.
+func Sign(x Value) int {
+ switch x := x.(type) {
+ case int64Val:
+ switch {
+ case x < 0:
+ return -1
+ case x > 0:
+ return 1
+ }
+ return 0
+ case intVal:
+ return x.val.Sign()
+ case floatVal:
+ return x.val.Sign()
+ case complexVal:
+ return x.re.Sign() | x.im.Sign()
+ case unknownVal:
+ return 1 // avoid spurious division by zero errors
+ }
+ panic(fmt.Sprintf("%v not numeric", x))
+}
+
+// ----------------------------------------------------------------------------
+// Support for serializing/deserializing integers
+
+const (
+ // Compute the size of a Word in bytes.
+ _m = ^big.Word(0)
+ _log = _m>>8&1 + _m>>16&1 + _m>>32&1
+ wordSize = 1 << _log
+)
+
+// Bytes returns the bytes for the absolute value of x in little-
+// endian binary representation; x must be an Int.
+func Bytes(x Value) []byte {
+ var val *big.Int
+ switch x := x.(type) {
+ case int64Val:
+ val = new(big.Int).SetInt64(int64(x))
+ case intVal:
+ val = x.val
+ default:
+ panic(fmt.Sprintf("%v not an Int", x))
+ }
+
+ words := val.Bits()
+ bytes := make([]byte, len(words)*wordSize)
+
+ i := 0
+ for _, w := range words {
+ for j := 0; j < wordSize; j++ {
+ bytes[i] = byte(w)
+ w >>= 8
+ i++
+ }
+ }
+ // remove leading 0's
+ for i > 0 && bytes[i-1] == 0 {
+ i--
+ }
+
+ return bytes[:i]
+}
+
+// MakeFromBytes returns the Int value given the bytes of its little-endian
+// binary representation. An empty byte slice argument represents 0.
+func MakeFromBytes(bytes []byte) Value {
+ words := make([]big.Word, (len(bytes)+(wordSize-1))/wordSize)
+
+ i := 0
+ var w big.Word
+ var s uint
+ for _, b := range bytes {
+ w |= big.Word(b) << s
+ if s += 8; s == wordSize*8 {
+ words[i] = w
+ i++
+ w = 0
+ s = 0
+ }
+ }
+ // store last word
+ if i < len(words) {
+ words[i] = w
+ i++
+ }
+ // remove leading 0's
+ for i > 0 && words[i-1] == 0 {
+ i--
+ }
+
+ return normInt(new(big.Int).SetBits(words[:i]))
+}
+
+// ----------------------------------------------------------------------------
+// Support for disassembling fractions
+
+// Num returns the numerator of x; x must be Int, Float, or Unknown.
+// If x is Unknown, the result is Unknown, otherwise it is an Int
+// with the same sign as x.
+func Num(x Value) Value {
+ switch x := x.(type) {
+ case unknownVal, int64Val, intVal:
+ return x
+ case floatVal:
+ return normInt(x.val.Num())
+ }
+ panic(fmt.Sprintf("%v not Int or Float", x))
+}
+
+// Denom returns the denominator of x; x must be Int, Float, or Unknown.
+// If x is Unknown, the result is Unknown, otherwise it is an Int >= 1.
+func Denom(x Value) Value {
+ switch x := x.(type) {
+ case unknownVal:
+ return x
+ case int64Val, intVal:
+ return int64Val(1)
+ case floatVal:
+ return normInt(x.val.Denom())
+ }
+ panic(fmt.Sprintf("%v not Int or Float", x))
+}
+
+// ----------------------------------------------------------------------------
+// Support for assembling/disassembling complex numbers
+
+// MakeImag returns the numeric value x*i (possibly 0);
+// x must be Int, Float, or Unknown.
+// If x is Unknown, the result is Unknown.
+func MakeImag(x Value) Value {
+ var im *big.Rat
+ switch x := x.(type) {
+ case unknownVal:
+ return x
+ case int64Val:
+ im = big.NewRat(int64(x), 1)
+ case intVal:
+ im = new(big.Rat).SetFrac(x.val, int1)
+ case floatVal:
+ im = x.val
+ default:
+ panic(fmt.Sprintf("%v not Int or Float", x))
+ }
+ return normComplex(rat0, im)
+}
+
+// Real returns the real part of x, which must be a numeric or unknown value.
+// If x is Unknown, the result is Unknown.
+func Real(x Value) Value {
+ switch x := x.(type) {
+ case unknownVal, int64Val, intVal, floatVal:
+ return x
+ case complexVal:
+ return normFloat(x.re)
+ }
+ panic(fmt.Sprintf("%v not numeric", x))
+}
+
+// Imag returns the imaginary part of x, which must be a numeric or unknown value.
+// If x is Unknown, the result is Unknown.
+func Imag(x Value) Value {
+ switch x := x.(type) {
+ case unknownVal:
+ return x
+ case int64Val, intVal, floatVal:
+ return int64Val(0)
+ case complexVal:
+ return normFloat(x.im)
+ }
+ panic(fmt.Sprintf("%v not numeric", x))
+}
+
+// ----------------------------------------------------------------------------
+// Operations
+
+// is32bit reports whether x can be represented using 32 bits.
+func is32bit(x int64) bool {
+ const s = 32
+ return -1<<(s-1) <= x && x <= 1<<(s-1)-1
+}
+
+// is63bit reports whether x can be represented using 63 bits.
+func is63bit(x int64) bool {
+ const s = 63
+ return -1<<(s-1) <= x && x <= 1<<(s-1)-1
+}
+
+// UnaryOp returns the result of the unary expression op y.
+// The operation must be defined for the operand.
+// If size >= 0 it specifies the ^ (xor) result size in bytes.
+// If y is Unknown, the result is Unknown.
+//
+func UnaryOp(op token.Token, y Value, size int) Value {
+ switch op {
+ case token.ADD:
+ switch y.(type) {
+ case unknownVal, int64Val, intVal, floatVal, complexVal:
+ return y
+ }
+
+ case token.SUB:
+ switch y := y.(type) {
+ case unknownVal:
+ return y
+ case int64Val:
+ if z := -y; z != y {
+ return z // no overflow
+ }
+ return normInt(new(big.Int).Neg(big.NewInt(int64(y))))
+ case intVal:
+ return normInt(new(big.Int).Neg(y.val))
+ case floatVal:
+ return normFloat(new(big.Rat).Neg(y.val))
+ case complexVal:
+ return normComplex(new(big.Rat).Neg(y.re), new(big.Rat).Neg(y.im))
+ }
+
+ case token.XOR:
+ var z big.Int
+ switch y := y.(type) {
+ case unknownVal:
+ return y
+ case int64Val:
+ z.Not(big.NewInt(int64(y)))
+ case intVal:
+ z.Not(y.val)
+ default:
+ goto Error
+ }
+ // For unsigned types, the result will be negative and
+ // thus "too large": We must limit the result size to
+ // the type's size.
+ if size >= 0 {
+ s := uint(size) * 8
+ z.AndNot(&z, new(big.Int).Lsh(big.NewInt(-1), s)) // z &^= (-1)< ord(y) {
+ y, x = match(y, x)
+ return x, y
+ }
+ // ord(x) <= ord(y)
+
+ switch x := x.(type) {
+ case unknownVal:
+ return x, x
+
+ case boolVal, stringVal, complexVal:
+ return x, y
+
+ case int64Val:
+ switch y := y.(type) {
+ case int64Val:
+ return x, y
+ case intVal:
+ return intVal{big.NewInt(int64(x))}, y
+ case floatVal:
+ return floatVal{big.NewRat(int64(x), 1)}, y
+ case complexVal:
+ return complexVal{big.NewRat(int64(x), 1), rat0}, y
+ }
+
+ case intVal:
+ switch y := y.(type) {
+ case intVal:
+ return x, y
+ case floatVal:
+ return floatVal{new(big.Rat).SetFrac(x.val, int1)}, y
+ case complexVal:
+ return complexVal{new(big.Rat).SetFrac(x.val, int1), rat0}, y
+ }
+
+ case floatVal:
+ switch y := y.(type) {
+ case floatVal:
+ return x, y
+ case complexVal:
+ return complexVal{x.val, rat0}, y
+ }
+ }
+
+ panic("unreachable")
+}
+
+// BinaryOp returns the result of the binary expression x op y.
+// The operation must be defined for the operands. If one of the
+// operands is Unknown, the result is Unknown.
+// To force integer division of Int operands, use op == token.QUO_ASSIGN
+// instead of token.QUO; the result is guaranteed to be Int in this case.
+// Division by zero leads to a run-time panic.
+//
+func BinaryOp(x Value, op token.Token, y Value) Value {
+ x, y = match(x, y)
+
+ switch x := x.(type) {
+ case unknownVal:
+ return x
+
+ case boolVal:
+ y := y.(boolVal)
+ switch op {
+ case token.LAND:
+ return x && y
+ case token.LOR:
+ return x || y
+ }
+
+ case int64Val:
+ a := int64(x)
+ b := int64(y.(int64Val))
+ var c int64
+ switch op {
+ case token.ADD:
+ if !is63bit(a) || !is63bit(b) {
+ return normInt(new(big.Int).Add(big.NewInt(a), big.NewInt(b)))
+ }
+ c = a + b
+ case token.SUB:
+ if !is63bit(a) || !is63bit(b) {
+ return normInt(new(big.Int).Sub(big.NewInt(a), big.NewInt(b)))
+ }
+ c = a - b
+ case token.MUL:
+ if !is32bit(a) || !is32bit(b) {
+ return normInt(new(big.Int).Mul(big.NewInt(a), big.NewInt(b)))
+ }
+ c = a * b
+ case token.QUO:
+ return normFloat(new(big.Rat).SetFrac(big.NewInt(a), big.NewInt(b)))
+ case token.QUO_ASSIGN: // force integer division
+ c = a / b
+ case token.REM:
+ c = a % b
+ case token.AND:
+ c = a & b
+ case token.OR:
+ c = a | b
+ case token.XOR:
+ c = a ^ b
+ case token.AND_NOT:
+ c = a &^ b
+ default:
+ goto Error
+ }
+ return int64Val(c)
+
+ case intVal:
+ a := x.val
+ b := y.(intVal).val
+ var c big.Int
+ switch op {
+ case token.ADD:
+ c.Add(a, b)
+ case token.SUB:
+ c.Sub(a, b)
+ case token.MUL:
+ c.Mul(a, b)
+ case token.QUO:
+ return normFloat(new(big.Rat).SetFrac(a, b))
+ case token.QUO_ASSIGN: // force integer division
+ c.Quo(a, b)
+ case token.REM:
+ c.Rem(a, b)
+ case token.AND:
+ c.And(a, b)
+ case token.OR:
+ c.Or(a, b)
+ case token.XOR:
+ c.Xor(a, b)
+ case token.AND_NOT:
+ c.AndNot(a, b)
+ default:
+ goto Error
+ }
+ return normInt(&c)
+
+ case floatVal:
+ a := x.val
+ b := y.(floatVal).val
+ var c big.Rat
+ switch op {
+ case token.ADD:
+ c.Add(a, b)
+ case token.SUB:
+ c.Sub(a, b)
+ case token.MUL:
+ c.Mul(a, b)
+ case token.QUO:
+ c.Quo(a, b)
+ default:
+ goto Error
+ }
+ return normFloat(&c)
+
+ case complexVal:
+ y := y.(complexVal)
+ a, b := x.re, x.im
+ c, d := y.re, y.im
+ var re, im big.Rat
+ switch op {
+ case token.ADD:
+ // (a+c) + i(b+d)
+ re.Add(a, c)
+ im.Add(b, d)
+ case token.SUB:
+ // (a-c) + i(b-d)
+ re.Sub(a, c)
+ im.Sub(b, d)
+ case token.MUL:
+ // (ac-bd) + i(bc+ad)
+ var ac, bd, bc, ad big.Rat
+ ac.Mul(a, c)
+ bd.Mul(b, d)
+ bc.Mul(b, c)
+ ad.Mul(a, d)
+ re.Sub(&ac, &bd)
+ im.Add(&bc, &ad)
+ case token.QUO:
+ // (ac+bd)/s + i(bc-ad)/s, with s = cc + dd
+ var ac, bd, bc, ad, s, cc, dd big.Rat
+ ac.Mul(a, c)
+ bd.Mul(b, d)
+ bc.Mul(b, c)
+ ad.Mul(a, d)
+ cc.Mul(c, c)
+ dd.Mul(d, d)
+ s.Add(&cc, &dd)
+ re.Add(&ac, &bd)
+ re.Quo(&re, &s)
+ im.Sub(&bc, &ad)
+ im.Quo(&im, &s)
+ default:
+ goto Error
+ }
+ return normComplex(&re, &im)
+
+ case stringVal:
+ if op == token.ADD {
+ return x + y.(stringVal)
+ }
+ }
+
+Error:
+ panic(fmt.Sprintf("invalid binary operation %v %s %v", x, op, y))
+}
+
+// Shift returns the result of the shift expression x op s
+// with op == token.SHL or token.SHR (<< or >>). x must be
+// an Int or an Unknown. If x is Unknown, the result is x.
+//
+func Shift(x Value, op token.Token, s uint) Value {
+ switch x := x.(type) {
+ case unknownVal:
+ return x
+
+ case int64Val:
+ if s == 0 {
+ return x
+ }
+ switch op {
+ case token.SHL:
+ z := big.NewInt(int64(x))
+ return normInt(z.Lsh(z, s))
+ case token.SHR:
+ return x >> s
+ }
+
+ case intVal:
+ if s == 0 {
+ return x
+ }
+ var z big.Int
+ switch op {
+ case token.SHL:
+ return normInt(z.Lsh(x.val, s))
+ case token.SHR:
+ return normInt(z.Rsh(x.val, s))
+ }
+ }
+
+ panic(fmt.Sprintf("invalid shift %v %s %d", x, op, s))
+}
+
+func cmpZero(x int, op token.Token) bool {
+ switch op {
+ case token.EQL:
+ return x == 0
+ case token.NEQ:
+ return x != 0
+ case token.LSS:
+ return x < 0
+ case token.LEQ:
+ return x <= 0
+ case token.GTR:
+ return x > 0
+ case token.GEQ:
+ return x >= 0
+ }
+ panic("unreachable")
+}
+
+// Compare returns the result of the comparison x op y.
+// The comparison must be defined for the operands.
+// If one of the operands is Unknown, the result is
+// false.
+//
+func Compare(x Value, op token.Token, y Value) bool {
+ x, y = match(x, y)
+
+ switch x := x.(type) {
+ case unknownVal:
+ return false
+
+ case boolVal:
+ y := y.(boolVal)
+ switch op {
+ case token.EQL:
+ return x == y
+ case token.NEQ:
+ return x != y
+ }
+
+ case int64Val:
+ y := y.(int64Val)
+ switch op {
+ case token.EQL:
+ return x == y
+ case token.NEQ:
+ return x != y
+ case token.LSS:
+ return x < y
+ case token.LEQ:
+ return x <= y
+ case token.GTR:
+ return x > y
+ case token.GEQ:
+ return x >= y
+ }
+
+ case intVal:
+ return cmpZero(x.val.Cmp(y.(intVal).val), op)
+
+ case floatVal:
+ return cmpZero(x.val.Cmp(y.(floatVal).val), op)
+
+ case complexVal:
+ y := y.(complexVal)
+ re := x.re.Cmp(y.re)
+ im := x.im.Cmp(y.im)
+ switch op {
+ case token.EQL:
+ return re == 0 && im == 0
+ case token.NEQ:
+ return re != 0 || im != 0
+ }
+
+ case stringVal:
+ y := y.(stringVal)
+ switch op {
+ case token.EQL:
+ return x == y
+ case token.NEQ:
+ return x != y
+ case token.LSS:
+ return x < y
+ case token.LEQ:
+ return x <= y
+ case token.GTR:
+ return x > y
+ case token.GEQ:
+ return x >= y
+ }
+ }
+
+ panic(fmt.Sprintf("invalid comparison %v %s %v", x, op, y))
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/exact/exact_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/exact/exact_test.go
new file mode 100644
index 0000000000..aa38a896c6
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/exact/exact_test.go
@@ -0,0 +1,375 @@
+// 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.
+
+package exact
+
+import (
+ "go/token"
+ "strings"
+ "testing"
+)
+
+// TODO(gri) expand this test framework
+
+var opTests = []string{
+ // unary operations
+ `+ 0 = 0`,
+ `+ ? = ?`,
+ `- 1 = -1`,
+ `- ? = ?`,
+ `^ 0 = -1`,
+ `^ ? = ?`,
+
+ `! true = false`,
+ `! false = true`,
+ `! ? = ?`,
+
+ // etc.
+
+ // binary operations
+ `"" + "" = ""`,
+ `"foo" + "" = "foo"`,
+ `"" + "bar" = "bar"`,
+ `"foo" + "bar" = "foobar"`,
+
+ `0 + 0 = 0`,
+ `0 + 0.1 = 0.1`,
+ `0 + 0.1i = 0.1i`,
+ `0.1 + 0.9 = 1`,
+ `1e100 + 1e100 = 2e100`,
+ `? + 0 = ?`,
+ `0 + ? = ?`,
+
+ `0 - 0 = 0`,
+ `0 - 0.1 = -0.1`,
+ `0 - 0.1i = -0.1i`,
+ `1e100 - 1e100 = 0`,
+ `? - 0 = ?`,
+ `0 - ? = ?`,
+
+ `0 * 0 = 0`,
+ `1 * 0.1 = 0.1`,
+ `1 * 0.1i = 0.1i`,
+ `1i * 1i = -1`,
+ `? * 0 = ?`,
+ `0 * ? = ?`,
+
+ `0 / 0 = "division_by_zero"`,
+ `10 / 2 = 5`,
+ `5 / 3 = 5/3`,
+ `5i / 3i = 5/3`,
+ `? / 0 = ?`,
+ `0 / ? = ?`,
+
+ `0 % 0 = "runtime_error:_integer_divide_by_zero"`, // TODO(gri) should be the same as for /
+ `10 % 3 = 1`,
+ `? % 0 = ?`,
+ `0 % ? = ?`,
+
+ `0 & 0 = 0`,
+ `12345 & 0 = 0`,
+ `0xff & 0xf = 0xf`,
+ `? & 0 = ?`,
+ `0 & ? = ?`,
+
+ `0 | 0 = 0`,
+ `12345 | 0 = 12345`,
+ `0xb | 0xa0 = 0xab`,
+ `? | 0 = ?`,
+ `0 | ? = ?`,
+
+ `0 ^ 0 = 0`,
+ `1 ^ -1 = -2`,
+ `? ^ 0 = ?`,
+ `0 ^ ? = ?`,
+
+ `0 &^ 0 = 0`,
+ `0xf &^ 1 = 0xe`,
+ `1 &^ 0xf = 0`,
+ // etc.
+
+ // shifts
+ `0 << 0 = 0`,
+ `1 << 10 = 1024`,
+ `0 >> 0 = 0`,
+ `1024 >> 10 == 1`,
+ `? << 0 == ?`,
+ `? >> 10 == ?`,
+ // etc.
+
+ // comparisons
+ `false == false = true`,
+ `false == true = false`,
+ `true == false = false`,
+ `true == true = true`,
+
+ `false != false = false`,
+ `false != true = true`,
+ `true != false = true`,
+ `true != true = false`,
+
+ `"foo" == "bar" = false`,
+ `"foo" != "bar" = true`,
+ `"foo" < "bar" = false`,
+ `"foo" <= "bar" = false`,
+ `"foo" > "bar" = true`,
+ `"foo" >= "bar" = true`,
+
+ `0 == 0 = true`,
+ `0 != 0 = false`,
+ `0 < 10 = true`,
+ `10 <= 10 = true`,
+ `0 > 10 = false`,
+ `10 >= 10 = true`,
+
+ `1/123456789 == 1/123456789 == true`,
+ `1/123456789 != 1/123456789 == false`,
+ `1/123456789 < 1/123456788 == true`,
+ `1/123456788 <= 1/123456789 == false`,
+ `0.11 > 0.11 = false`,
+ `0.11 >= 0.11 = true`,
+
+ `? == 0 = false`,
+ `? != 0 = false`,
+ `? < 10 = false`,
+ `? <= 10 = false`,
+ `? > 10 = false`,
+ `? >= 10 = false`,
+
+ `0 == ? = false`,
+ `0 != ? = false`,
+ `0 < ? = false`,
+ `10 <= ? = false`,
+ `0 > ? = false`,
+ `10 >= ? = false`,
+
+ // etc.
+}
+
+func TestOps(t *testing.T) {
+ for _, test := range opTests {
+ a := strings.Split(test, " ")
+ i := 0 // operator index
+
+ var x, x0 Value
+ switch len(a) {
+ case 4:
+ // unary operation
+ case 5:
+ // binary operation
+ x, x0 = val(a[0]), val(a[0])
+ i = 1
+ default:
+ t.Errorf("invalid test case: %s", test)
+ continue
+ }
+
+ op, ok := optab[a[i]]
+ if !ok {
+ panic("missing optab entry for " + a[i])
+ }
+
+ y, y0 := val(a[i+1]), val(a[i+1])
+
+ got := doOp(x, op, y)
+ want := val(a[i+3])
+ if !eql(got, want) {
+ t.Errorf("%s: got %s; want %s", test, got, want)
+ }
+ if x0 != nil && !eql(x, x0) {
+ t.Errorf("%s: x changed to %s", test, x)
+ }
+ if !eql(y, y0) {
+ t.Errorf("%s: y changed to %s", test, y)
+ }
+ }
+}
+
+func eql(x, y Value) bool {
+ _, ux := x.(unknownVal)
+ _, uy := y.(unknownVal)
+ if ux || uy {
+ return ux == uy
+ }
+ return Compare(x, token.EQL, y)
+}
+
+// ----------------------------------------------------------------------------
+// Support functions
+
+func val(lit string) Value {
+ if len(lit) == 0 {
+ return MakeUnknown()
+ }
+
+ switch lit {
+ case "?":
+ return MakeUnknown()
+ case "true":
+ return MakeBool(true)
+ case "false":
+ return MakeBool(false)
+ }
+
+ tok := token.INT
+ switch first, last := lit[0], lit[len(lit)-1]; {
+ case first == '"' || first == '`':
+ tok = token.STRING
+ lit = strings.Replace(lit, "_", " ", -1)
+ case first == '\'':
+ tok = token.CHAR
+ case last == 'i':
+ tok = token.IMAG
+ default:
+ if !strings.HasPrefix(lit, "0x") && strings.ContainsAny(lit, "./Ee") {
+ tok = token.FLOAT
+ }
+ }
+
+ return MakeFromLiteral(lit, tok)
+}
+
+var optab = map[string]token.Token{
+ "!": token.NOT,
+
+ "+": token.ADD,
+ "-": token.SUB,
+ "*": token.MUL,
+ "/": token.QUO,
+ "%": token.REM,
+
+ "<<": token.SHL,
+ ">>": token.SHR,
+
+ "&": token.AND,
+ "|": token.OR,
+ "^": token.XOR,
+ "&^": token.AND_NOT,
+
+ "==": token.EQL,
+ "!=": token.NEQ,
+ "<": token.LSS,
+ "<=": token.LEQ,
+ ">": token.GTR,
+ ">=": token.GEQ,
+}
+
+func panicHandler(v *Value) {
+ switch p := recover().(type) {
+ case nil:
+ // nothing to do
+ case string:
+ *v = MakeString(p)
+ case error:
+ *v = MakeString(p.Error())
+ default:
+ panic(p)
+ }
+}
+
+func doOp(x Value, op token.Token, y Value) (z Value) {
+ defer panicHandler(&z)
+
+ if x == nil {
+ return UnaryOp(op, y, -1)
+ }
+
+ switch op {
+ case token.EQL, token.NEQ, token.LSS, token.LEQ, token.GTR, token.GEQ:
+ return MakeBool(Compare(x, op, y))
+ case token.SHL, token.SHR:
+ s, _ := Int64Val(y)
+ return Shift(x, op, uint(s))
+ default:
+ return BinaryOp(x, op, y)
+ }
+}
+
+// ----------------------------------------------------------------------------
+// Other tests
+
+var fracTests = []string{
+ "0 0 1",
+ "1 1 1",
+ "-1 -1 1",
+ "1.2 6 5",
+ "-0.991 -991 1000",
+ "1e100 1e100 1",
+}
+
+func TestFractions(t *testing.T) {
+ for _, test := range fracTests {
+ a := strings.Split(test, " ")
+ if len(a) != 3 {
+ t.Errorf("invalid test case: %s", test)
+ continue
+ }
+
+ x := val(a[0])
+ n := val(a[1])
+ d := val(a[2])
+
+ if got := Num(x); !eql(got, n) {
+ t.Errorf("%s: got num = %s; want %s", test, got, n)
+ }
+
+ if got := Denom(x); !eql(got, d) {
+ t.Errorf("%s: got denom = %s; want %s", test, got, d)
+ }
+ }
+}
+
+var bytesTests = []string{
+ "0",
+ "1",
+ "123456789",
+ "123456789012345678901234567890123456789012345678901234567890",
+}
+
+func TestBytes(t *testing.T) {
+ for _, test := range bytesTests {
+ x := val(test)
+ bytes := Bytes(x)
+
+ // special case 0
+ if Sign(x) == 0 && len(bytes) != 0 {
+ t.Errorf("%s: got %v; want empty byte slice", test, bytes)
+ }
+
+ if n := len(bytes); n > 0 && bytes[n-1] == 0 {
+ t.Errorf("%s: got %v; want no leading 0 byte", test, bytes)
+ }
+
+ if got := MakeFromBytes(bytes); !eql(got, x) {
+ t.Errorf("%s: got %s; want %s (bytes = %v)", test, got, x, bytes)
+ }
+ }
+}
+
+func TestUnknown(t *testing.T) {
+ u := MakeUnknown()
+ var values = []Value{
+ u,
+ MakeBool(false), // token.ADD ok below, operation is never considered
+ MakeString(""),
+ MakeInt64(1),
+ MakeFromLiteral("-1234567890123456789012345678901234567890", token.INT),
+ MakeFloat64(1.2),
+ MakeImag(MakeFloat64(1.2)),
+ }
+ for _, val := range values {
+ x, y := val, u
+ for i := range [2]int{} {
+ if i == 1 {
+ x, y = y, x
+ }
+ if got := BinaryOp(x, token.ADD, y); got.Kind() != Unknown {
+ t.Errorf("%s + %s: got %s; want %s", x, y, got, u)
+ }
+ if got := Compare(x, token.EQL, y); got {
+ t.Errorf("%s == %s: got true; want false", x, y)
+ }
+ }
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/exact/go13.go b/Godeps/_workspace/src/golang.org/x/tools/go/exact/go13.go
new file mode 100644
index 0000000000..1016c14150
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/exact/go13.go
@@ -0,0 +1,24 @@
+// Copyright 2014 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.4
+
+package exact
+
+import (
+ "math"
+ "math/big"
+)
+
+func ratToFloat32(x *big.Rat) (float32, bool) {
+ // Before 1.4, there's no Rat.Float32.
+ // Emulate it, albeit at the cost of
+ // imprecision in corner cases.
+ x64, exact := x.Float64()
+ x32 := float32(x64)
+ if math.IsInf(float64(x32), 0) {
+ exact = false
+ }
+ return x32, exact
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/exact/go14.go b/Godeps/_workspace/src/golang.org/x/tools/go/exact/go14.go
new file mode 100644
index 0000000000..b86e5d2609
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/exact/go14.go
@@ -0,0 +1,13 @@
+// Copyright 2014 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.4
+
+package exact
+
+import "math/big"
+
+func ratToFloat32(x *big.Rat) (float32, bool) {
+ return x.Float32()
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/loader/cgo.go b/Godeps/_workspace/src/golang.org/x/tools/go/loader/cgo.go
new file mode 100644
index 0000000000..299e72579f
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/loader/cgo.go
@@ -0,0 +1,199 @@
+package loader
+
+// This file handles cgo preprocessing of files containing `import "C"`.
+//
+// DESIGN
+//
+// 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/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
+// downside is that the token.Position.Offset for each AST node is
+// incorrect, being an offset within the temporary file. Line numbers
+// should still be correct because of the //line comments.
+//
+// The logic of this file is mostly plundered from the 'go build'
+// tool, which also invokes the cgo preprocessor.
+//
+//
+// REJECTED ALTERNATIVE
+//
+// An alternative approach that we explored is to extend go/types'
+// Importer mechanism to provide the identity of the importing package
+// so that each time `import "C"` appears it resolves to a different
+// synthetic package containing just the objects needed in that case.
+// The loader would invoke cgo but parse only the cgo_types.go file
+// defining the package-level objects, discarding the other files
+// resulting from preprocessing.
+//
+// The benefit of this approach would have been that source-level
+// syntax information would correspond exactly to the original cgo
+// file, with no preprocessing involved, making source tools like
+// godoc, oracle, and eg happy. However, the approach was rejected
+// due to the additional complexity it would impose on go/types. (It
+// made for a beautiful demo, though.)
+//
+// cgo files, despite their *.go extension, are not legal Go source
+// files per the specification since they may refer to unexported
+// members of package "C" such as C.int. Also, a function such as
+// C.getpwent has in effect two types, one matching its C type and one
+// which additionally returns (errno C.int). The cgo preprocessor
+// uses name mangling to distinguish these two functions in the
+// processed code, but go/types would need to duplicate this logic in
+// its handling of function calls, analogous to the treatment of map
+// lookups in which y=m[k] and y,ok=m[k] are both legal.
+
+import (
+ "fmt"
+ "go/ast"
+ "go/build"
+ "go/parser"
+ "go/token"
+ "io/ioutil"
+ "log"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "regexp"
+ "strings"
+)
+
+// processCgoFiles invokes the cgo preprocessor on bp.CgoFiles, parses
+// the output and returns the resulting ASTs.
+//
+func processCgoFiles(bp *build.Package, fset *token.FileSet, DisplayPath func(path string) string, mode parser.Mode) ([]*ast.File, error) {
+ tmpdir, err := ioutil.TempDir("", strings.Replace(bp.ImportPath, "/", "_", -1)+"_C")
+ if err != nil {
+ return nil, err
+ }
+ defer os.RemoveAll(tmpdir)
+
+ pkgdir := bp.Dir
+ if DisplayPath != nil {
+ pkgdir = DisplayPath(pkgdir)
+ }
+
+ cgoFiles, cgoDisplayFiles, err := runCgo(bp, pkgdir, tmpdir)
+ if err != nil {
+ return nil, err
+ }
+ var files []*ast.File
+ for i := range cgoFiles {
+ rd, err := os.Open(cgoFiles[i])
+ if err != nil {
+ return nil, err
+ }
+ defer rd.Close()
+ display := filepath.Join(bp.Dir, cgoDisplayFiles[i])
+ f, err := parser.ParseFile(fset, display, rd, mode)
+ if err != nil {
+ return nil, err
+ }
+ files = append(files, f)
+ }
+ return files, nil
+}
+
+var cgoRe = regexp.MustCompile(`[/\\:]`)
+
+// runCgo invokes the cgo preprocessor on bp.CgoFiles and returns two
+// lists of files: the resulting processed files (in temporary
+// directory tmpdir) and the corresponding names of the unprocessed files.
+//
+// runCgo is adapted from (*builder).cgo in
+// $GOROOT/src/cmd/go/build.go, but these features are unsupported:
+// pkg-config, Objective C, CGOPKGPATH, CGO_FLAGS.
+//
+func runCgo(bp *build.Package, pkgdir, tmpdir string) (files, displayFiles []string, err error) {
+ cgoCPPFLAGS, _, _, _ := cflags(bp, true)
+ _, cgoexeCFLAGS, _, _ := cflags(bp, false)
+
+ if len(bp.CgoPkgConfig) > 0 {
+ return nil, nil, fmt.Errorf("cgo pkg-config not supported")
+ }
+
+ // Allows including _cgo_export.h from .[ch] files in the package.
+ cgoCPPFLAGS = append(cgoCPPFLAGS, "-I", tmpdir)
+
+ // _cgo_gotypes.go (displayed "C") contains the type definitions.
+ files = append(files, filepath.Join(tmpdir, "_cgo_gotypes.go"))
+ displayFiles = append(displayFiles, "C")
+ for _, fn := range bp.CgoFiles {
+ // "foo.cgo1.go" (displayed "foo.go") is the processed Go source.
+ f := cgoRe.ReplaceAllString(fn[:len(fn)-len("go")], "_")
+ files = append(files, filepath.Join(tmpdir, f+"cgo1.go"))
+ displayFiles = append(displayFiles, fn)
+ }
+
+ var cgoflags []string
+ if bp.Goroot && bp.ImportPath == "runtime/cgo" {
+ cgoflags = append(cgoflags, "-import_runtime_cgo=false")
+ }
+ if bp.Goroot && bp.ImportPath == "runtime/race" || bp.ImportPath == "runtime/cgo" {
+ cgoflags = append(cgoflags, "-import_syscall=false")
+ }
+
+ args := stringList(
+ "go", "tool", "cgo", "-objdir", tmpdir, cgoflags, "--",
+ cgoCPPFLAGS, cgoexeCFLAGS, bp.CgoFiles,
+ )
+ if false {
+ log.Printf("Running cgo for package %q: %s (dir=%s)", bp.ImportPath, args, pkgdir)
+ }
+ cmd := exec.Command(args[0], args[1:]...)
+ cmd.Dir = pkgdir
+ cmd.Stdout = os.Stderr
+ cmd.Stderr = os.Stderr
+ if err := cmd.Run(); err != nil {
+ return nil, nil, fmt.Errorf("cgo failed: %s: %s", args, err)
+ }
+
+ return files, displayFiles, nil
+}
+
+// -- unmodified from 'go build' ---------------------------------------
+
+// Return the flags to use when invoking the C or C++ compilers, or cgo.
+func cflags(p *build.Package, def bool) (cppflags, cflags, cxxflags, ldflags []string) {
+ var defaults string
+ if def {
+ defaults = "-g -O2"
+ }
+
+ cppflags = stringList(envList("CGO_CPPFLAGS", ""), p.CgoCPPFLAGS)
+ cflags = stringList(envList("CGO_CFLAGS", defaults), p.CgoCFLAGS)
+ cxxflags = stringList(envList("CGO_CXXFLAGS", defaults), p.CgoCXXFLAGS)
+ ldflags = stringList(envList("CGO_LDFLAGS", defaults), p.CgoLDFLAGS)
+ return
+}
+
+// envList returns the value of the given environment variable broken
+// into fields, using the default value when the variable is empty.
+func envList(key, def string) []string {
+ v := os.Getenv(key)
+ if v == "" {
+ v = def
+ }
+ return strings.Fields(v)
+}
+
+// stringList's arguments should be a sequence of string or []string values.
+// stringList flattens them into a single []string.
+func stringList(args ...interface{}) []string {
+ var x []string
+ for _, arg := range args {
+ switch arg := arg.(type) {
+ case []string:
+ x = append(x, arg...)
+ case string:
+ x = append(x, arg)
+ default:
+ panic("stringList: invalid argument")
+ }
+ }
+ return x
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/loader/doc.go b/Godeps/_workspace/src/golang.org/x/tools/go/loader/doc.go
new file mode 100644
index 0000000000..1ff4b15de9
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/loader/doc.go
@@ -0,0 +1,189 @@
+// 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.
+
+// Package loader loads a complete Go program from source code, parsing
+// and type-checking the initial packages plus their transitive closure
+// of dependencies. The ASTs and the derived facts are retained for
+// later use.
+//
+// THIS INTERFACE IS EXPERIMENTAL AND IS LIKELY TO CHANGE.
+//
+// The package defines two primary types: Config, which specifies a
+// set of initial packages to load and various other options; and
+// Program, which is the result of successfully loading the packages
+// specified by a configuration.
+//
+// The configuration can be set directly, but *Config provides various
+// convenience methods to simplify the common cases, each of which can
+// be called any number of times. Finally, these are followed by a
+// call to Load() to actually load and type-check the program.
+//
+// var conf loader.Config
+//
+// // Use the command-line arguments to specify
+// // a set of initial packages to load from source.
+// // See FromArgsUsage for help.
+// rest, err := conf.FromArgs(os.Args[1:], wantTests)
+//
+// // Parse the specified files and create an ad hoc package with path "foo".
+// // All files must have the same 'package' declaration.
+// conf.CreateFromFilenames("foo", "foo.go", "bar.go")
+//
+// // Create an ad hoc package with path "foo" from
+// // the specified already-parsed files.
+// // All ASTs must have the same 'package' declaration.
+// conf.CreateFromFiles("foo", parsedFiles)
+//
+// // Add "runtime" to the set of packages to be loaded.
+// conf.Import("runtime")
+//
+// // Adds "fmt" and "fmt_test" to the set of packages
+// // to be loaded. "fmt" will include *_test.go files.
+// conf.ImportWithTests("fmt")
+//
+// // Finally, load all the packages specified by the configuration.
+// prog, err := conf.Load()
+//
+// See examples_test.go for examples of API usage.
+//
+//
+// CONCEPTS AND TERMINOLOGY
+//
+// 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 $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
+// same directory. (go/build.Package calls these files XTestFiles.)
+//
+// An IMPORTABLE package is one that can be referred to by some import
+// spec. The Path() of each importable package is unique within a
+// Program.
+//
+// ad hoc packages and external test packages are NON-IMPORTABLE. The
+// Path() of an ad hoc package is inferred from the package
+// declarations of its files and is therefore not a unique package key.
+// For example, Config.CreatePkgs may specify two initial ad hoc
+// packages both called "main".
+//
+// An AUGMENTED package is an importable package P plus all the
+// *_test.go files with same 'package foo' declaration as P.
+// (go/build.Package calls these files TestFiles.)
+//
+// The INITIAL packages are those specified in the configuration. A
+// DEPENDENCY is a package loaded to satisfy an import in an initial
+// package or another dependency.
+//
+package loader
+
+// IMPLEMENTATION NOTES
+//
+// 'go test', in-package test files, and import cycles
+// ---------------------------------------------------
+//
+// An external test package may depend upon members of the augmented
+// package that are not in the unaugmented package, such as functions
+// that expose internals. (See bufio/export_test.go for an example.)
+// So, the loader must ensure that for each external test package
+// it loads, it also augments the corresponding non-test package.
+//
+// The import graph over n unaugmented packages must be acyclic; the
+// import graph over n-1 unaugmented packages plus one augmented
+// package must also be acyclic. ('go test' relies on this.) But the
+// import graph over n augmented packages may contain cycles.
+//
+// First, all the (unaugmented) non-test packages and their
+// dependencies are imported in the usual way; the loader reports an
+// error if it detects an import cycle.
+//
+// Then, each package P for which testing is desired is augmented by
+// the list P' of its in-package test files, by calling
+// (*types.Checker).Files. This arrangement ensures that P' may
+// reference definitions within P, but P may not reference definitions
+// within P'. Furthermore, P' may import any other package, including
+// ones that depend upon P, without an import cycle error.
+//
+// Consider two packages A and B, both of which have lists of
+// in-package test files we'll call A' and B', and which have the
+// following import graph edges:
+// B imports A
+// B' imports A
+// A' imports B
+// This last edge would be expected to create an error were it not
+// for the special type-checking discipline above.
+// Cycles of size greater than two are possible. For example:
+// compress/bzip2/bzip2_test.go (package bzip2) imports "io/ioutil"
+// io/ioutil/tempfile_test.go (package ioutil) imports "regexp"
+// regexp/exec_test.go (package regexp) imports "compress/bzip2"
+//
+//
+// Concurrency
+// -----------
+//
+// Let us define the import dependency graph as follows. Each node is a
+// list of files passed to (Checker).Files at once. Many of these lists
+// are the production code of an importable Go package, so those nodes
+// are labelled by the package's import path. The remaining nodes are
+// ad hoc packages and lists of in-package *_test.go files that augment
+// an importable package; those nodes have no label.
+//
+// The edges of the graph represent import statements appearing within a
+// file. An edge connects a node (a list of files) to the node it
+// imports, which is importable and thus always labelled.
+//
+// Loading is controlled by this dependency graph.
+//
+// To reduce I/O latency, we start loading a package's dependencies
+// asynchronously as soon as we've parsed its files and enumerated its
+// imports (scanImports). This performs a preorder traversal of the
+// import dependency graph.
+//
+// To exploit hardware parallelism, we type-check unrelated packages in
+// parallel, where "unrelated" means not ordered by the partial order of
+// the import dependency graph.
+//
+// We use a concurrency-safe blocking cache (importer.imported) to
+// record the results of type-checking, whether success or failure. An
+// entry is created in this cache by startLoad the first time the
+// package is imported. The first goroutine to request an entry becomes
+// responsible for completing the task and broadcasting completion to
+// subsequent requestors, which block until then.
+//
+// Type checking occurs in (parallel) postorder: we cannot type-check a
+// set of files until we have loaded and type-checked all of their
+// immediate dependencies (and thus all of their transitive
+// dependencies). If the input were guaranteed free of import cycles,
+// this would be trivial: we could simply wait for completion of the
+// dependencies and then invoke the typechecker.
+//
+// But as we saw in the 'go test' section above, some cycles in the
+// import graph over packages are actually legal, so long as the
+// cycle-forming edge originates in the in-package test files that
+// augment the package. This explains why the nodes of the import
+// dependency graph are not packages, but lists of files: the unlabelled
+// nodes avoid the cycles. Consider packages A and B where B imports A
+// and A's in-package tests AT import B. The naively constructed import
+// graph over packages would contain a cycle (A+AT) --> B --> (A+AT) but
+// the graph over lists of files is AT --> B --> A, where AT is an
+// unlabelled node.
+//
+// Awaiting completion of the dependencies in a cyclic graph would
+// deadlock, so we must materialize the import dependency graph (as
+// importer.graph) and check whether each import edge forms a cycle. If
+// x imports y, and the graph already contains a path from y to x, then
+// there is an import cycle, in which case the processing of x must not
+// wait for the completion of processing of y.
+//
+// When the type-checker makes a callback (doImport) to the loader for a
+// given import edge, there are two possible cases. In the normal case,
+// the dependency has already been completely type-checked; doImport
+// does a cache lookup and returns it. In the cyclic case, the entry in
+// the cache is still necessarily incomplete, indicating a cycle. We
+// perform the cycle check again to obtain the error message, and return
+// the error.
+//
+// The result of using concurrency is about a 2.5x speedup for stdlib_test.
+
+// TODO(adonovan): overhaul the package documentation.
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/loader/example_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/loader/example_test.go
new file mode 100644
index 0000000000..9fb5fdcfb2
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/loader/example_test.go
@@ -0,0 +1,170 @@
+// 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.
+
+package loader_test
+
+import (
+ "fmt"
+ "go/token"
+ "log"
+ "path/filepath"
+ "runtime"
+ "sort"
+
+ "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 {
+ 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]
+}
+
+// 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]
+ // strconv.Files: [atob.go atof.go atoi.go decimal.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 math math/rand os reflect runtime runtime/pprof sort strconv strconv_test strings sync sync/atomic syscall testing text/tabwriter time unicode unicode/utf8]
+ // strconv.Files: [atob.go atof.go atoi.go decimal.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 fp_test.go ftoa_test.go itoa_test.go quote_example_test.go quote_test.go strconv_test.go]
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/loader/loader.go b/Godeps/_workspace/src/golang.org/x/tools/go/loader/loader.go
new file mode 100644
index 0000000000..5555faacd5
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/loader/loader.go
@@ -0,0 +1,935 @@
+// 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.
+
+package loader
+
+// See doc.go for package documentation and implementation notes.
+
+import (
+ "errors"
+ "fmt"
+ "go/ast"
+ "go/build"
+ "go/parser"
+ "go/token"
+ "os"
+ "sort"
+ "strings"
+ "sync"
+ "time"
+
+ "golang.org/x/tools/go/ast/astutil"
+ "golang.org/x/tools/go/types"
+)
+
+const trace = false // show timing info for type-checking
+
+// Config specifies the configuration for loading a whole program from
+// Go source code.
+// The zero value for Config is a ready-to-use default configuration.
+type Config struct {
+ // Fset is the file set for the parser to use when loading the
+ // program. If nil, it may be lazily initialized by any
+ // method of Config.
+ Fset *token.FileSet
+
+ // ParserMode specifies the mode to be used by the parser when
+ // loading source packages.
+ ParserMode parser.Mode
+
+ // TypeChecker contains options relating to the type checker.
+ //
+ // The supplied IgnoreFuncBodies is not used; the effective
+ // value comes from the TypeCheckFuncBodies func below.
+ // The supplied Import function is not used either.
+ TypeChecker types.Config
+
+ // TypeCheckFuncBodies is a predicate over package import
+ // paths. A package for which the predicate is false will
+ // have its package-level declarations type checked, but not
+ // its function bodies; this can be used to quickly load
+ // dependencies from source. If nil, all func bodies are type
+ // checked.
+ TypeCheckFuncBodies func(string) bool
+
+ // If Build is non-nil, it is used to locate source packages.
+ // Otherwise &build.Default is used.
+ //
+ // By default, cgo is invoked to preprocess Go files that
+ // import the fake package "C". This behaviour can be
+ // disabled by setting CGO_ENABLED=0 in the environment prior
+ // to startup, or by setting Build.CgoEnabled=false.
+ Build *build.Context
+
+ // The current directory, used for resolving relative package
+ // references such as "./go/loader". If empty, os.Getwd will be
+ // used instead.
+ Cwd string
+
+ // If DisplayPath is non-nil, it is used to transform each
+ // file name obtained from Build.Import(). This can be used
+ // to prevent a virtualized build.Config's file names from
+ // leaking into the user interface.
+ DisplayPath func(path string) string
+
+ // If AllowErrors is true, Load will return a Program even
+ // if some of the its packages contained I/O, parser or type
+ // errors; such errors are accessible via PackageInfo.Errors. If
+ // false, Load will fail if any package had an error.
+ AllowErrors bool
+
+ // CreatePkgs specifies a list of non-importable initial
+ // packages to create. The resulting packages will appear in
+ // the corresponding elements of the Program.Created slice.
+ CreatePkgs []PkgSpec
+
+ // ImportPkgs specifies a set of initial packages to load from
+ // source. The map keys are package import paths, used to
+ // locate the package relative to $GOROOT.
+ //
+ // The map value indicates whether to load tests. If true, Load
+ // will add and type-check two lists of files to the package:
+ // non-test files followed by in-package *_test.go files. In
+ // addition, it will append the external test package (if any)
+ // to Program.Created.
+ ImportPkgs map[string]bool
+
+ // FindPackage is called during Load to create the build.Package
+ // for a given import path. If nil, a default implementation
+ // based on ctxt.Import is used. A client may use this hook to
+ // adapt to a proprietary build system that does not follow the
+ // "go build" layout conventions, for example.
+ //
+ // It must be safe to call concurrently from multiple goroutines.
+ FindPackage func(ctxt *build.Context, importPath string) (*build.Package, error)
+}
+
+// A PkgSpec specifies a non-importable package to be created by Load.
+// Files are processed first, but typically only one of Files and
+// Filenames is provided. The path needn't be globally unique.
+//
+type PkgSpec struct {
+ Path string // import path ("" => use package declaration)
+ Files []*ast.File // ASTs of already-parsed files
+ Filenames []string // names of files to be parsed
+}
+
+// A Program is a Go program loaded from source as specified by a Config.
+type Program struct {
+ Fset *token.FileSet // the file set for this program
+
+ // Created[i] contains the initial package whose ASTs or
+ // filenames were supplied by Config.CreatePkgs[i], followed by
+ // the external test package, if any, of each package in
+ // Config.ImportPkgs ordered by ImportPath.
+ Created []*PackageInfo
+
+ // Imported contains the initially imported packages,
+ // as specified by Config.ImportPkgs.
+ Imported map[string]*PackageInfo
+
+ // AllPackages contains the PackageInfo of every package
+ // encountered by Load: all initial packages and all
+ // dependencies, including incomplete ones.
+ AllPackages map[*types.Package]*PackageInfo
+
+ // importMap is the canonical mapping of import paths to
+ // packages. It contains all Imported initial packages, but not
+ // Created ones, and all imported dependencies.
+ importMap map[string]*types.Package
+}
+
+// PackageInfo holds the ASTs and facts derived by the type-checker
+// for a single package.
+//
+// Not mutated once exposed via the API.
+//
+type PackageInfo struct {
+ Pkg *types.Package
+ Importable bool // true if 'import "Pkg.Path()"' would resolve to this
+ TransitivelyErrorFree bool // true if Pkg and all its dependencies are free of errors
+ Files []*ast.File // syntax trees for the package's files
+ Errors []error // non-nil if the package had errors
+ types.Info // type-checker deductions.
+
+ checker *types.Checker // transient type-checker state
+ errorFunc func(error)
+}
+
+func (info *PackageInfo) String() string { return info.Pkg.Path() }
+
+func (info *PackageInfo) appendError(err error) {
+ if info.errorFunc != nil {
+ info.errorFunc(err)
+ } else {
+ fmt.Fprintln(os.Stderr, err)
+ }
+ info.Errors = append(info.Errors, err)
+}
+
+func (conf *Config) fset() *token.FileSet {
+ if conf.Fset == nil {
+ conf.Fset = token.NewFileSet()
+ }
+ return conf.Fset
+}
+
+// ParseFile is a convenience function (intended for testing) that invokes
+// the parser using the Config's FileSet, which is initialized if nil.
+//
+// src specifies the parser input as a string, []byte, or io.Reader, and
+// filename is its apparent name. If src is nil, the contents of
+// filename are read from the file system.
+//
+func (conf *Config) ParseFile(filename string, src interface{}) (*ast.File, error) {
+ // TODO(adonovan): use conf.build() etc like parseFiles does.
+ return parser.ParseFile(conf.fset(), filename, src, conf.ParserMode)
+}
+
+// FromArgsUsage is a partial usage message that applications calling
+// FromArgs may wish to include in their -help output.
+const FromArgsUsage = `
+ is a list of arguments denoting a set of initial packages.
+It may take one of two forms:
+
+1. A list of *.go source files.
+
+ All of the specified files are loaded, parsed and type-checked
+ as a single package. All the files must belong to the same directory.
+
+2. A list of import paths, each denoting a package.
+
+ The package's directory is found relative to the $GOROOT and
+ $GOPATH using similar logic to 'go build', and the *.go files in
+ that directory are loaded, parsed and type-checked as a single
+ package.
+
+ In addition, all *_test.go files in the directory are then loaded
+ and parsed. Those files whose package declaration equals that of
+ the non-*_test.go files are included in the primary package. Test
+ files whose package declaration ends with "_test" are type-checked
+ as another package, the 'external' test package, so that a single
+ import path may denote two packages. (Whether this behaviour is
+ enabled is tool-specific, and may depend on additional flags.)
+
+A '--' argument terminates the list of packages.
+`
+
+// FromArgs interprets args as a set of initial packages to load from
+// source and updates the configuration. It returns the list of
+// unconsumed arguments.
+//
+// It is intended for use in command-line interfaces that require a
+// set of initial packages to be specified; see FromArgsUsage message
+// for details.
+//
+// Only superficial errors are reported at this stage; errors dependent
+// on I/O are detected during Load.
+//
+func (conf *Config) FromArgs(args []string, xtest bool) ([]string, error) {
+ var rest []string
+ for i, arg := range args {
+ if arg == "--" {
+ rest = args[i+1:]
+ args = args[:i]
+ break // consume "--" and return the remaining args
+ }
+ }
+
+ if len(args) > 0 && strings.HasSuffix(args[0], ".go") {
+ // Assume args is a list of a *.go files
+ // denoting a single ad hoc package.
+ for _, arg := range args {
+ if !strings.HasSuffix(arg, ".go") {
+ return nil, fmt.Errorf("named files must be .go files: %s", arg)
+ }
+ }
+ conf.CreateFromFilenames("", args...)
+ } else {
+ // Assume args are directories each denoting a
+ // package and (perhaps) an external test, iff xtest.
+ for _, arg := range args {
+ if xtest {
+ conf.ImportWithTests(arg)
+ } else {
+ conf.Import(arg)
+ }
+ }
+ }
+
+ return rest, nil
+}
+
+// CreateFromFilenames is a convenience function that adds
+// a conf.CreatePkgs entry to create a package of the specified *.go
+// files.
+//
+func (conf *Config) CreateFromFilenames(path string, filenames ...string) {
+ conf.CreatePkgs = append(conf.CreatePkgs, PkgSpec{Path: path, Filenames: filenames})
+}
+
+// CreateFromFiles is a convenience function that adds a conf.CreatePkgs
+// entry to create package of the specified path and parsed files.
+//
+func (conf *Config) CreateFromFiles(path string, files ...*ast.File) {
+ conf.CreatePkgs = append(conf.CreatePkgs, PkgSpec{Path: path, Files: files})
+}
+
+// ImportWithTests is a convenience function that adds path to
+// ImportPkgs, the set of initial source packages located relative to
+// $GOPATH. The package will be augmented by any *_test.go files in
+// its directory that contain a "package x" (not "package x_test")
+// declaration.
+//
+// In addition, if any *_test.go files contain a "package x_test"
+// declaration, an additional package comprising just those files will
+// be added to CreatePkgs.
+//
+func (conf *Config) ImportWithTests(path string) { conf.addImport(path, true) }
+
+// Import is a convenience function that adds path to ImportPkgs, the
+// set of initial packages that will be imported from source.
+//
+func (conf *Config) Import(path string) { conf.addImport(path, false) }
+
+func (conf *Config) addImport(path string, tests bool) {
+ if path == "C" || path == "unsafe" {
+ return // ignore; not a real package
+ }
+ if conf.ImportPkgs == nil {
+ conf.ImportPkgs = make(map[string]bool)
+ }
+ conf.ImportPkgs[path] = conf.ImportPkgs[path] || tests
+}
+
+// PathEnclosingInterval returns the PackageInfo and ast.Node that
+// contain source interval [start, end), and all the node's ancestors
+// up to the AST root. It searches all ast.Files of all packages in prog.
+// exact is defined as for astutil.PathEnclosingInterval.
+//
+// The zero value is returned if not found.
+//
+func (prog *Program) PathEnclosingInterval(start, end token.Pos) (pkg *PackageInfo, path []ast.Node, exact bool) {
+ for _, info := range prog.AllPackages {
+ for _, f := range info.Files {
+ if f.Pos() == token.NoPos {
+ // This can happen if the parser saw
+ // too many errors and bailed out.
+ // (Use parser.AllErrors to prevent that.)
+ continue
+ }
+ if !tokenFileContainsPos(prog.Fset.File(f.Pos()), start) {
+ continue
+ }
+ if path, exact := astutil.PathEnclosingInterval(f, start, end); path != nil {
+ return info, path, exact
+ }
+ }
+ }
+ return nil, nil, false
+}
+
+// InitialPackages returns a new slice containing the set of initial
+// packages (Created + Imported) in unspecified order.
+//
+func (prog *Program) InitialPackages() []*PackageInfo {
+ infos := make([]*PackageInfo, 0, len(prog.Created)+len(prog.Imported))
+ infos = append(infos, prog.Created...)
+ for _, info := range prog.Imported {
+ infos = append(infos, info)
+ }
+ return infos
+}
+
+// Package returns the ASTs and results of type checking for the
+// specified package.
+func (prog *Program) Package(path string) *PackageInfo {
+ if info, ok := prog.AllPackages[prog.importMap[path]]; ok {
+ return info
+ }
+ for _, info := range prog.Created {
+ if path == info.Pkg.Path() {
+ return info
+ }
+ }
+ return nil
+}
+
+// ---------- Implementation ----------
+
+// importer holds the working state of the algorithm.
+type importer struct {
+ conf *Config // the client configuration
+ start time.Time // for logging
+
+ progMu sync.Mutex // guards prog
+ prog *Program // the resulting program
+
+ importedMu sync.Mutex // guards imported
+ imported map[string]*importInfo // all imported packages (incl. failures) by import path
+
+ // import dependency graph: graph[x][y] => x imports y
+ //
+ // Since non-importable packages cannot be cyclic, we ignore
+ // their imports, thus we only need the subgraph over importable
+ // packages. Nodes are identified by their import paths.
+ graphMu sync.Mutex
+ graph map[string]map[string]bool
+}
+
+// importInfo tracks the success or failure of a single import.
+//
+// Upon completion, exactly one of info and err is non-nil:
+// info on successful creation of a package, err otherwise.
+// A successful package may still contain type errors.
+//
+type importInfo struct {
+ path string // import path
+ mu sync.Mutex // guards the following fields prior to completion
+ info *PackageInfo // results of typechecking (including errors)
+ err error // reason for failure to create a package
+ complete sync.Cond // complete condition is that one of info, err is non-nil.
+}
+
+// awaitCompletion blocks until ii is complete,
+// i.e. the info and err fields are safe to inspect without a lock.
+// It is concurrency-safe and idempotent.
+func (ii *importInfo) awaitCompletion() {
+ ii.mu.Lock()
+ for ii.info == nil && ii.err == nil {
+ ii.complete.Wait()
+ }
+ ii.mu.Unlock()
+}
+
+// Complete marks ii as complete.
+// Its info and err fields will not be subsequently updated.
+func (ii *importInfo) Complete(info *PackageInfo, err error) {
+ ii.mu.Lock()
+ ii.info = info
+ ii.err = err
+ ii.complete.Broadcast()
+ ii.mu.Unlock()
+}
+
+// Load creates the initial packages specified by conf.{Create,Import}Pkgs,
+// loading their dependencies packages as needed.
+//
+// On success, Load returns a Program containing a PackageInfo for
+// each package. On failure, it returns an error.
+//
+// If AllowErrors is true, Load will return a Program even if some
+// packages contained I/O, parser or type errors, or if dependencies
+// were missing. (Such errors are accessible via PackageInfo.Errors. If
+// false, Load will fail if any package had an error.
+//
+// It is an error if no packages were loaded.
+//
+func (conf *Config) Load() (*Program, error) {
+ // Create a simple default error handler for parse/type errors.
+ if conf.TypeChecker.Error == nil {
+ conf.TypeChecker.Error = func(e error) { fmt.Fprintln(os.Stderr, e) }
+ }
+
+ // Set default working directory for relative package references.
+ if conf.Cwd == "" {
+ var err error
+ conf.Cwd, err = os.Getwd()
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ // Install default FindPackage hook using go/build logic.
+ if conf.FindPackage == nil {
+ conf.FindPackage = func(ctxt *build.Context, path string) (*build.Package, error) {
+ // TODO(adonovan): cache calls to build.Import
+ // so we don't do it three times per test package.
+ bp, err := ctxt.Import(path, conf.Cwd, 0)
+ if _, ok := err.(*build.NoGoError); ok {
+ return bp, nil // empty directory is not an error
+ }
+ return bp, err
+ }
+ }
+
+ prog := &Program{
+ Fset: conf.fset(),
+ Imported: make(map[string]*PackageInfo),
+ importMap: make(map[string]*types.Package),
+ AllPackages: make(map[*types.Package]*PackageInfo),
+ }
+
+ imp := importer{
+ conf: conf,
+ prog: prog,
+ imported: make(map[string]*importInfo),
+ start: time.Now(),
+ graph: make(map[string]map[string]bool),
+ }
+
+ // -- loading proper (concurrent phase) --------------------------------
+
+ var errpkgs []string // packages that contained errors
+
+ // Load the initially imported packages and their dependencies,
+ // in parallel.
+ for _, ii := range imp.loadAll("", conf.ImportPkgs) {
+ if ii.err != nil {
+ conf.TypeChecker.Error(ii.err) // failed to create package
+ errpkgs = append(errpkgs, ii.path)
+ continue
+ }
+ prog.Imported[ii.info.Pkg.Path()] = ii.info
+ }
+
+ // Augment the designated initial packages by their tests.
+ // Dependencies are loaded in parallel.
+ var xtestPkgs []*build.Package
+ for path, augment := range conf.ImportPkgs {
+ if !augment {
+ continue
+ }
+
+ bp, err := conf.FindPackage(conf.build(), path)
+ if err != nil {
+ // Package not found, or can't even parse package declaration.
+ // Already reported by previous loop; ignore it.
+ continue
+ }
+
+ // Needs external test package?
+ if len(bp.XTestGoFiles) > 0 {
+ xtestPkgs = append(xtestPkgs, bp)
+ }
+
+ imp.importedMu.Lock() // (unnecessary, we're sequential here)
+ info := imp.imported[path].info // must be non-nil, see above
+ imp.importedMu.Unlock()
+
+ // Parse the in-package test files.
+ files, errs := imp.conf.parsePackageFiles(bp, 't')
+ for _, err := range errs {
+ info.appendError(err)
+ }
+
+ // The test files augmenting package P cannot be imported,
+ // but may import packages that import P,
+ // so we must disable the cycle check.
+ imp.addFiles(info, files, false)
+ }
+
+ createPkg := func(path string, files []*ast.File, errs []error) {
+ info := imp.newPackageInfo(path)
+ for _, err := range errs {
+ info.appendError(err)
+ }
+
+ // Ad hoc packages are non-importable,
+ // so no cycle check is needed.
+ // addFiles loads dependencies in parallel.
+ imp.addFiles(info, files, false)
+ prog.Created = append(prog.Created, info)
+ }
+
+ // Create packages specified by conf.CreatePkgs.
+ for _, cp := range conf.CreatePkgs {
+ files, errs := parseFiles(conf.fset(), conf.build(), nil, ".", cp.Filenames, conf.ParserMode)
+ files = append(files, cp.Files...)
+
+ path := cp.Path
+ if path == "" {
+ if len(files) > 0 {
+ path = files[0].Name.Name
+ } else {
+ path = "(unnamed)"
+ }
+ }
+ createPkg(path, files, errs)
+ }
+
+ // Create external test packages.
+ sort.Sort(byImportPath(xtestPkgs))
+ for _, bp := range xtestPkgs {
+ files, errs := imp.conf.parsePackageFiles(bp, 'x')
+ createPkg(bp.ImportPath+"_test", files, errs)
+ }
+
+ // -- finishing up (sequential) ----------------------------------------
+
+ if len(prog.Imported)+len(prog.Created) == 0 {
+ return nil, errors.New("no initial packages were loaded")
+ }
+
+ // Create infos for indirectly imported packages.
+ // e.g. incomplete packages without syntax, loaded from export data.
+ for _, obj := range prog.importMap {
+ info := prog.AllPackages[obj]
+ if info == nil {
+ prog.AllPackages[obj] = &PackageInfo{Pkg: obj, Importable: true}
+ } else {
+ // finished
+ info.checker = nil
+ info.errorFunc = nil
+ }
+ }
+
+ if !conf.AllowErrors {
+ // Report errors in indirectly imported packages.
+ for _, info := range prog.AllPackages {
+ if len(info.Errors) > 0 {
+ errpkgs = append(errpkgs, info.Pkg.Path())
+ }
+ }
+ if errpkgs != nil {
+ var more string
+ if len(errpkgs) > 3 {
+ more = fmt.Sprintf(" and %d more", len(errpkgs)-3)
+ errpkgs = errpkgs[:3]
+ }
+ return nil, fmt.Errorf("couldn't load packages due to errors: %s%s",
+ strings.Join(errpkgs, ", "), more)
+ }
+ }
+
+ markErrorFreePackages(prog.AllPackages)
+
+ return prog, nil
+}
+
+type byImportPath []*build.Package
+
+func (b byImportPath) Len() int { return len(b) }
+func (b byImportPath) Less(i, j int) bool { return b[i].ImportPath < b[j].ImportPath }
+func (b byImportPath) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
+
+// markErrorFreePackages sets the TransitivelyErrorFree flag on all
+// applicable packages.
+func markErrorFreePackages(allPackages map[*types.Package]*PackageInfo) {
+ // Build the transpose of the import graph.
+ importedBy := make(map[*types.Package]map[*types.Package]bool)
+ for P := range allPackages {
+ for _, Q := range P.Imports() {
+ clients, ok := importedBy[Q]
+ if !ok {
+ clients = make(map[*types.Package]bool)
+ importedBy[Q] = clients
+ }
+ clients[P] = true
+ }
+ }
+
+ // Find all packages reachable from some error package.
+ reachable := make(map[*types.Package]bool)
+ var visit func(*types.Package)
+ visit = func(p *types.Package) {
+ if !reachable[p] {
+ reachable[p] = true
+ for q := range importedBy[p] {
+ visit(q)
+ }
+ }
+ }
+ for _, info := range allPackages {
+ if len(info.Errors) > 0 {
+ visit(info.Pkg)
+ }
+ }
+
+ // Mark the others as "transitively error-free".
+ for _, info := range allPackages {
+ if !reachable[info.Pkg] {
+ info.TransitivelyErrorFree = true
+ }
+ }
+}
+
+// build returns the effective build context.
+func (conf *Config) build() *build.Context {
+ if conf.Build != nil {
+ return conf.Build
+ }
+ return &build.Default
+}
+
+// parsePackageFiles enumerates the files belonging to package path,
+// then loads, parses and returns them, plus a list of I/O or parse
+// errors that were encountered.
+//
+// 'which' indicates which files to include:
+// 'g': include non-test *.go source files (GoFiles + processed CgoFiles)
+// 't': include in-package *_test.go source files (TestGoFiles)
+// 'x': include external *_test.go source files. (XTestGoFiles)
+//
+func (conf *Config) parsePackageFiles(bp *build.Package, which rune) ([]*ast.File, []error) {
+ var filenames []string
+ switch which {
+ case 'g':
+ filenames = bp.GoFiles
+ case 't':
+ filenames = bp.TestGoFiles
+ case 'x':
+ filenames = bp.XTestGoFiles
+ default:
+ panic(which)
+ }
+
+ files, errs := parseFiles(conf.fset(), conf.build(), conf.DisplayPath, bp.Dir, filenames, conf.ParserMode)
+
+ // Preprocess CgoFiles and parse the outputs (sequentially).
+ if which == 'g' && bp.CgoFiles != nil {
+ cgofiles, err := processCgoFiles(bp, conf.fset(), conf.DisplayPath, conf.ParserMode)
+ if err != nil {
+ errs = append(errs, err)
+ } else {
+ files = append(files, cgofiles...)
+ }
+ }
+
+ return files, errs
+}
+
+// doImport imports the package denoted by path.
+// It implements the types.Importer signature.
+//
+// imports is the type-checker's package canonicalization map.
+//
+// It returns an error if a package could not be created
+// (e.g. go/build or parse error), but type errors are reported via
+// the types.Config.Error callback (the first of which is also saved
+// in the package's PackageInfo).
+//
+// Idempotent.
+//
+func (imp *importer) doImport(from *PackageInfo, to string) (*types.Package, error) {
+ // Package unsafe is handled specially, and has no PackageInfo.
+ // TODO(adonovan): move this check into go/types?
+ if to == "unsafe" {
+ return types.Unsafe, nil
+ }
+ if to == "C" {
+ // This should be unreachable, but ad hoc packages are
+ // not currently subject to cgo preprocessing.
+ // See https://github.com/golang/go/issues/11627.
+ return nil, fmt.Errorf(`the loader doesn't cgo-process ad hoc packages like %q; see Go issue 11627`,
+ from.Pkg.Path())
+ }
+
+ imp.importedMu.Lock()
+ ii := imp.imported[to]
+ imp.importedMu.Unlock()
+ if ii == nil {
+ panic("internal error: unexpected import: " + to)
+ }
+ if ii.err != nil {
+ return nil, ii.err
+ }
+ if ii.info != nil {
+ return ii.info.Pkg, nil
+ }
+
+ // Import of incomplete package: this indicates a cycle.
+ fromPath := from.Pkg.Path()
+ if cycle := imp.findPath(to, fromPath); cycle != nil {
+ cycle = append([]string{fromPath}, cycle...)
+ return nil, fmt.Errorf("import cycle: %s", strings.Join(cycle, " -> "))
+ }
+
+ panic("internal error: import of incomplete (yet acyclic) package: " + fromPath)
+}
+
+// loadAll loads, parses, and type-checks the specified packages in
+// parallel and returns their completed importInfos in unspecified order.
+//
+// fromPath is the import path of the importing package, if it is
+// importable, "" otherwise. It is used for cycle detection.
+//
+func (imp *importer) loadAll(fromPath string, paths map[string]bool) []*importInfo {
+ result := make([]*importInfo, 0, len(paths))
+ for path := range paths {
+ result = append(result, imp.startLoad(path))
+ }
+
+ if fromPath != "" {
+ // We're loading a set of imports.
+ //
+ // We must record graph edges from the importing package
+ // to its dependencies, and check for cycles.
+ imp.graphMu.Lock()
+ deps, ok := imp.graph[fromPath]
+ if !ok {
+ deps = make(map[string]bool)
+ imp.graph[fromPath] = deps
+ }
+ for path := range paths {
+ deps[path] = true
+ }
+ imp.graphMu.Unlock()
+ }
+
+ for _, ii := range result {
+ if fromPath != "" {
+ if cycle := imp.findPath(ii.path, fromPath); cycle != nil {
+ // Cycle-forming import: we must not await its
+ // completion since it would deadlock.
+ //
+ // We don't record the error in ii since
+ // the error is really associated with the
+ // cycle-forming edge, not the package itself.
+ // (Also it would complicate the
+ // invariants of importPath completion.)
+ if trace {
+ fmt.Fprintln(os.Stderr, "import cycle: %q", cycle)
+ }
+ continue
+ }
+ }
+ ii.awaitCompletion()
+
+ }
+ return result
+}
+
+// findPath returns an arbitrary path from 'from' to 'to' in the import
+// graph, or nil if there was none.
+func (imp *importer) findPath(from, to string) []string {
+ imp.graphMu.Lock()
+ defer imp.graphMu.Unlock()
+
+ seen := make(map[string]bool)
+ var search func(stack []string, importPath string) []string
+ search = func(stack []string, importPath string) []string {
+ if !seen[importPath] {
+ seen[importPath] = true
+ stack = append(stack, importPath)
+ if importPath == to {
+ return stack
+ }
+ for x := range imp.graph[importPath] {
+ if p := search(stack, x); p != nil {
+ return p
+ }
+ }
+ }
+ return nil
+ }
+ return search(make([]string, 0, 20), from)
+}
+
+// startLoad initiates the loading, parsing and type-checking of the
+// specified package and its dependencies, if it has not already begun.
+//
+// It returns an importInfo, not necessarily in a completed state. The
+// caller must call awaitCompletion() before accessing its info and err
+// fields.
+//
+// startLoad is concurrency-safe and idempotent.
+//
+// Precondition: path != "unsafe".
+//
+func (imp *importer) startLoad(path string) *importInfo {
+ imp.importedMu.Lock()
+ ii, ok := imp.imported[path]
+ if !ok {
+ ii = &importInfo{path: path}
+ ii.complete.L = &ii.mu
+ imp.imported[path] = ii
+ go func() {
+ ii.Complete(imp.load(path))
+ }()
+ }
+ imp.importedMu.Unlock()
+
+ return ii
+}
+
+// load implements package loading by parsing Go source files
+// located by go/build.
+//
+func (imp *importer) load(path string) (*PackageInfo, error) {
+ bp, err := imp.conf.FindPackage(imp.conf.build(), path)
+ if err != nil {
+ return nil, err // package not found
+ }
+ info := imp.newPackageInfo(bp.ImportPath)
+ info.Importable = true
+ files, errs := imp.conf.parsePackageFiles(bp, 'g')
+ for _, err := range errs {
+ info.appendError(err)
+ }
+
+ imp.addFiles(info, files, true)
+
+ imp.progMu.Lock()
+ imp.prog.importMap[path] = info.Pkg
+ imp.progMu.Unlock()
+
+ return info, nil
+}
+
+// addFiles adds and type-checks the specified files to info, loading
+// their dependencies if needed. The order of files determines the
+// package initialization order. It may be called multiple times on the
+// same package. Errors are appended to the info.Errors field.
+//
+// cycleCheck determines whether the imports within files create
+// dependency edges that should be checked for potential cycles.
+//
+func (imp *importer) addFiles(info *PackageInfo, files []*ast.File, cycleCheck bool) {
+ info.Files = append(info.Files, files...)
+
+ // Ensure the dependencies are loaded, in parallel.
+ var fromPath string
+ if cycleCheck {
+ fromPath = info.Pkg.Path()
+ }
+ imp.loadAll(fromPath, scanImports(files))
+
+ if trace {
+ fmt.Fprintf(os.Stderr, "%s: start %q (%d)\n",
+ time.Since(imp.start), info.Pkg.Path(), len(files))
+ }
+
+ // Ignore the returned (first) error since we
+ // already collect them all in the PackageInfo.
+ info.checker.Files(files)
+
+ if trace {
+ fmt.Fprintf(os.Stderr, "%s: stop %q\n",
+ time.Since(imp.start), info.Pkg.Path())
+ }
+}
+
+func (imp *importer) newPackageInfo(path string) *PackageInfo {
+ pkg := types.NewPackage(path, "")
+ info := &PackageInfo{
+ Pkg: pkg,
+ Info: types.Info{
+ Types: make(map[ast.Expr]types.TypeAndValue),
+ Defs: make(map[*ast.Ident]types.Object),
+ Uses: make(map[*ast.Ident]types.Object),
+ Implicits: make(map[ast.Node]types.Object),
+ Scopes: make(map[ast.Node]*types.Scope),
+ Selections: make(map[*ast.SelectorExpr]*types.Selection),
+ },
+ errorFunc: imp.conf.TypeChecker.Error,
+ }
+
+ // Copy the types.Config so we can vary it across PackageInfos.
+ tc := imp.conf.TypeChecker
+ tc.IgnoreFuncBodies = false
+ if f := imp.conf.TypeCheckFuncBodies; f != nil {
+ tc.IgnoreFuncBodies = !f(path)
+ }
+ tc.Import = func(_ map[string]*types.Package, to string) (*types.Package, error) {
+ return imp.doImport(info, to)
+ }
+ tc.Error = info.appendError // appendError wraps the user's Error function
+
+ info.checker = types.NewChecker(&tc, imp.conf.fset(), pkg, &info.Info)
+ imp.progMu.Lock()
+ imp.prog.AllPackages[pkg] = info
+ imp.progMu.Unlock()
+ return info
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/loader/loader_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/loader/loader_test.go
new file mode 100644
index 0000000000..0b42e398d5
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/loader/loader_test.go
@@ -0,0 +1,669 @@
+// 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.
+
+package loader_test
+
+import (
+ "fmt"
+ "go/build"
+ "reflect"
+ "sort"
+ "strings"
+ "sync"
+ "testing"
+
+ "golang.org/x/tools/go/buildutil"
+ "golang.org/x/tools/go/loader"
+)
+
+// TestFromArgs checks that conf.FromArgs populates conf correctly.
+// It does no I/O.
+func TestFromArgs(t *testing.T) {
+ type result struct {
+ Err string
+ Rest []string
+ ImportPkgs map[string]bool
+ CreatePkgs []loader.PkgSpec
+ }
+ for _, test := range []struct {
+ args []string
+ tests bool
+ want result
+ }{
+ // Mix of existing and non-existent packages.
+ {
+ args: []string{"nosuchpkg", "errors"},
+ want: result{
+ ImportPkgs: map[string]bool{"errors": false, "nosuchpkg": false},
+ },
+ },
+ // Same, with -test flag.
+ {
+ args: []string{"nosuchpkg", "errors"},
+ tests: true,
+ want: result{
+ ImportPkgs: map[string]bool{"errors": true, "nosuchpkg": true},
+ },
+ },
+ // Surplus arguments.
+ {
+ args: []string{"fmt", "errors", "--", "surplus"},
+ want: result{
+ Rest: []string{"surplus"},
+ ImportPkgs: map[string]bool{"errors": false, "fmt": false},
+ },
+ },
+ // Ad hoc package specified as *.go files.
+ {
+ args: []string{"foo.go", "bar.go"},
+ want: result{CreatePkgs: []loader.PkgSpec{{
+ Filenames: []string{"foo.go", "bar.go"},
+ }}},
+ },
+ // Mixture of *.go and import paths.
+ {
+ args: []string{"foo.go", "fmt"},
+ want: result{
+ Err: "named files must be .go files: fmt",
+ },
+ },
+ } {
+ var conf loader.Config
+ rest, err := conf.FromArgs(test.args, test.tests)
+ got := result{
+ Rest: rest,
+ ImportPkgs: conf.ImportPkgs,
+ CreatePkgs: conf.CreatePkgs,
+ }
+ if err != nil {
+ got.Err = err.Error()
+ }
+ if !reflect.DeepEqual(got, test.want) {
+ t.Errorf("FromArgs(%q) = %+v, want %+v", test.args, got, test.want)
+ }
+ }
+}
+
+func TestLoad_NoInitialPackages(t *testing.T) {
+ var conf loader.Config
+
+ const wantErr = "no initial packages were loaded"
+
+ prog, err := conf.Load()
+ if err == nil {
+ t.Errorf("Load succeeded unexpectedly, want %q", wantErr)
+ } else if err.Error() != wantErr {
+ t.Errorf("Load failed with wrong error %q, want %q", err, wantErr)
+ }
+ if prog != nil {
+ t.Errorf("Load unexpectedly returned a Program")
+ }
+}
+
+func TestLoad_MissingInitialPackage(t *testing.T) {
+ var conf loader.Config
+ conf.Import("nosuchpkg")
+ conf.Import("errors")
+
+ const wantErr = "couldn't load packages due to errors: nosuchpkg"
+
+ prog, err := conf.Load()
+ if err == nil {
+ t.Errorf("Load succeeded unexpectedly, want %q", wantErr)
+ } else if err.Error() != wantErr {
+ t.Errorf("Load failed with wrong error %q, want %q", err, wantErr)
+ }
+ if prog != nil {
+ t.Errorf("Load unexpectedly returned a Program")
+ }
+}
+
+func TestLoad_MissingInitialPackage_AllowErrors(t *testing.T) {
+ var conf loader.Config
+ conf.AllowErrors = true
+ conf.Import("nosuchpkg")
+ conf.ImportWithTests("errors")
+
+ prog, err := conf.Load()
+ if err != nil {
+ t.Errorf("Load failed unexpectedly: %v", err)
+ }
+ if prog == nil {
+ t.Fatalf("Load returned a nil Program")
+ }
+ if got, want := created(prog), "errors_test"; got != want {
+ t.Errorf("Created = %s, want %s", got, want)
+ }
+ if got, want := imported(prog), "errors"; got != want {
+ t.Errorf("Imported = %s, want %s", got, want)
+ }
+}
+
+func TestCreateUnnamedPackage(t *testing.T) {
+ var conf loader.Config
+ conf.CreateFromFilenames("")
+ prog, err := conf.Load()
+ if err != nil {
+ t.Fatalf("Load failed: %v", err)
+ }
+ if got, want := fmt.Sprint(prog.InitialPackages()), "[(unnamed)]"; got != want {
+ t.Errorf("InitialPackages = %s, want %s", got, want)
+ }
+}
+
+func TestLoad_MissingFileInCreatedPackage(t *testing.T) {
+ var conf loader.Config
+ conf.CreateFromFilenames("", "missing.go")
+
+ const wantErr = "couldn't load packages due to errors: (unnamed)"
+
+ prog, err := conf.Load()
+ if prog != nil {
+ t.Errorf("Load unexpectedly returned a Program")
+ }
+ if err == nil {
+ t.Fatalf("Load succeeded unexpectedly, want %q", wantErr)
+ }
+ if err.Error() != wantErr {
+ t.Fatalf("Load failed with wrong error %q, want %q", err, wantErr)
+ }
+}
+
+func TestLoad_MissingFileInCreatedPackage_AllowErrors(t *testing.T) {
+ conf := loader.Config{AllowErrors: true}
+ conf.CreateFromFilenames("", "missing.go")
+
+ prog, err := conf.Load()
+ if err != nil {
+ t.Errorf("Load failed: %v", err)
+ }
+ if got, want := fmt.Sprint(prog.InitialPackages()), "[(unnamed)]"; got != want {
+ t.Fatalf("InitialPackages = %s, want %s", got, want)
+ }
+}
+
+func TestLoad_ParseError(t *testing.T) {
+ var conf loader.Config
+ conf.CreateFromFilenames("badpkg", "testdata/badpkgdecl.go")
+
+ const wantErr = "couldn't load packages due to errors: badpkg"
+
+ prog, err := conf.Load()
+ if prog != nil {
+ t.Errorf("Load unexpectedly returned a Program")
+ }
+ if err == nil {
+ t.Fatalf("Load succeeded unexpectedly, want %q", wantErr)
+ }
+ if err.Error() != wantErr {
+ t.Fatalf("Load failed with wrong error %q, want %q", err, wantErr)
+ }
+}
+
+func TestLoad_ParseError_AllowErrors(t *testing.T) {
+ var conf loader.Config
+ conf.AllowErrors = true
+ conf.CreateFromFilenames("badpkg", "testdata/badpkgdecl.go")
+
+ prog, err := conf.Load()
+ if err != nil {
+ t.Errorf("Load failed unexpectedly: %v", err)
+ }
+ if prog == nil {
+ t.Fatalf("Load returned a nil Program")
+ }
+ if got, want := created(prog), "badpkg"; got != want {
+ t.Errorf("Created = %s, want %s", got, want)
+ }
+
+ badpkg := prog.Created[0]
+ if len(badpkg.Files) != 1 {
+ t.Errorf("badpkg has %d files, want 1", len(badpkg.Files))
+ }
+ wantErr := "testdata/badpkgdecl.go:1:34: expected 'package', found 'EOF'"
+ if !hasError(badpkg.Errors, wantErr) {
+ t.Errorf("badpkg.Errors = %v, want %s", badpkg.Errors, wantErr)
+ }
+}
+
+func TestLoad_FromSource_Success(t *testing.T) {
+ var conf loader.Config
+ conf.CreateFromFilenames("P", "testdata/a.go", "testdata/b.go")
+
+ prog, err := conf.Load()
+ if err != nil {
+ t.Errorf("Load failed unexpectedly: %v", err)
+ }
+ if prog == nil {
+ t.Fatalf("Load returned a nil Program")
+ }
+ if got, want := created(prog), "P"; got != want {
+ t.Errorf("Created = %s, want %s", got, want)
+ }
+}
+
+func TestLoad_FromImports_Success(t *testing.T) {
+ var conf loader.Config
+ conf.ImportWithTests("fmt")
+ conf.ImportWithTests("errors")
+
+ prog, err := conf.Load()
+ if err != nil {
+ t.Errorf("Load failed unexpectedly: %v", err)
+ }
+ if prog == nil {
+ t.Fatalf("Load returned a nil Program")
+ }
+ if got, want := created(prog), "errors_test fmt_test"; got != want {
+ t.Errorf("Created = %q, want %s", got, want)
+ }
+ if got, want := imported(prog), "errors fmt"; got != want {
+ t.Errorf("Imported = %s, want %s", got, want)
+ }
+ // Check set of transitive packages.
+ // There are >30 and the set may grow over time, so only check a few.
+ want := map[string]bool{
+ "strings": true,
+ "time": true,
+ "runtime": true,
+ "testing": true,
+ "unicode": true,
+ }
+ for _, path := range all(prog) {
+ delete(want, path)
+ }
+ if len(want) > 0 {
+ t.Errorf("AllPackages is missing these keys: %q", keys(want))
+ }
+}
+
+func TestLoad_MissingIndirectImport(t *testing.T) {
+ pkgs := map[string]string{
+ "a": `package a; import _ "b"`,
+ "b": `package b; import _ "c"`,
+ }
+ conf := loader.Config{Build: fakeContext(pkgs)}
+ conf.Import("a")
+
+ const wantErr = "couldn't load packages due to errors: b"
+
+ prog, err := conf.Load()
+ if err == nil {
+ t.Errorf("Load succeeded unexpectedly, want %q", wantErr)
+ } else if err.Error() != wantErr {
+ t.Errorf("Load failed with wrong error %q, want %q", err, wantErr)
+ }
+ if prog != nil {
+ t.Errorf("Load unexpectedly returned a Program")
+ }
+}
+
+func TestLoad_BadDependency_AllowErrors(t *testing.T) {
+ for _, test := range []struct {
+ descr string
+ pkgs map[string]string
+ wantPkgs string
+ }{
+
+ {
+ descr: "missing dependency",
+ pkgs: map[string]string{
+ "a": `package a; import _ "b"`,
+ "b": `package b; import _ "c"`,
+ },
+ wantPkgs: "a b",
+ },
+ {
+ descr: "bad package decl in dependency",
+ pkgs: map[string]string{
+ "a": `package a; import _ "b"`,
+ "b": `package b; import _ "c"`,
+ "c": `package`,
+ },
+ wantPkgs: "a b",
+ },
+ {
+ descr: "parse error in dependency",
+ pkgs: map[string]string{
+ "a": `package a; import _ "b"`,
+ "b": `package b; import _ "c"`,
+ "c": `package c; var x = `,
+ },
+ wantPkgs: "a b c",
+ },
+ } {
+ conf := loader.Config{
+ AllowErrors: true,
+ Build: fakeContext(test.pkgs),
+ }
+ conf.Import("a")
+
+ prog, err := conf.Load()
+ if err != nil {
+ t.Errorf("%s: Load failed unexpectedly: %v", test.descr, err)
+ }
+ if prog == nil {
+ t.Fatalf("%s: Load returned a nil Program", test.descr)
+ }
+
+ if got, want := imported(prog), "a"; got != want {
+ t.Errorf("%s: Imported = %s, want %s", test.descr, got, want)
+ }
+ if got := all(prog); strings.Join(got, " ") != test.wantPkgs {
+ t.Errorf("%s: AllPackages = %s, want %s", test.descr, got, test.wantPkgs)
+ }
+ }
+}
+
+func TestCwd(t *testing.T) {
+ ctxt := fakeContext(map[string]string{"one/two/three": `package three`})
+ for _, test := range []struct {
+ cwd, arg, want string
+ }{
+ {cwd: "/go/src/one", arg: "./two/three", want: "one/two/three"},
+ {cwd: "/go/src/one", arg: "../one/two/three", want: "one/two/three"},
+ {cwd: "/go/src/one", arg: "one/two/three", want: "one/two/three"},
+ {cwd: "/go/src/one/two/three", arg: ".", want: "one/two/three"},
+ {cwd: "/go/src/one", arg: "two/three", want: ""},
+ } {
+ conf := loader.Config{
+ Cwd: test.cwd,
+ Build: ctxt,
+ }
+ conf.Import(test.arg)
+
+ var got string
+ prog, err := conf.Load()
+ if prog != nil {
+ got = imported(prog)
+ }
+ if got != test.want {
+ t.Errorf("Load(%s) from %s: Imported = %s, want %s",
+ test.arg, test.cwd, got, test.want)
+ if err != nil {
+ t.Errorf("Load failed: %v", err)
+ }
+ }
+ }
+}
+
+// TODO(adonovan): more Load tests:
+//
+// failures:
+// - to parse package decl of *_test.go files
+// - to parse package decl of external *_test.go files
+// - to parse whole of *_test.go files
+// - to parse whole of external *_test.go files
+// - to open a *.go file during import scanning
+// - to import from binary
+
+// features:
+// - InitialPackages
+// - PackageCreated hook
+// - TypeCheckFuncBodies hook
+
+func TestTransitivelyErrorFreeFlag(t *testing.T) {
+ // Create an minimal custom build.Context
+ // that fakes the following packages:
+ //
+ // a --> b --> c! c has an error
+ // \ d and e are transitively error-free.
+ // e --> d
+ //
+ // Each package [a-e] consists of one file, x.go.
+ pkgs := map[string]string{
+ "a": `package a; import (_ "b"; _ "e")`,
+ "b": `package b; import _ "c"`,
+ "c": `package c; func f() { _ = int(false) }`, // type error within function body
+ "d": `package d;`,
+ "e": `package e; import _ "d"`,
+ }
+ conf := loader.Config{
+ AllowErrors: true,
+ Build: fakeContext(pkgs),
+ }
+ conf.Import("a")
+
+ prog, err := conf.Load()
+ if err != nil {
+ t.Errorf("Load failed: %s", err)
+ }
+ if prog == nil {
+ t.Fatalf("Load returned nil *Program")
+ }
+
+ for pkg, info := range prog.AllPackages {
+ var wantErr, wantTEF bool
+ switch pkg.Path() {
+ case "a", "b":
+ case "c":
+ wantErr = true
+ case "d", "e":
+ wantTEF = true
+ default:
+ t.Errorf("unexpected package: %q", pkg.Path())
+ continue
+ }
+
+ if (info.Errors != nil) != wantErr {
+ if wantErr {
+ t.Errorf("Package %q.Error = nil, want error", pkg.Path())
+ } else {
+ t.Errorf("Package %q has unexpected Errors: %v",
+ pkg.Path(), info.Errors)
+ }
+ }
+
+ if info.TransitivelyErrorFree != wantTEF {
+ t.Errorf("Package %q.TransitivelyErrorFree=%t, want %t",
+ pkg.Path(), info.TransitivelyErrorFree, wantTEF)
+ }
+ }
+}
+
+// Test that syntax (scan/parse), type, and loader errors are recorded
+// (in PackageInfo.Errors) and reported (via Config.TypeChecker.Error).
+func TestErrorReporting(t *testing.T) {
+ pkgs := map[string]string{
+ "a": `package a; import (_ "b"; _ "c"); var x int = false`,
+ "b": `package b; 'syntax error!`,
+ }
+ conf := loader.Config{
+ AllowErrors: true,
+ Build: fakeContext(pkgs),
+ }
+ var mu sync.Mutex
+ var allErrors []error
+ conf.TypeChecker.Error = func(err error) {
+ mu.Lock()
+ allErrors = append(allErrors, err)
+ mu.Unlock()
+ }
+ conf.Import("a")
+
+ prog, err := conf.Load()
+ if err != nil {
+ t.Errorf("Load failed: %s", err)
+ }
+ if prog == nil {
+ t.Fatalf("Load returned nil *Program")
+ }
+
+ // TODO(adonovan): test keys of ImportMap.
+
+ // Check errors recorded in each PackageInfo.
+ for pkg, info := range prog.AllPackages {
+ switch pkg.Path() {
+ case "a":
+ if !hasError(info.Errors, "cannot convert false") {
+ t.Errorf("a.Errors = %v, want bool conversion (type) error", info.Errors)
+ }
+ if !hasError(info.Errors, "could not import c") {
+ t.Errorf("a.Errors = %v, want import (loader) error", info.Errors)
+ }
+ case "b":
+ if !hasError(info.Errors, "rune literal not terminated") {
+ t.Errorf("b.Errors = %v, want unterminated literal (syntax) error", info.Errors)
+ }
+ }
+ }
+
+ // Check errors reported via error handler.
+ if !hasError(allErrors, "cannot convert false") ||
+ !hasError(allErrors, "rune literal not terminated") ||
+ !hasError(allErrors, "could not import c") {
+ t.Errorf("allErrors = %v, want syntax, type and loader errors", allErrors)
+ }
+}
+
+func TestCycles(t *testing.T) {
+ for _, test := range []struct {
+ descr string
+ ctxt *build.Context
+ wantErr string
+ }{
+ {
+ "self-cycle",
+ fakeContext(map[string]string{
+ "main": `package main; import _ "selfcycle"`,
+ "selfcycle": `package selfcycle; import _ "selfcycle"`,
+ }),
+ `import cycle: selfcycle -> selfcycle`,
+ },
+ {
+ "three-package cycle",
+ fakeContext(map[string]string{
+ "main": `package main; import _ "a"`,
+ "a": `package a; import _ "b"`,
+ "b": `package b; import _ "c"`,
+ "c": `package c; import _ "a"`,
+ }),
+ `import cycle: c -> a -> b -> c`,
+ },
+ {
+ "self-cycle in dependency of test file",
+ buildutil.FakeContext(map[string]map[string]string{
+ "main": {
+ "main.go": `package main`,
+ "main_test.go": `package main; import _ "a"`,
+ },
+ "a": {
+ "a.go": `package a; import _ "a"`,
+ },
+ }),
+ `import cycle: a -> a`,
+ },
+ // TODO(adonovan): fix: these fail
+ // {
+ // "two-package cycle in dependency of test file",
+ // buildutil.FakeContext(map[string]map[string]string{
+ // "main": {
+ // "main.go": `package main`,
+ // "main_test.go": `package main; import _ "a"`,
+ // },
+ // "a": {
+ // "a.go": `package a; import _ "main"`,
+ // },
+ // }),
+ // `import cycle: main -> a -> main`,
+ // },
+ // {
+ // "self-cycle in augmented package",
+ // buildutil.FakeContext(map[string]map[string]string{
+ // "main": {
+ // "main.go": `package main`,
+ // "main_test.go": `package main; import _ "main"`,
+ // },
+ // }),
+ // `import cycle: main -> main`,
+ // },
+ } {
+ conf := loader.Config{
+ AllowErrors: true,
+ Build: test.ctxt,
+ }
+ var mu sync.Mutex
+ var allErrors []error
+ conf.TypeChecker.Error = func(err error) {
+ mu.Lock()
+ allErrors = append(allErrors, err)
+ mu.Unlock()
+ }
+ conf.ImportWithTests("main")
+
+ prog, err := conf.Load()
+ if err != nil {
+ t.Errorf("%s: Load failed: %s", test.descr, err)
+ }
+ if prog == nil {
+ t.Fatalf("%s: Load returned nil *Program", test.descr)
+ }
+
+ if !hasError(allErrors, test.wantErr) {
+ t.Errorf("%s: Load() errors = %q, want %q",
+ test.descr, allErrors, test.wantErr)
+ }
+ }
+
+ // TODO(adonovan):
+ // - Test that in a legal test cycle, none of the symbols
+ // defined by augmentation are visible via import.
+}
+
+// ---- utilities ----
+
+// Simplifying wrapper around buildutil.FakeContext for single-file packages.
+func fakeContext(pkgs map[string]string) *build.Context {
+ pkgs2 := make(map[string]map[string]string)
+ for path, content := range pkgs {
+ pkgs2[path] = map[string]string{"x.go": content}
+ }
+ return buildutil.FakeContext(pkgs2)
+}
+
+func hasError(errors []error, substr string) bool {
+ for _, err := range errors {
+ if strings.Contains(err.Error(), substr) {
+ return true
+ }
+ }
+ return false
+}
+
+func keys(m map[string]bool) (keys []string) {
+ for key := range m {
+ keys = append(keys, key)
+ }
+ sort.Strings(keys)
+ return
+}
+
+// Returns all loaded packages.
+func all(prog *loader.Program) []string {
+ var pkgs []string
+ for _, info := range prog.AllPackages {
+ pkgs = append(pkgs, info.Pkg.Path())
+ }
+ sort.Strings(pkgs)
+ return pkgs
+}
+
+// Returns initially imported packages, as a string.
+func imported(prog *loader.Program) string {
+ var pkgs []string
+ for _, info := range prog.Imported {
+ pkgs = append(pkgs, info.Pkg.Path())
+ }
+ sort.Strings(pkgs)
+ return strings.Join(pkgs, " ")
+}
+
+// Returns initially created packages, as a string.
+func created(prog *loader.Program) string {
+ var pkgs []string
+ for _, info := range prog.Created {
+ pkgs = append(pkgs, info.Pkg.Path())
+ }
+ return strings.Join(pkgs, " ")
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/loader/stdlib_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/loader/stdlib_test.go
new file mode 100644
index 0000000000..f5c45abbde
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/loader/stdlib_test.go
@@ -0,0 +1,192 @@
+// 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.
+
+package loader_test
+
+// This file enumerates all packages beneath $GOROOT, loads them, plus
+// their external tests if any, runs the type checker on them, and
+// prints some summary information.
+//
+// Run test with GOMAXPROCS=8.
+
+import (
+ "bytes"
+ "fmt"
+ "go/ast"
+ "go/build"
+ "go/token"
+ "io/ioutil"
+ "path/filepath"
+ "runtime"
+ "strings"
+ "testing"
+ "time"
+
+ "golang.org/x/tools/go/buildutil"
+ "golang.org/x/tools/go/loader"
+ "golang.org/x/tools/go/types"
+)
+
+func TestStdlib(t *testing.T) {
+ runtime.GC()
+ t0 := time.Now()
+ var memstats runtime.MemStats
+ runtime.ReadMemStats(&memstats)
+ alloc := memstats.Alloc
+
+ // Load, parse and type-check the program.
+ ctxt := build.Default // copy
+ ctxt.GOPATH = "" // disable GOPATH
+ conf := loader.Config{Build: &ctxt}
+ for _, path := range buildutil.AllPackages(conf.Build) {
+ conf.ImportWithTests(path)
+ }
+
+ prog, err := conf.Load()
+ if err != nil {
+ t.Fatalf("Load failed: %v", err)
+ }
+
+ t1 := time.Now()
+ runtime.GC()
+ runtime.ReadMemStats(&memstats)
+
+ numPkgs := len(prog.AllPackages)
+ if want := 205; numPkgs < want {
+ t.Errorf("Loaded only %d packages, want at least %d", numPkgs, want)
+ }
+
+ // Dump package members.
+ if false {
+ for pkg := range prog.AllPackages {
+ fmt.Printf("Package %s:\n", pkg.Path())
+ scope := pkg.Scope()
+ qualifier := types.RelativeTo(pkg)
+ for _, name := range scope.Names() {
+ if ast.IsExported(name) {
+ fmt.Printf("\t%s\n", types.ObjectString(scope.Lookup(name), qualifier))
+ }
+ }
+ fmt.Println()
+ }
+ }
+
+ // Check that Test functions for io/ioutil, regexp and
+ // compress/bzip2 are all simultaneously present.
+ // (The apparent cycle formed when augmenting all three of
+ // these packages by their tests was the original motivation
+ // for reporting b/7114.)
+ //
+ // compress/bzip2.TestBitReader in bzip2_test.go imports io/ioutil
+ // io/ioutil.TestTempFile in tempfile_test.go imports regexp
+ // regexp.TestRE2Search in exec_test.go imports compress/bzip2
+ for _, test := range []struct{ pkg, fn string }{
+ {"io/ioutil", "TestTempFile"},
+ {"regexp", "TestRE2Search"},
+ {"compress/bzip2", "TestBitReader"},
+ } {
+ info := prog.Imported[test.pkg]
+ if info == nil {
+ t.Errorf("failed to load package %q", test.pkg)
+ continue
+ }
+ obj, _ := info.Pkg.Scope().Lookup(test.fn).(*types.Func)
+ if obj == nil {
+ t.Errorf("package %q has no func %q", test.pkg, test.fn)
+ continue
+ }
+ }
+
+ // Dump some statistics.
+
+ // determine line count
+ var lineCount int
+ prog.Fset.Iterate(func(f *token.File) bool {
+ lineCount += f.LineCount()
+ return true
+ })
+
+ t.Log("GOMAXPROCS: ", runtime.GOMAXPROCS(0))
+ t.Log("#Source lines: ", lineCount)
+ t.Log("Load/parse/typecheck: ", t1.Sub(t0))
+ t.Log("#MB: ", int64(memstats.Alloc-alloc)/1000000)
+}
+
+func TestCgoOption(t *testing.T) {
+ switch runtime.GOOS {
+ // On these systems, the net and os/user packages don't use cgo.
+ case "plan9", "solaris", "windows":
+ return
+ }
+ // In nocgo builds (e.g. linux-amd64-nocgo),
+ // there is no "runtime/cgo" package,
+ // so cgo-generated Go files will have a failing import.
+ if !build.Default.CgoEnabled {
+ return
+ }
+ // Test that we can load cgo-using packages with
+ // CGO_ENABLED=[01], which causes go/build to select pure
+ // Go/native implementations, respectively, based on build
+ // tags.
+ //
+ // Each entry specifies a package-level object and the generic
+ // file expected to define it when cgo is disabled.
+ // When cgo is enabled, the exact file is not specified (since
+ // it varies by platform), but must differ from the generic one.
+ //
+ // The test also loads the actual file to verify that the
+ // object is indeed defined at that location.
+ for _, test := range []struct {
+ pkg, name, genericFile string
+ }{
+ {"net", "cgoLookupHost", "cgo_stub.go"},
+ {"os/user", "lookupId", "lookup_stubs.go"},
+ } {
+ ctxt := build.Default
+ for _, ctxt.CgoEnabled = range []bool{false, true} {
+ conf := loader.Config{Build: &ctxt}
+ conf.Import(test.pkg)
+ prog, err := conf.Load()
+ if err != nil {
+ t.Errorf("Load failed: %v", err)
+ continue
+ }
+ info := prog.Imported[test.pkg]
+ if info == nil {
+ t.Errorf("package %s not found", test.pkg)
+ continue
+ }
+ obj := info.Pkg.Scope().Lookup(test.name)
+ if obj == nil {
+ t.Errorf("no object %s.%s", test.pkg, test.name)
+ continue
+ }
+ posn := prog.Fset.Position(obj.Pos())
+ t.Logf("%s: %s (CgoEnabled=%t)", posn, obj, ctxt.CgoEnabled)
+
+ gotFile := filepath.Base(posn.Filename)
+ filesMatch := gotFile == test.genericFile
+
+ if ctxt.CgoEnabled && filesMatch {
+ t.Errorf("CGO_ENABLED=1: %s found in %s, want native file",
+ obj, gotFile)
+ } else if !ctxt.CgoEnabled && !filesMatch {
+ t.Errorf("CGO_ENABLED=0: %s found in %s, want %s",
+ obj, gotFile, test.genericFile)
+ }
+
+ // Load the file and check the object is declared at the right place.
+ b, err := ioutil.ReadFile(posn.Filename)
+ if err != nil {
+ t.Errorf("can't read %s: %s", posn.Filename, err)
+ continue
+ }
+ line := string(bytes.Split(b, []byte("\n"))[posn.Line-1])
+ ident := line[posn.Column-1:]
+ if !strings.HasPrefix(ident, test.name) {
+ t.Errorf("%s: %s not declared here (looking at %q)", posn, obj, ident)
+ }
+ }
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/loader/util.go b/Godeps/_workspace/src/golang.org/x/tools/go/loader/util.go
new file mode 100644
index 0000000000..0404e99106
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/loader/util.go
@@ -0,0 +1,124 @@
+// 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.
+
+package loader
+
+import (
+ "go/ast"
+ "go/build"
+ "go/parser"
+ "go/token"
+ "io"
+ "os"
+ "strconv"
+ "sync"
+
+ "golang.org/x/tools/go/buildutil"
+)
+
+// We use a counting semaphore to limit
+// the number of parallel I/O calls per process.
+var sema = make(chan bool, 10)
+
+// parseFiles parses the Go source files within directory dir and
+// returns the ASTs of the ones that could be at least partially parsed,
+// along with a list of I/O and parse errors encountered.
+//
+// I/O is done via ctxt, which may specify a virtual file system.
+// displayPath is used to transform the filenames attached to the ASTs.
+//
+func parseFiles(fset *token.FileSet, ctxt *build.Context, displayPath func(string) string, dir string, files []string, mode parser.Mode) ([]*ast.File, []error) {
+ if displayPath == nil {
+ displayPath = func(path string) string { return path }
+ }
+ var wg sync.WaitGroup
+ n := len(files)
+ parsed := make([]*ast.File, n)
+ errors := make([]error, n)
+ for i, file := range files {
+ if !buildutil.IsAbsPath(ctxt, file) {
+ file = buildutil.JoinPath(ctxt, dir, file)
+ }
+ wg.Add(1)
+ go func(i int, file string) {
+ sema <- true // wait
+ defer func() {
+ wg.Done()
+ <-sema // signal
+ }()
+ var rd io.ReadCloser
+ var err error
+ if ctxt.OpenFile != nil {
+ rd, err = ctxt.OpenFile(file)
+ } else {
+ rd, err = os.Open(file)
+ }
+ if err != nil {
+ errors[i] = err // open failed
+ return
+ }
+
+ // ParseFile may return both an AST and an error.
+ parsed[i], errors[i] = parser.ParseFile(fset, displayPath(file), rd, mode)
+ rd.Close()
+ }(i, file)
+ }
+ wg.Wait()
+
+ // Eliminate nils, preserving order.
+ var o int
+ for _, f := range parsed {
+ if f != nil {
+ parsed[o] = f
+ o++
+ }
+ }
+ parsed = parsed[:o]
+
+ o = 0
+ for _, err := range errors {
+ if err != nil {
+ errors[o] = err
+ o++
+ }
+ }
+ errors = errors[:o]
+
+ return parsed, errors
+}
+
+// scanImports returns the set of all package import paths from all
+// import specs in the specified files.
+func scanImports(files []*ast.File) map[string]bool {
+ imports := make(map[string]bool)
+ for _, f := range files {
+ for _, decl := range f.Decls {
+ if decl, ok := decl.(*ast.GenDecl); ok && decl.Tok == token.IMPORT {
+ for _, spec := range decl.Specs {
+ spec := spec.(*ast.ImportSpec)
+
+ // NB: do not assume the program is well-formed!
+ path, err := strconv.Unquote(spec.Path.Value)
+ if err != nil {
+ continue // quietly ignore the error
+ }
+ if path == "C" || path == "unsafe" {
+ continue // skip pseudo packages
+ }
+ imports[path] = true
+ }
+ }
+ }
+ }
+ return imports
+}
+
+// ---------- Internal helpers ----------
+
+// TODO(adonovan): make this a method: func (*token.File) Contains(token.Pos)
+func tokenFileContainsPos(f *token.File, pos token.Pos) bool {
+ p := int(pos)
+ base := f.Base()
+ return base <= p && p < base+f.Size()
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/api.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/api.go
new file mode 100644
index 0000000000..27bafef389
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/api.go
@@ -0,0 +1,365 @@
+// Copyright 2012 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.
+
+// Package types declares the data types and implements
+// the algorithms for type-checking of Go packages.
+// Use Check and Config.Check to invoke the type-checker.
+//
+// Type-checking consists of several interdependent phases:
+//
+// Name resolution maps each identifier (ast.Ident) in the program to the
+// language object (Object) it denotes.
+// Use Info.{Defs,Uses,Implicits} for the results of name resolution.
+//
+// Constant folding computes the exact constant value (exact.Value) for
+// every expression (ast.Expr) that is a compile-time constant.
+// Use Info.Types[expr].Value for the results of constant folding.
+//
+// Type inference computes the type (Type) of every expression (ast.Expr)
+// and checks for compliance with the language specification.
+// Use Info.Types[expr].Type for the results of type inference.
+//
+package types
+
+import (
+ "bytes"
+ "fmt"
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/go/exact"
+)
+
+// Check type-checks a package and returns the resulting complete package
+// object, or a nil package and the first error. The package is specified
+// by a list of *ast.Files and corresponding file set, and the import path
+// the package is identified with. The clean path must not be empty or dot (".").
+//
+// For more control over type-checking and results, use Config.Check.
+func Check(path string, fset *token.FileSet, files []*ast.File) (*Package, error) {
+ var conf Config
+ pkg, err := conf.Check(path, fset, files, nil)
+ if err != nil {
+ return nil, err
+ }
+ return pkg, nil
+}
+
+// An Error describes a type-checking error; it implements the error interface.
+// A "soft" error is an error that still permits a valid interpretation of a
+// package (such as "unused variable"); "hard" errors may lead to unpredictable
+// behavior if ignored.
+type Error struct {
+ Fset *token.FileSet // file set for interpretation of Pos
+ Pos token.Pos // error position
+ Msg string // error message
+ Soft bool // if set, error is "soft"
+}
+
+// Error returns an error string formatted as follows:
+// filename:line:column: message
+func (err Error) Error() string {
+ return fmt.Sprintf("%s: %s", err.Fset.Position(err.Pos), err.Msg)
+}
+
+// An importer resolves import paths to Packages.
+// The imports map records packages already known,
+// indexed by package path. The type-checker
+// will invoke Import with Config.Packages.
+// An importer must determine the canonical package path and
+// check imports to see if it is already present in the map.
+// If so, the Importer can return the map entry. Otherwise,
+// the importer must load the package data for the given path
+// into a new *Package, record it in imports map, and return
+// the package.
+// TODO(gri) Need to be clearer about requirements of completeness.
+type Importer func(map[string]*Package, string) (*Package, error)
+
+// A Config specifies the configuration for type checking.
+// The zero value for Config is a ready-to-use default configuration.
+type Config struct {
+ // If IgnoreFuncBodies is set, function bodies are not
+ // type-checked.
+ IgnoreFuncBodies bool
+
+ // If FakeImportC is set, `import "C"` (for packages requiring Cgo)
+ // declares an empty "C" package and errors are omitted for qualified
+ // identifiers referring to package C (which won't find an object).
+ // This feature is intended for the standard library cmd/api tool.
+ //
+ // Caution: Effects may be unpredictable due to follow-up errors.
+ // Do not use casually!
+ FakeImportC bool
+
+ // Packages is used to look up (and thus canonicalize) packages by
+ // package path. If Packages is nil, it is set to a new empty map.
+ // During type-checking, imported packages are added to the map.
+ Packages map[string]*Package
+
+ // If Error != nil, it is called with each error found
+ // during type checking; err has dynamic type Error.
+ // Secondary errors (for instance, to enumerate all types
+ // involved in an invalid recursive type declaration) have
+ // error strings that start with a '\t' character.
+ // If Error == nil, type-checking stops with the first
+ // error found.
+ Error func(err error)
+
+ // If Import != nil, it is called for each imported package.
+ // Otherwise, DefaultImport is called.
+ Import Importer
+
+ // If Sizes != nil, it provides the sizing functions for package unsafe.
+ // Otherwise &StdSizes{WordSize: 8, MaxAlign: 8} is used instead.
+ Sizes Sizes
+
+ // If DisableUnusedImportCheck is set, packages are not checked
+ // for unused imports.
+ DisableUnusedImportCheck bool
+}
+
+// DefaultImport is the default importer invoked if Config.Import == nil.
+// The declaration:
+//
+// import _ "golang.org/x/tools/go/gcimporter"
+//
+// in a client of go/types will initialize DefaultImport to gcimporter.Import.
+var DefaultImport Importer
+
+// Info holds result type information for a type-checked package.
+// Only the information for which a map is provided is collected.
+// If the package has type errors, the collected information may
+// be incomplete.
+type Info struct {
+ // Types maps expressions to their types, and for constant
+ // expressions, their values. Invalid expressions are omitted.
+ //
+ // For (possibly parenthesized) identifiers denoting built-in
+ // functions, the recorded signatures are call-site specific:
+ // if the call result is not a constant, the recorded type is
+ // an argument-specific signature. Otherwise, the recorded type
+ // is invalid.
+ //
+ // Identifiers on the lhs of declarations (i.e., the identifiers
+ // which are being declared) are collected in the Defs map.
+ // Identifiers denoting packages are collected in the Uses maps.
+ Types map[ast.Expr]TypeAndValue
+
+ // Defs maps identifiers to the objects they define (including
+ // package names, dots "." of dot-imports, and blank "_" identifiers).
+ // For identifiers that do not denote objects (e.g., the package name
+ // in package clauses, or symbolic variables t in t := x.(type) of
+ // type switch headers), the corresponding objects are nil.
+ //
+ // For an anonymous field, Defs returns the field *Var it defines.
+ //
+ // Invariant: Defs[id] == nil || Defs[id].Pos() == id.Pos()
+ Defs map[*ast.Ident]Object
+
+ // Uses maps identifiers to the objects they denote.
+ //
+ // For an anonymous field, Uses returns the *TypeName it denotes.
+ //
+ // Invariant: Uses[id].Pos() != id.Pos()
+ Uses map[*ast.Ident]Object
+
+ // Implicits maps nodes to their implicitly declared objects, if any.
+ // The following node and object types may appear:
+ //
+ // node declared object
+ //
+ // *ast.ImportSpec *PkgName for dot-imports and imports without renames
+ // *ast.CaseClause type-specific *Var for each type switch case clause (incl. default)
+ // *ast.Field anonymous struct field or parameter *Var
+ //
+ Implicits map[ast.Node]Object
+
+ // Selections maps selector expressions (excluding qualified identifiers)
+ // to their corresponding selections.
+ Selections map[*ast.SelectorExpr]*Selection
+
+ // Scopes maps ast.Nodes to the scopes they define. Package scopes are not
+ // associated with a specific node but with all files belonging to a package.
+ // Thus, the package scope can be found in the type-checked Package object.
+ // Scopes nest, with the Universe scope being the outermost scope, enclosing
+ // the package scope, which contains (one or more) files scopes, which enclose
+ // function scopes which in turn enclose statement and function literal scopes.
+ // Note that even though package-level functions are declared in the package
+ // scope, the function scopes are embedded in the file scope of the file
+ // containing the function declaration.
+ //
+ // The following node types may appear in Scopes:
+ //
+ // *ast.File
+ // *ast.FuncType
+ // *ast.BlockStmt
+ // *ast.IfStmt
+ // *ast.SwitchStmt
+ // *ast.TypeSwitchStmt
+ // *ast.CaseClause
+ // *ast.CommClause
+ // *ast.ForStmt
+ // *ast.RangeStmt
+ //
+ Scopes map[ast.Node]*Scope
+
+ // InitOrder is the list of package-level initializers in the order in which
+ // they must be executed. Initializers referring to variables related by an
+ // initialization dependency appear in topological order, the others appear
+ // in source order. Variables without an initialization expression do not
+ // appear in this list.
+ InitOrder []*Initializer
+}
+
+// TypeOf returns the type of expression e, or nil if not found.
+// Precondition: the Types, Uses and Defs maps are populated.
+//
+func (info *Info) TypeOf(e ast.Expr) Type {
+ if t, ok := info.Types[e]; ok {
+ return t.Type
+ }
+ if id, _ := e.(*ast.Ident); id != nil {
+ if obj := info.ObjectOf(id); obj != nil {
+ return obj.Type()
+ }
+ }
+ return nil
+}
+
+// ObjectOf returns the object denoted by the specified id,
+// or nil if not found.
+//
+// If id is an anonymous struct field, ObjectOf returns the field (*Var)
+// it uses, not the type (*TypeName) it defines.
+//
+// Precondition: the Uses and Defs maps are populated.
+//
+func (info *Info) ObjectOf(id *ast.Ident) Object {
+ if obj, _ := info.Defs[id]; obj != nil {
+ return obj
+ }
+ return info.Uses[id]
+}
+
+// TypeAndValue reports the type and value (for constants)
+// of the corresponding expression.
+type TypeAndValue struct {
+ mode operandMode
+ Type Type
+ Value exact.Value
+}
+
+// TODO(gri) Consider eliminating the IsVoid predicate. Instead, report
+// "void" values as regular values but with the empty tuple type.
+
+// IsVoid reports whether the corresponding expression
+// is a function call without results.
+func (tv TypeAndValue) IsVoid() bool {
+ return tv.mode == novalue
+}
+
+// IsType reports whether the corresponding expression specifies a type.
+func (tv TypeAndValue) IsType() bool {
+ return tv.mode == typexpr
+}
+
+// IsBuiltin reports whether the corresponding expression denotes
+// a (possibly parenthesized) built-in function.
+func (tv TypeAndValue) IsBuiltin() bool {
+ return tv.mode == builtin
+}
+
+// IsValue reports whether the corresponding expression is a value.
+// Builtins are not considered values. Constant values have a non-
+// nil Value.
+func (tv TypeAndValue) IsValue() bool {
+ switch tv.mode {
+ case constant, variable, mapindex, value, commaok:
+ return true
+ }
+ return false
+}
+
+// IsNil reports whether the corresponding expression denotes the
+// predeclared value nil.
+func (tv TypeAndValue) IsNil() bool {
+ return tv.mode == value && tv.Type == Typ[UntypedNil]
+}
+
+// Addressable reports whether the corresponding expression
+// is addressable (http://golang.org/ref/spec#Address_operators).
+func (tv TypeAndValue) Addressable() bool {
+ return tv.mode == variable
+}
+
+// Assignable reports whether the corresponding expression
+// is assignable to (provided a value of the right type).
+func (tv TypeAndValue) Assignable() bool {
+ return tv.mode == variable || tv.mode == mapindex
+}
+
+// HasOk reports whether the corresponding expression may be
+// used on the lhs of a comma-ok assignment.
+func (tv TypeAndValue) HasOk() bool {
+ return tv.mode == commaok || tv.mode == mapindex
+}
+
+// An Initializer describes a package-level variable, or a list of variables in case
+// of a multi-valued initialization expression, and the corresponding initialization
+// expression.
+type Initializer struct {
+ Lhs []*Var // var Lhs = Rhs
+ Rhs ast.Expr
+}
+
+func (init *Initializer) String() string {
+ var buf bytes.Buffer
+ for i, lhs := range init.Lhs {
+ if i > 0 {
+ buf.WriteString(", ")
+ }
+ buf.WriteString(lhs.Name())
+ }
+ buf.WriteString(" = ")
+ WriteExpr(&buf, init.Rhs)
+ return buf.String()
+}
+
+// Check type-checks a package and returns the resulting package object,
+// the first error if any, and if info != nil, additional type information.
+// The package is marked as complete if no errors occurred, otherwise it is
+// incomplete. See Config.Error for controlling behavior in the presence of
+// errors.
+//
+// The package is specified by a list of *ast.Files and corresponding
+// file set, and the package path the package is identified with.
+// The clean path must not be empty or dot (".").
+func (conf *Config) Check(path string, fset *token.FileSet, files []*ast.File, info *Info) (*Package, error) {
+ pkg := NewPackage(path, "")
+ return pkg, NewChecker(conf, fset, pkg, info).Files(files)
+}
+
+// AssertableTo reports whether a value of type V can be asserted to have type T.
+func AssertableTo(V *Interface, T Type) bool {
+ m, _ := assertableTo(V, T)
+ return m == nil
+}
+
+// AssignableTo reports whether a value of type V is assignable to a variable of type T.
+func AssignableTo(V, T Type) bool {
+ x := operand{mode: value, typ: V}
+ return x.assignableTo(nil, T) // config not needed for non-constant x
+}
+
+// ConvertibleTo reports whether a value of type V is convertible to a value of type T.
+func ConvertibleTo(V, T Type) bool {
+ x := operand{mode: value, typ: V}
+ return x.convertibleTo(nil, T) // config not needed for non-constant x
+}
+
+// Implements reports whether type V implements interface T.
+func Implements(V Type, T *Interface) bool {
+ f, _ := MissingMethod(V, T, true)
+ return f == nil
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/api_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/api_test.go
new file mode 100644
index 0000000000..96e10d4d95
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/api_test.go
@@ -0,0 +1,1059 @@
+// 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.
+
+package types_test
+
+import (
+ "bytes"
+ "fmt"
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "reflect"
+ "regexp"
+ "runtime"
+ "strings"
+ "testing"
+
+ _ "golang.org/x/tools/go/gcimporter"
+ . "golang.org/x/tools/go/types"
+)
+
+// skipSpecialPlatforms causes the test to be skipped for platforms where
+// builders (build.golang.org) don't have access to compiled packages for
+// import.
+func skipSpecialPlatforms(t *testing.T) {
+ switch platform := runtime.GOOS + "-" + runtime.GOARCH; platform {
+ case "nacl-amd64p32",
+ "nacl-386",
+ "nacl-arm",
+ "darwin-arm",
+ "darwin-arm64":
+ t.Skipf("no compiled packages available for import on %s", platform)
+ }
+}
+
+func pkgFor(path, source string, info *Info) (*Package, error) {
+ fset := token.NewFileSet()
+ f, err := parser.ParseFile(fset, path, source, 0)
+ if err != nil {
+ return nil, err
+ }
+
+ var conf Config
+ return conf.Check(f.Name.Name, fset, []*ast.File{f}, info)
+}
+
+func mustTypecheck(t *testing.T, path, source string, info *Info) string {
+ pkg, err := pkgFor(path, source, info)
+ if err != nil {
+ name := path
+ if pkg != nil {
+ name = "package " + pkg.Name()
+ }
+ t.Fatalf("%s: didn't type-check (%s)", name, err)
+ }
+ return pkg.Name()
+}
+
+func TestValuesInfo(t *testing.T) {
+ var tests = []struct {
+ src string
+ expr string // constant expression
+ typ string // constant type
+ val string // constant value
+ }{
+ {`package a0; const _ = false`, `false`, `untyped bool`, `false`},
+ {`package a1; const _ = 0`, `0`, `untyped int`, `0`},
+ {`package a2; const _ = 'A'`, `'A'`, `untyped rune`, `65`},
+ {`package a3; const _ = 0.`, `0.`, `untyped float`, `0`},
+ {`package a4; const _ = 0i`, `0i`, `untyped complex`, `0`},
+ {`package a5; const _ = "foo"`, `"foo"`, `untyped string`, `"foo"`},
+
+ {`package b0; var _ = false`, `false`, `bool`, `false`},
+ {`package b1; var _ = 0`, `0`, `int`, `0`},
+ {`package b2; var _ = 'A'`, `'A'`, `rune`, `65`},
+ {`package b3; var _ = 0.`, `0.`, `float64`, `0`},
+ {`package b4; var _ = 0i`, `0i`, `complex128`, `0`},
+ {`package b5; var _ = "foo"`, `"foo"`, `string`, `"foo"`},
+
+ {`package c0a; var _ = bool(false)`, `false`, `bool`, `false`},
+ {`package c0b; var _ = bool(false)`, `bool(false)`, `bool`, `false`},
+ {`package c0c; type T bool; var _ = T(false)`, `T(false)`, `c0c.T`, `false`},
+
+ {`package c1a; var _ = int(0)`, `0`, `int`, `0`},
+ {`package c1b; var _ = int(0)`, `int(0)`, `int`, `0`},
+ {`package c1c; type T int; var _ = T(0)`, `T(0)`, `c1c.T`, `0`},
+
+ {`package c2a; var _ = rune('A')`, `'A'`, `rune`, `65`},
+ {`package c2b; var _ = rune('A')`, `rune('A')`, `rune`, `65`},
+ {`package c2c; type T rune; var _ = T('A')`, `T('A')`, `c2c.T`, `65`},
+
+ {`package c3a; var _ = float32(0.)`, `0.`, `float32`, `0`},
+ {`package c3b; var _ = float32(0.)`, `float32(0.)`, `float32`, `0`},
+ {`package c3c; type T float32; var _ = T(0.)`, `T(0.)`, `c3c.T`, `0`},
+
+ {`package c4a; var _ = complex64(0i)`, `0i`, `complex64`, `0`},
+ {`package c4b; var _ = complex64(0i)`, `complex64(0i)`, `complex64`, `0`},
+ {`package c4c; type T complex64; var _ = T(0i)`, `T(0i)`, `c4c.T`, `0`},
+
+ {`package c5a; var _ = string("foo")`, `"foo"`, `string`, `"foo"`},
+ {`package c5b; var _ = string("foo")`, `string("foo")`, `string`, `"foo"`},
+ {`package c5c; type T string; var _ = T("foo")`, `T("foo")`, `c5c.T`, `"foo"`},
+
+ {`package d0; var _ = []byte("foo")`, `"foo"`, `string`, `"foo"`},
+ {`package d1; var _ = []byte(string("foo"))`, `"foo"`, `string`, `"foo"`},
+ {`package d2; var _ = []byte(string("foo"))`, `string("foo")`, `string`, `"foo"`},
+ {`package d3; type T []byte; var _ = T("foo")`, `"foo"`, `string`, `"foo"`},
+
+ {`package e0; const _ = float32( 1e-200)`, `float32(1e-200)`, `float32`, `0`},
+ {`package e1; const _ = float32(-1e-200)`, `float32(-1e-200)`, `float32`, `0`},
+ {`package e2; const _ = float64( 1e-2000)`, `float64(1e-2000)`, `float64`, `0`},
+ {`package e3; const _ = float64(-1e-2000)`, `float64(-1e-2000)`, `float64`, `0`},
+ {`package e4; const _ = complex64( 1e-200)`, `complex64(1e-200)`, `complex64`, `0`},
+ {`package e5; const _ = complex64(-1e-200)`, `complex64(-1e-200)`, `complex64`, `0`},
+ {`package e6; const _ = complex128( 1e-2000)`, `complex128(1e-2000)`, `complex128`, `0`},
+ {`package e7; const _ = complex128(-1e-2000)`, `complex128(-1e-2000)`, `complex128`, `0`},
+
+ {`package f0 ; var _ float32 = 1e-200`, `1e-200`, `float32`, `0`},
+ {`package f1 ; var _ float32 = -1e-200`, `-1e-200`, `float32`, `0`},
+ {`package f2a; var _ float64 = 1e-2000`, `1e-2000`, `float64`, `0`},
+ {`package f3a; var _ float64 = -1e-2000`, `-1e-2000`, `float64`, `0`},
+ {`package f2b; var _ = 1e-2000`, `1e-2000`, `float64`, `0`},
+ {`package f3b; var _ = -1e-2000`, `-1e-2000`, `float64`, `0`},
+ {`package f4 ; var _ complex64 = 1e-200 `, `1e-200`, `complex64`, `0`},
+ {`package f5 ; var _ complex64 = -1e-200 `, `-1e-200`, `complex64`, `0`},
+ {`package f6a; var _ complex128 = 1e-2000i`, `1e-2000i`, `complex128`, `0`},
+ {`package f7a; var _ complex128 = -1e-2000i`, `-1e-2000i`, `complex128`, `0`},
+ {`package f6b; var _ = 1e-2000i`, `1e-2000i`, `complex128`, `0`},
+ {`package f7b; var _ = -1e-2000i`, `-1e-2000i`, `complex128`, `0`},
+ }
+
+ for _, test := range tests {
+ info := Info{
+ Types: make(map[ast.Expr]TypeAndValue),
+ }
+ name := mustTypecheck(t, "ValuesInfo", test.src, &info)
+
+ // look for constant expression
+ var expr ast.Expr
+ for e := range info.Types {
+ if ExprString(e) == test.expr {
+ expr = e
+ break
+ }
+ }
+ if expr == nil {
+ t.Errorf("package %s: no expression found for %s", name, test.expr)
+ continue
+ }
+ tv := info.Types[expr]
+
+ // check that type is correct
+ if got := tv.Type.String(); got != test.typ {
+ t.Errorf("package %s: got type %s; want %s", name, got, test.typ)
+ continue
+ }
+
+ // check that value is correct
+ if got := tv.Value.String(); got != test.val {
+ t.Errorf("package %s: got value %s; want %s", name, got, test.val)
+ }
+ }
+}
+
+func TestTypesInfo(t *testing.T) {
+ var tests = []struct {
+ src string
+ expr string // expression
+ typ string // value type
+ }{
+ // single-valued expressions of untyped constants
+ {`package b0; var x interface{} = false`, `false`, `bool`},
+ {`package b1; var x interface{} = 0`, `0`, `int`},
+ {`package b2; var x interface{} = 0.`, `0.`, `float64`},
+ {`package b3; var x interface{} = 0i`, `0i`, `complex128`},
+ {`package b4; var x interface{} = "foo"`, `"foo"`, `string`},
+
+ // comma-ok expressions
+ {`package p0; var x interface{}; var _, _ = x.(int)`,
+ `x.(int)`,
+ `(int, bool)`,
+ },
+ {`package p1; var x interface{}; func _() { _, _ = x.(int) }`,
+ `x.(int)`,
+ `(int, bool)`,
+ },
+ // TODO(gri): uncomment if we accept issue 8189.
+ // {`package p2; type mybool bool; var m map[string]complex128; var b mybool; func _() { _, b = m["foo"] }`,
+ // `m["foo"]`,
+ // `(complex128, p2.mybool)`,
+ // },
+ // TODO(gri): remove if we accept issue 8189.
+ {`package p2; var m map[string]complex128; var b bool; func _() { _, b = m["foo"] }`,
+ `m["foo"]`,
+ `(complex128, bool)`,
+ },
+ {`package p3; var c chan string; var _, _ = <-c`,
+ `<-c`,
+ `(string, bool)`,
+ },
+
+ // issue 6796
+ {`package issue6796_a; var x interface{}; var _, _ = (x.(int))`,
+ `x.(int)`,
+ `(int, bool)`,
+ },
+ {`package issue6796_b; var c chan string; var _, _ = (<-c)`,
+ `(<-c)`,
+ `(string, bool)`,
+ },
+ {`package issue6796_c; var c chan string; var _, _ = (<-c)`,
+ `<-c`,
+ `(string, bool)`,
+ },
+ {`package issue6796_d; var c chan string; var _, _ = ((<-c))`,
+ `(<-c)`,
+ `(string, bool)`,
+ },
+ {`package issue6796_e; func f(c chan string) { _, _ = ((<-c)) }`,
+ `(<-c)`,
+ `(string, bool)`,
+ },
+
+ // issue 7060
+ {`package issue7060_a; var ( m map[int]string; x, ok = m[0] )`,
+ `m[0]`,
+ `(string, bool)`,
+ },
+ {`package issue7060_b; var ( m map[int]string; x, ok interface{} = m[0] )`,
+ `m[0]`,
+ `(string, bool)`,
+ },
+ {`package issue7060_c; func f(x interface{}, ok bool, m map[int]string) { x, ok = m[0] }`,
+ `m[0]`,
+ `(string, bool)`,
+ },
+ {`package issue7060_d; var ( ch chan string; x, ok = <-ch )`,
+ `<-ch`,
+ `(string, bool)`,
+ },
+ {`package issue7060_e; var ( ch chan string; x, ok interface{} = <-ch )`,
+ `<-ch`,
+ `(string, bool)`,
+ },
+ {`package issue7060_f; func f(x interface{}, ok bool, ch chan string) { x, ok = <-ch }`,
+ `<-ch`,
+ `(string, bool)`,
+ },
+ }
+
+ for _, test := range tests {
+ info := Info{Types: make(map[ast.Expr]TypeAndValue)}
+ name := mustTypecheck(t, "TypesInfo", test.src, &info)
+
+ // look for expression type
+ var typ Type
+ for e, tv := range info.Types {
+ if ExprString(e) == test.expr {
+ typ = tv.Type
+ break
+ }
+ }
+ if typ == nil {
+ t.Errorf("package %s: no type found for %s", name, test.expr)
+ continue
+ }
+
+ // check that type is correct
+ if got := typ.String(); got != test.typ {
+ t.Errorf("package %s: got %s; want %s", name, got, test.typ)
+ }
+ }
+}
+
+func predString(tv TypeAndValue) string {
+ var buf bytes.Buffer
+ pred := func(b bool, s string) {
+ if b {
+ if buf.Len() > 0 {
+ buf.WriteString(", ")
+ }
+ buf.WriteString(s)
+ }
+ }
+
+ pred(tv.IsVoid(), "void")
+ pred(tv.IsType(), "type")
+ pred(tv.IsBuiltin(), "builtin")
+ pred(tv.IsValue() && tv.Value != nil, "const")
+ pred(tv.IsValue() && tv.Value == nil, "value")
+ pred(tv.IsNil(), "nil")
+ pred(tv.Addressable(), "addressable")
+ pred(tv.Assignable(), "assignable")
+ pred(tv.HasOk(), "hasOk")
+
+ if buf.Len() == 0 {
+ return "invalid"
+ }
+ return buf.String()
+}
+
+func TestPredicatesInfo(t *testing.T) {
+ skipSpecialPlatforms(t)
+
+ var tests = []struct {
+ src string
+ expr string
+ pred string
+ }{
+ // void
+ {`package n0; func f() { f() }`, `f()`, `void`},
+
+ // types
+ {`package t0; type _ int`, `int`, `type`},
+ {`package t1; type _ []int`, `[]int`, `type`},
+ {`package t2; type _ func()`, `func()`, `type`},
+
+ // built-ins
+ {`package b0; var _ = len("")`, `len`, `builtin`},
+ {`package b1; var _ = (len)("")`, `(len)`, `builtin`},
+
+ // constants
+ {`package c0; var _ = 42`, `42`, `const`},
+ {`package c1; var _ = "foo" + "bar"`, `"foo" + "bar"`, `const`},
+ {`package c2; const (i = 1i; _ = i)`, `i`, `const`},
+
+ // values
+ {`package v0; var (a, b int; _ = a + b)`, `a + b`, `value`},
+ {`package v1; var _ = &[]int{1}`, `([]int literal)`, `value`},
+ {`package v2; var _ = func(){}`, `(func() literal)`, `value`},
+ {`package v4; func f() { _ = f }`, `f`, `value`},
+ {`package v3; var _ *int = nil`, `nil`, `value, nil`},
+ {`package v3; var _ *int = (nil)`, `(nil)`, `value, nil`},
+
+ // addressable (and thus assignable) operands
+ {`package a0; var (x int; _ = x)`, `x`, `value, addressable, assignable`},
+ {`package a1; var (p *int; _ = *p)`, `*p`, `value, addressable, assignable`},
+ {`package a2; var (s []int; _ = s[0])`, `s[0]`, `value, addressable, assignable`},
+ {`package a3; var (s struct{f int}; _ = s.f)`, `s.f`, `value, addressable, assignable`},
+ {`package a4; var (a [10]int; _ = a[0])`, `a[0]`, `value, addressable, assignable`},
+ {`package a5; func _(x int) { _ = x }`, `x`, `value, addressable, assignable`},
+ {`package a6; func _()(x int) { _ = x; return }`, `x`, `value, addressable, assignable`},
+ {`package a7; type T int; func (x T) _() { _ = x }`, `x`, `value, addressable, assignable`},
+ // composite literals are not addressable
+
+ // assignable but not addressable values
+ {`package s0; var (m map[int]int; _ = m[0])`, `m[0]`, `value, assignable, hasOk`},
+ {`package s1; var (m map[int]int; _, _ = m[0])`, `m[0]`, `value, assignable, hasOk`},
+
+ // hasOk expressions
+ {`package k0; var (ch chan int; _ = <-ch)`, `<-ch`, `value, hasOk`},
+ {`package k1; var (ch chan int; _, _ = <-ch)`, `<-ch`, `value, hasOk`},
+
+ // missing entries
+ // - package names are collected in the Uses map
+ // - identifiers being declared are collected in the Defs map
+ {`package m0; import "os"; func _() { _ = os.Stdout }`, `os`, ``},
+ {`package m1; import p "os"; func _() { _ = p.Stdout }`, `p`, ``},
+ {`package m2; const c = 0`, `c`, ``},
+ {`package m3; type T int`, `T`, ``},
+ {`package m4; var v int`, `v`, ``},
+ {`package m5; func f() {}`, `f`, ``},
+ {`package m6; func _(x int) {}`, `x`, ``},
+ {`package m6; func _()(x int) { return }`, `x`, ``},
+ {`package m6; type T int; func (x T) _() {}`, `x`, ``},
+ }
+
+ for _, test := range tests {
+ info := Info{Types: make(map[ast.Expr]TypeAndValue)}
+ name := mustTypecheck(t, "PredicatesInfo", test.src, &info)
+
+ // look for expression predicates
+ got := ""
+ for e, tv := range info.Types {
+ //println(name, ExprString(e))
+ if ExprString(e) == test.expr {
+ got = predString(tv)
+ break
+ }
+ }
+
+ if got != test.pred {
+ t.Errorf("package %s: got %s; want %s", name, got, test.pred)
+ }
+ }
+}
+
+func TestScopesInfo(t *testing.T) {
+ skipSpecialPlatforms(t)
+
+ var tests = []struct {
+ src string
+ scopes []string // list of scope descriptors of the form kind:varlist
+ }{
+ {`package p0`, []string{
+ "file:",
+ }},
+ {`package p1; import ( "fmt"; m "math"; _ "os" ); var ( _ = fmt.Println; _ = m.Pi )`, []string{
+ "file:fmt m",
+ }},
+ {`package p2; func _() {}`, []string{
+ "file:", "func:",
+ }},
+ {`package p3; func _(x, y int) {}`, []string{
+ "file:", "func:x y",
+ }},
+ {`package p4; func _(x, y int) { x, z := 1, 2; _ = z }`, []string{
+ "file:", "func:x y z", // redeclaration of x
+ }},
+ {`package p5; func _(x, y int) (u, _ int) { return }`, []string{
+ "file:", "func:u x y",
+ }},
+ {`package p6; func _() { { var x int; _ = x } }`, []string{
+ "file:", "func:", "block:x",
+ }},
+ {`package p7; func _() { if true {} }`, []string{
+ "file:", "func:", "if:", "block:",
+ }},
+ {`package p8; func _() { if x := 0; x < 0 { y := x; _ = y } }`, []string{
+ "file:", "func:", "if:x", "block:y",
+ }},
+ {`package p9; func _() { switch x := 0; x {} }`, []string{
+ "file:", "func:", "switch:x",
+ }},
+ {`package p10; func _() { switch x := 0; x { case 1: y := x; _ = y; default: }}`, []string{
+ "file:", "func:", "switch:x", "case:y", "case:",
+ }},
+ {`package p11; func _(t interface{}) { switch t.(type) {} }`, []string{
+ "file:", "func:t", "type switch:",
+ }},
+ {`package p12; func _(t interface{}) { switch t := t; t.(type) {} }`, []string{
+ "file:", "func:t", "type switch:t",
+ }},
+ {`package p13; func _(t interface{}) { switch x := t.(type) { case int: _ = x } }`, []string{
+ "file:", "func:t", "type switch:", "case:x", // x implicitly declared
+ }},
+ {`package p14; func _() { select{} }`, []string{
+ "file:", "func:",
+ }},
+ {`package p15; func _(c chan int) { select{ case <-c: } }`, []string{
+ "file:", "func:c", "comm:",
+ }},
+ {`package p16; func _(c chan int) { select{ case i := <-c: x := i; _ = x} }`, []string{
+ "file:", "func:c", "comm:i x",
+ }},
+ {`package p17; func _() { for{} }`, []string{
+ "file:", "func:", "for:", "block:",
+ }},
+ {`package p18; func _(n int) { for i := 0; i < n; i++ { _ = i } }`, []string{
+ "file:", "func:n", "for:i", "block:",
+ }},
+ {`package p19; func _(a []int) { for i := range a { _ = i} }`, []string{
+ "file:", "func:a", "range:i", "block:",
+ }},
+ {`package p20; var s int; func _(a []int) { for i, x := range a { s += x; _ = i } }`, []string{
+ "file:", "func:a", "range:i x", "block:",
+ }},
+ }
+
+ for _, test := range tests {
+ info := Info{Scopes: make(map[ast.Node]*Scope)}
+ name := mustTypecheck(t, "ScopesInfo", test.src, &info)
+
+ // number of scopes must match
+ if len(info.Scopes) != len(test.scopes) {
+ t.Errorf("package %s: got %d scopes; want %d", name, len(info.Scopes), len(test.scopes))
+ }
+
+ // scope descriptions must match
+ for node, scope := range info.Scopes {
+ kind := ""
+ switch node.(type) {
+ case *ast.File:
+ kind = "file"
+ case *ast.FuncType:
+ kind = "func"
+ case *ast.BlockStmt:
+ kind = "block"
+ case *ast.IfStmt:
+ kind = "if"
+ case *ast.SwitchStmt:
+ kind = "switch"
+ case *ast.TypeSwitchStmt:
+ kind = "type switch"
+ case *ast.CaseClause:
+ kind = "case"
+ case *ast.CommClause:
+ kind = "comm"
+ case *ast.ForStmt:
+ kind = "for"
+ case *ast.RangeStmt:
+ kind = "range"
+ }
+
+ // look for matching scope description
+ desc := kind + ":" + strings.Join(scope.Names(), " ")
+ found := false
+ for _, d := range test.scopes {
+ if desc == d {
+ found = true
+ break
+ }
+ }
+ if !found {
+ t.Errorf("package %s: no matching scope found for %s", name, desc)
+ }
+ }
+ }
+}
+
+func TestInitOrderInfo(t *testing.T) {
+ var tests = []struct {
+ src string
+ inits []string
+ }{
+ {`package p0; var (x = 1; y = x)`, []string{
+ "x = 1", "y = x",
+ }},
+ {`package p1; var (a = 1; b = 2; c = 3)`, []string{
+ "a = 1", "b = 2", "c = 3",
+ }},
+ {`package p2; var (a, b, c = 1, 2, 3)`, []string{
+ "a = 1", "b = 2", "c = 3",
+ }},
+ {`package p3; var _ = f(); func f() int { return 1 }`, []string{
+ "_ = f()", // blank var
+ }},
+ {`package p4; var (a = 0; x = y; y = z; z = 0)`, []string{
+ "a = 0", "z = 0", "y = z", "x = y",
+ }},
+ {`package p5; var (a, _ = m[0]; m map[int]string)`, []string{
+ "a, _ = m[0]", // blank var
+ }},
+ {`package p6; var a, b = f(); func f() (_, _ int) { return z, z }; var z = 0`, []string{
+ "z = 0", "a, b = f()",
+ }},
+ {`package p7; var (a = func() int { return b }(); b = 1)`, []string{
+ "b = 1", "a = (func() int literal)()",
+ }},
+ {`package p8; var (a, b = func() (_, _ int) { return c, c }(); c = 1)`, []string{
+ "c = 1", "a, b = (func() (_, _ int) literal)()",
+ }},
+ {`package p9; type T struct{}; func (T) m() int { _ = y; return 0 }; var x, y = T.m, 1`, []string{
+ "y = 1", "x = T.m",
+ }},
+ {`package p10; var (d = c + b; a = 0; b = 0; c = 0)`, []string{
+ "a = 0", "b = 0", "c = 0", "d = c + b",
+ }},
+ {`package p11; var (a = e + c; b = d + c; c = 0; d = 0; e = 0)`, []string{
+ "c = 0", "d = 0", "b = d + c", "e = 0", "a = e + c",
+ }},
+ // emit an initializer for n:1 initializations only once (not for each node
+ // on the lhs which may appear in different order in the dependency graph)
+ {`package p12; var (a = x; b = 0; x, y = m[0]; m map[int]int)`, []string{
+ "b = 0", "x, y = m[0]", "a = x",
+ }},
+ // test case from spec section on package initialization
+ {`package p12
+
+ var (
+ a = c + b
+ b = f()
+ c = f()
+ d = 3
+ )
+
+ func f() int {
+ d++
+ return d
+ }`, []string{
+ "d = 3", "b = f()", "c = f()", "a = c + b",
+ }},
+ // test case for issue 7131
+ {`package main
+
+ var counter int
+ func next() int { counter++; return counter }
+
+ var _ = makeOrder()
+ func makeOrder() []int { return []int{f, b, d, e, c, a} }
+
+ var a = next()
+ var b, c = next(), next()
+ var d, e, f = next(), next(), next()
+ `, []string{
+ "a = next()", "b = next()", "c = next()", "d = next()", "e = next()", "f = next()", "_ = makeOrder()",
+ }},
+ }
+
+ for _, test := range tests {
+ info := Info{}
+ name := mustTypecheck(t, "InitOrderInfo", test.src, &info)
+
+ // number of initializers must match
+ if len(info.InitOrder) != len(test.inits) {
+ t.Errorf("package %s: got %d initializers; want %d", name, len(info.InitOrder), len(test.inits))
+ continue
+ }
+
+ // initializers must match
+ for i, want := range test.inits {
+ got := info.InitOrder[i].String()
+ if got != want {
+ t.Errorf("package %s, init %d: got %s; want %s", name, i, got, want)
+ continue
+ }
+ }
+ }
+}
+
+func TestMultiFileInitOrder(t *testing.T) {
+ fset := token.NewFileSet()
+ mustParse := func(src string) *ast.File {
+ f, err := parser.ParseFile(fset, "main", src, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return f
+ }
+
+ fileA := mustParse(`package main; var a = 1`)
+ fileB := mustParse(`package main; var b = 2`)
+
+ // The initialization order must not depend on the parse
+ // order of the files, only on the presentation order to
+ // the type-checker.
+ for _, test := range []struct {
+ files []*ast.File
+ want string
+ }{
+ {[]*ast.File{fileA, fileB}, "[a = 1 b = 2]"},
+ {[]*ast.File{fileB, fileA}, "[b = 2 a = 1]"},
+ } {
+ var info Info
+ if _, err := new(Config).Check("main", fset, test.files, &info); err != nil {
+ t.Fatal(err)
+ }
+ if got := fmt.Sprint(info.InitOrder); got != test.want {
+ t.Fatalf("got %s; want %s", got, test.want)
+ }
+ }
+}
+
+func TestFiles(t *testing.T) {
+ var sources = []string{
+ "package p; type T struct{}; func (T) m1() {}",
+ "package p; func (T) m2() {}; var x interface{ m1(); m2() } = T{}",
+ "package p; func (T) m3() {}; var y interface{ m1(); m2(); m3() } = T{}",
+ "package p",
+ }
+
+ var conf Config
+ fset := token.NewFileSet()
+ pkg := NewPackage("p", "p")
+ var info Info
+ check := NewChecker(&conf, fset, pkg, &info)
+
+ for i, src := range sources {
+ filename := fmt.Sprintf("sources%d", i)
+ f, err := parser.ParseFile(fset, filename, src, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := check.Files([]*ast.File{f}); err != nil {
+ t.Error(err)
+ }
+ }
+
+ // check InitOrder is [x y]
+ var vars []string
+ for _, init := range info.InitOrder {
+ for _, v := range init.Lhs {
+ vars = append(vars, v.Name())
+ }
+ }
+ if got, want := fmt.Sprint(vars), "[x y]"; got != want {
+ t.Errorf("InitOrder == %s, want %s", got, want)
+ }
+}
+
+func TestSelection(t *testing.T) {
+ selections := make(map[*ast.SelectorExpr]*Selection)
+
+ fset := token.NewFileSet()
+ conf := Config{
+ Packages: make(map[string]*Package),
+ Import: func(imports map[string]*Package, path string) (*Package, error) {
+ return imports[path], nil
+ },
+ }
+ makePkg := func(path, src string) {
+ f, err := parser.ParseFile(fset, path+".go", src, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ pkg, err := conf.Check(path, fset, []*ast.File{f}, &Info{Selections: selections})
+ if err != nil {
+ t.Fatal(err)
+ }
+ conf.Packages[path] = pkg
+ }
+
+ const libSrc = `
+package lib
+type T float64
+const C T = 3
+var V T
+func F() {}
+func (T) M() {}
+`
+ const mainSrc = `
+package main
+import "lib"
+
+type A struct {
+ *B
+ C
+}
+
+type B struct {
+ b int
+}
+
+func (B) f(int)
+
+type C struct {
+ c int
+}
+
+func (C) g()
+func (*C) h()
+
+func main() {
+ // qualified identifiers
+ var _ lib.T
+ _ = lib.C
+ _ = lib.F
+ _ = lib.V
+ _ = lib.T.M
+
+ // fields
+ _ = A{}.B
+ _ = new(A).B
+
+ _ = A{}.C
+ _ = new(A).C
+
+ _ = A{}.b
+ _ = new(A).b
+
+ _ = A{}.c
+ _ = new(A).c
+
+ // methods
+ _ = A{}.f
+ _ = new(A).f
+ _ = A{}.g
+ _ = new(A).g
+ _ = new(A).h
+
+ _ = B{}.f
+ _ = new(B).f
+
+ _ = C{}.g
+ _ = new(C).g
+ _ = new(C).h
+
+ // method expressions
+ _ = A.f
+ _ = (*A).f
+ _ = B.f
+ _ = (*B).f
+}`
+
+ wantOut := map[string][2]string{
+ "lib.T.M": {"method expr (lib.T) M(lib.T)", ".[0]"},
+
+ "A{}.B": {"field (main.A) B *main.B", ".[0]"},
+ "new(A).B": {"field (*main.A) B *main.B", "->[0]"},
+ "A{}.C": {"field (main.A) C main.C", ".[1]"},
+ "new(A).C": {"field (*main.A) C main.C", "->[1]"},
+ "A{}.b": {"field (main.A) b int", "->[0 0]"},
+ "new(A).b": {"field (*main.A) b int", "->[0 0]"},
+ "A{}.c": {"field (main.A) c int", ".[1 0]"},
+ "new(A).c": {"field (*main.A) c int", "->[1 0]"},
+
+ "A{}.f": {"method (main.A) f(int)", "->[0 0]"},
+ "new(A).f": {"method (*main.A) f(int)", "->[0 0]"},
+ "A{}.g": {"method (main.A) g()", ".[1 0]"},
+ "new(A).g": {"method (*main.A) g()", "->[1 0]"},
+ "new(A).h": {"method (*main.A) h()", "->[1 1]"}, // TODO(gri) should this report .[1 1] ?
+ "B{}.f": {"method (main.B) f(int)", ".[0]"},
+ "new(B).f": {"method (*main.B) f(int)", "->[0]"},
+ "C{}.g": {"method (main.C) g()", ".[0]"},
+ "new(C).g": {"method (*main.C) g()", "->[0]"},
+ "new(C).h": {"method (*main.C) h()", "->[1]"}, // TODO(gri) should this report .[1] ?
+
+ "A.f": {"method expr (main.A) f(main.A, int)", "->[0 0]"},
+ "(*A).f": {"method expr (*main.A) f(*main.A, int)", "->[0 0]"},
+ "B.f": {"method expr (main.B) f(main.B, int)", ".[0]"},
+ "(*B).f": {"method expr (*main.B) f(*main.B, int)", "->[0]"},
+ }
+
+ makePkg("lib", libSrc)
+ makePkg("main", mainSrc)
+
+ for e, sel := range selections {
+ sel.String() // assertion: must not panic
+
+ start := fset.Position(e.Pos()).Offset
+ end := fset.Position(e.End()).Offset
+ syntax := mainSrc[start:end] // (all SelectorExprs are in main, not lib)
+
+ direct := "."
+ if sel.Indirect() {
+ direct = "->"
+ }
+ got := [2]string{
+ sel.String(),
+ fmt.Sprintf("%s%v", direct, sel.Index()),
+ }
+ want := wantOut[syntax]
+ if want != got {
+ t.Errorf("%s: got %q; want %q", syntax, got, want)
+ }
+ delete(wantOut, syntax)
+
+ // We must explicitly assert properties of the
+ // Signature's receiver since it doesn't participate
+ // in Identical() or String().
+ sig, _ := sel.Type().(*Signature)
+ if sel.Kind() == MethodVal {
+ got := sig.Recv().Type()
+ want := sel.Recv()
+ if !Identical(got, want) {
+ t.Errorf("%s: Recv() = %s, want %s", syntax, got, want)
+ }
+ } else if sig != nil && sig.Recv() != nil {
+ t.Errorf("%s: signature has receiver %s", sig, sig.Recv().Type())
+ }
+ }
+ // Assert that all wantOut entries were used exactly once.
+ for syntax := range wantOut {
+ t.Errorf("no ast.Selection found with syntax %q", syntax)
+ }
+}
+
+func TestIssue8518(t *testing.T) {
+ fset := token.NewFileSet()
+ conf := Config{
+ Packages: make(map[string]*Package),
+ Error: func(err error) { t.Log(err) }, // don't exit after first error
+ Import: func(imports map[string]*Package, path string) (*Package, error) {
+ return imports[path], nil
+ },
+ }
+ makePkg := func(path, src string) {
+ f, err := parser.ParseFile(fset, path, src, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ pkg, _ := conf.Check(path, fset, []*ast.File{f}, nil) // errors logged via conf.Error
+ conf.Packages[path] = pkg
+ }
+
+ const libSrc = `
+package a
+import "missing"
+const C1 = foo
+const C2 = missing.C
+`
+
+ const mainSrc = `
+package main
+import "a"
+var _ = a.C1
+var _ = a.C2
+`
+
+ makePkg("a", libSrc)
+ makePkg("main", mainSrc) // don't crash when type-checking this package
+}
+
+func TestLookupFieldOrMethod(t *testing.T) {
+ // Test cases assume a lookup of the form a.f or x.f, where a stands for an
+ // addressable value, and x for a non-addressable value (even though a variable
+ // for ease of test case writing).
+ var tests = []struct {
+ src string
+ found bool
+ index []int
+ indirect bool
+ }{
+ // field lookups
+ {"var x T; type T struct{}", false, nil, false},
+ {"var x T; type T struct{ f int }", true, []int{0}, false},
+ {"var x T; type T struct{ a, b, f, c int }", true, []int{2}, false},
+
+ // method lookups
+ {"var a T; type T struct{}; func (T) f() {}", true, []int{0}, false},
+ {"var a *T; type T struct{}; func (T) f() {}", true, []int{0}, true},
+ {"var a T; type T struct{}; func (*T) f() {}", true, []int{0}, false},
+ {"var a *T; type T struct{}; func (*T) f() {}", true, []int{0}, true}, // TODO(gri) should this report indirect = false?
+
+ // collisions
+ {"type ( E1 struct{ f int }; E2 struct{ f int }; x struct{ E1; *E2 })", false, []int{1, 0}, false},
+ {"type ( E1 struct{ f int }; E2 struct{}; x struct{ E1; *E2 }); func (E2) f() {}", false, []int{1, 0}, false},
+
+ // outside methodset
+ // (*T).f method exists, but value of type T is not addressable
+ {"var x T; type T struct{}; func (*T) f() {}", false, nil, true},
+ }
+
+ for _, test := range tests {
+ pkg, err := pkgFor("test", "package p;"+test.src, nil)
+ if err != nil {
+ t.Errorf("%s: incorrect test case: %s", test.src, err)
+ continue
+ }
+
+ obj := pkg.Scope().Lookup("a")
+ if obj == nil {
+ if obj = pkg.Scope().Lookup("x"); obj == nil {
+ t.Errorf("%s: incorrect test case - no object a or x", test.src)
+ continue
+ }
+ }
+
+ f, index, indirect := LookupFieldOrMethod(obj.Type(), obj.Name() == "a", pkg, "f")
+ if (f != nil) != test.found {
+ if f == nil {
+ t.Errorf("%s: got no object; want one", test.src)
+ } else {
+ t.Errorf("%s: got object = %v; want none", test.src, f)
+ }
+ }
+ if !sameSlice(index, test.index) {
+ t.Errorf("%s: got index = %v; want %v", test.src, index, test.index)
+ }
+ if indirect != test.indirect {
+ t.Errorf("%s: got indirect = %v; want %v", test.src, indirect, test.indirect)
+ }
+ }
+}
+
+func sameSlice(a, b []int) bool {
+ if len(a) != len(b) {
+ return false
+ }
+ for i, x := range a {
+ if x != b[i] {
+ return false
+ }
+ }
+ return true
+}
+
+// TestScopeLookupParent ensures that (*Scope).LookupParent returns
+// the correct result at various positions with the source.
+func TestScopeLookupParent(t *testing.T) {
+ fset := token.NewFileSet()
+ conf := Config{
+ Packages: make(map[string]*Package),
+ Import: func(imports map[string]*Package, path string) (*Package, error) {
+ return imports[path], nil
+ },
+ }
+ mustParse := func(src string) *ast.File {
+ f, err := parser.ParseFile(fset, "dummy.go", src, parser.ParseComments)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return f
+ }
+ var info Info
+ makePkg := func(path string, files ...*ast.File) {
+ conf.Packages[path], _ = conf.Check(path, fset, files, &info)
+ }
+
+ makePkg("lib", mustParse("package lib; var X int"))
+ // Each /*name=kind:line*/ comment makes the test look up the
+ // name at that point and checks that it resolves to a decl of
+ // the specified kind and line number. "undef" means undefined.
+ mainSrc := `
+package main
+import "lib"
+var Y = lib.X
+func f() {
+ print(Y) /*Y=var:4*/
+ z /*z=undef*/ := /*z=undef*/ 1 /*z=var:7*/
+ print(z)
+ /*f=func:5*/ /*lib=pkgname:3*/
+ type /*T=undef*/ T /*T=typename:10*/ *T
+}
+`
+ info.Uses = make(map[*ast.Ident]Object)
+ f := mustParse(mainSrc)
+ makePkg("main", f)
+ mainScope := conf.Packages["main"].Scope()
+ rx := regexp.MustCompile(`^/\*(\w*)=([\w:]*)\*/$`)
+ for _, group := range f.Comments {
+ for _, comment := range group.List {
+ // Parse the assertion in the comment.
+ m := rx.FindStringSubmatch(comment.Text)
+ if m == nil {
+ t.Errorf("%s: bad comment: %s",
+ fset.Position(comment.Pos()), comment.Text)
+ continue
+ }
+ name, want := m[1], m[2]
+
+ // Look up the name in the innermost enclosing scope.
+ inner := mainScope.Innermost(comment.Pos())
+ if inner == nil {
+ t.Errorf("%s: at %s: can't find innermost scope",
+ fset.Position(comment.Pos()), comment.Text)
+ continue
+ }
+ got := "undef"
+ if _, obj := inner.LookupParent(name, comment.Pos()); obj != nil {
+ kind := strings.ToLower(strings.TrimPrefix(reflect.TypeOf(obj).String(), "*types."))
+ got = fmt.Sprintf("%s:%d", kind, fset.Position(obj.Pos()).Line)
+ }
+ if got != want {
+ t.Errorf("%s: at %s: %s resolved to %s, want %s",
+ fset.Position(comment.Pos()), comment.Text, name, got, want)
+ }
+ }
+ }
+
+ // Check that for each referring identifier,
+ // a lookup of its name on the innermost
+ // enclosing scope returns the correct object.
+
+ for id, wantObj := range info.Uses {
+ inner := mainScope.Innermost(id.Pos())
+ if inner == nil {
+ t.Errorf("%s: can't find innermost scope enclosing %q",
+ fset.Position(id.Pos()), id.Name)
+ continue
+ }
+
+ // Exclude selectors and qualified identifiers---lexical
+ // refs only. (Ideally, we'd see if the AST parent is a
+ // SelectorExpr, but that requires PathEnclosingInterval
+ // from golang.org/x/tools/go/ast/astutil.)
+ if id.Name == "X" {
+ continue
+ }
+
+ _, gotObj := inner.LookupParent(id.Name, id.Pos())
+ if gotObj != wantObj {
+ t.Errorf("%s: got %v, want %v",
+ fset.Position(id.Pos()), gotObj, wantObj)
+ continue
+ }
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/assignments.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/assignments.go
new file mode 100644
index 0000000000..93b842eaa0
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/assignments.go
@@ -0,0 +1,328 @@
+// 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.
+
+// This file implements initialization and assignment checks.
+
+package types
+
+import (
+ "go/ast"
+ "go/token"
+)
+
+// assignment reports whether x can be assigned to a variable of type T,
+// if necessary by attempting to convert untyped values to the appropriate
+// type. If x.mode == invalid upon return, then assignment has already
+// issued an error message and the caller doesn't have to report another.
+// Use T == nil to indicate assignment to an untyped blank identifier.
+//
+// TODO(gri) Should find a better way to handle in-band errors.
+//
+func (check *Checker) assignment(x *operand, T Type) bool {
+ switch x.mode {
+ case invalid:
+ return true // error reported before
+ case constant, variable, mapindex, value, commaok:
+ // ok
+ default:
+ unreachable()
+ }
+
+ // x must be a single value
+ // (tuple types are never named - no need for underlying type)
+ if t, _ := x.typ.(*Tuple); t != nil {
+ assert(t.Len() > 1)
+ check.errorf(x.pos(), "%d-valued expression %s used as single value", t.Len(), x)
+ x.mode = invalid
+ return false
+ }
+
+ if isUntyped(x.typ) {
+ target := T
+ // spec: "If an untyped constant is assigned to a variable of interface
+ // type or the blank identifier, the constant is first converted to type
+ // bool, rune, int, float64, complex128 or string respectively, depending
+ // on whether the value is a boolean, rune, integer, floating-point, complex,
+ // or string constant."
+ if T == nil || IsInterface(T) {
+ if T == nil && x.typ == Typ[UntypedNil] {
+ check.errorf(x.pos(), "use of untyped nil")
+ x.mode = invalid
+ return false
+ }
+ target = defaultType(x.typ)
+ }
+ check.convertUntyped(x, target)
+ if x.mode == invalid {
+ return false
+ }
+ }
+
+ // spec: "If a left-hand side is the blank identifier, any typed or
+ // non-constant value except for the predeclared identifier nil may
+ // be assigned to it."
+ return T == nil || x.assignableTo(check.conf, T)
+}
+
+func (check *Checker) initConst(lhs *Const, x *operand) {
+ if x.mode == invalid || x.typ == Typ[Invalid] || lhs.typ == Typ[Invalid] {
+ if lhs.typ == nil {
+ lhs.typ = Typ[Invalid]
+ }
+ return
+ }
+
+ // rhs must be a constant
+ if x.mode != constant {
+ check.errorf(x.pos(), "%s is not constant", x)
+ if lhs.typ == nil {
+ lhs.typ = Typ[Invalid]
+ }
+ return
+ }
+ assert(isConstType(x.typ))
+
+ // If the lhs doesn't have a type yet, use the type of x.
+ if lhs.typ == nil {
+ lhs.typ = x.typ
+ }
+
+ if !check.assignment(x, lhs.typ) {
+ if x.mode != invalid {
+ check.errorf(x.pos(), "cannot define constant %s (type %s) as %s", lhs.Name(), lhs.typ, x)
+ }
+ return
+ }
+
+ lhs.val = x.val
+}
+
+// If result is set, lhs is a function result parameter and x is a return result.
+func (check *Checker) initVar(lhs *Var, x *operand, result bool) Type {
+ if x.mode == invalid || x.typ == Typ[Invalid] || lhs.typ == Typ[Invalid] {
+ if lhs.typ == nil {
+ lhs.typ = Typ[Invalid]
+ }
+ return nil
+ }
+
+ // If the lhs doesn't have a type yet, use the type of x.
+ if lhs.typ == nil {
+ typ := x.typ
+ if isUntyped(typ) {
+ // convert untyped types to default types
+ if typ == Typ[UntypedNil] {
+ check.errorf(x.pos(), "use of untyped nil")
+ lhs.typ = Typ[Invalid]
+ return nil
+ }
+ typ = defaultType(typ)
+ }
+ lhs.typ = typ
+ }
+
+ if !check.assignment(x, lhs.typ) {
+ if x.mode != invalid {
+ if result {
+ // don't refer to lhs.name because it may be an anonymous result parameter
+ check.errorf(x.pos(), "cannot return %s as value of type %s", x, lhs.typ)
+ } else {
+ check.errorf(x.pos(), "cannot initialize %s with %s", lhs, x)
+ }
+ }
+ return nil
+ }
+
+ return x.typ
+}
+
+func (check *Checker) assignVar(lhs ast.Expr, x *operand) Type {
+ if x.mode == invalid || x.typ == Typ[Invalid] {
+ return nil
+ }
+
+ // Determine if the lhs is a (possibly parenthesized) identifier.
+ ident, _ := unparen(lhs).(*ast.Ident)
+
+ // Don't evaluate lhs if it is the blank identifier.
+ if ident != nil && ident.Name == "_" {
+ check.recordDef(ident, nil)
+ if !check.assignment(x, nil) {
+ assert(x.mode == invalid)
+ x.typ = nil
+ }
+ return x.typ
+ }
+
+ // If the lhs is an identifier denoting a variable v, this assignment
+ // is not a 'use' of v. Remember current value of v.used and restore
+ // after evaluating the lhs via check.expr.
+ var v *Var
+ var v_used bool
+ if ident != nil {
+ if _, obj := check.scope.LookupParent(ident.Name, token.NoPos); obj != nil {
+ v, _ = obj.(*Var)
+ if v != nil {
+ v_used = v.used
+ }
+ }
+ }
+
+ var z operand
+ check.expr(&z, lhs)
+ if v != nil {
+ v.used = v_used // restore v.used
+ }
+
+ if z.mode == invalid || z.typ == Typ[Invalid] {
+ return nil
+ }
+
+ // spec: "Each left-hand side operand must be addressable, a map index
+ // expression, or the blank identifier. Operands may be parenthesized."
+ switch z.mode {
+ case invalid:
+ return nil
+ case variable, mapindex:
+ // ok
+ default:
+ check.errorf(z.pos(), "cannot assign to %s", &z)
+ return nil
+ }
+
+ if !check.assignment(x, z.typ) {
+ if x.mode != invalid {
+ check.errorf(x.pos(), "cannot assign %s to %s", x, &z)
+ }
+ return nil
+ }
+
+ return x.typ
+}
+
+// If returnPos is valid, initVars is called to type-check the assignment of
+// return expressions, and returnPos is the position of the return statement.
+func (check *Checker) initVars(lhs []*Var, rhs []ast.Expr, returnPos token.Pos) {
+ l := len(lhs)
+ get, r, commaOk := unpack(func(x *operand, i int) { check.expr(x, rhs[i]) }, len(rhs), l == 2 && !returnPos.IsValid())
+ if get == nil || l != r {
+ // invalidate lhs and use rhs
+ for _, obj := range lhs {
+ if obj.typ == nil {
+ obj.typ = Typ[Invalid]
+ }
+ }
+ if get == nil {
+ return // error reported by unpack
+ }
+ check.useGetter(get, r)
+ if returnPos.IsValid() {
+ check.errorf(returnPos, "wrong number of return values (want %d, got %d)", l, r)
+ return
+ }
+ check.errorf(rhs[0].Pos(), "assignment count mismatch (%d vs %d)", l, r)
+ return
+ }
+
+ var x operand
+ if commaOk {
+ var a [2]Type
+ for i := range a {
+ get(&x, i)
+ a[i] = check.initVar(lhs[i], &x, returnPos.IsValid())
+ }
+ check.recordCommaOkTypes(rhs[0], a)
+ return
+ }
+
+ for i, lhs := range lhs {
+ get(&x, i)
+ check.initVar(lhs, &x, returnPos.IsValid())
+ }
+}
+
+func (check *Checker) assignVars(lhs, rhs []ast.Expr) {
+ l := len(lhs)
+ get, r, commaOk := unpack(func(x *operand, i int) { check.expr(x, rhs[i]) }, len(rhs), l == 2)
+ if get == nil {
+ return // error reported by unpack
+ }
+ if l != r {
+ check.useGetter(get, r)
+ check.errorf(rhs[0].Pos(), "assignment count mismatch (%d vs %d)", l, r)
+ return
+ }
+
+ var x operand
+ if commaOk {
+ var a [2]Type
+ for i := range a {
+ get(&x, i)
+ a[i] = check.assignVar(lhs[i], &x)
+ }
+ check.recordCommaOkTypes(rhs[0], a)
+ return
+ }
+
+ for i, lhs := range lhs {
+ get(&x, i)
+ check.assignVar(lhs, &x)
+ }
+}
+
+func (check *Checker) shortVarDecl(pos token.Pos, lhs, rhs []ast.Expr) {
+ scope := check.scope
+
+ // collect lhs variables
+ var newVars []*Var
+ var lhsVars = make([]*Var, len(lhs))
+ for i, lhs := range lhs {
+ var obj *Var
+ if ident, _ := lhs.(*ast.Ident); ident != nil {
+ // Use the correct obj if the ident is redeclared. The
+ // variable's scope starts after the declaration; so we
+ // must use Scope.Lookup here and call Scope.Insert
+ // (via check.declare) later.
+ name := ident.Name
+ if alt := scope.Lookup(name); alt != nil {
+ // redeclared object must be a variable
+ if alt, _ := alt.(*Var); alt != nil {
+ obj = alt
+ } else {
+ check.errorf(lhs.Pos(), "cannot assign to %s", lhs)
+ }
+ check.recordUse(ident, alt)
+ } else {
+ // declare new variable, possibly a blank (_) variable
+ obj = NewVar(ident.Pos(), check.pkg, name, nil)
+ if name != "_" {
+ newVars = append(newVars, obj)
+ }
+ check.recordDef(ident, obj)
+ }
+ } else {
+ check.errorf(lhs.Pos(), "cannot declare %s", lhs)
+ }
+ if obj == nil {
+ obj = NewVar(lhs.Pos(), check.pkg, "_", nil) // dummy variable
+ }
+ lhsVars[i] = obj
+ }
+
+ check.initVars(lhsVars, rhs, token.NoPos)
+
+ // declare new variables
+ if len(newVars) > 0 {
+ // spec: "The scope of a constant or variable identifier declared inside
+ // a function begins at the end of the ConstSpec or VarSpec (ShortVarDecl
+ // for short variable declarations) and ends at the end of the innermost
+ // containing block."
+ scopePos := rhs[len(rhs)-1].End()
+ for _, obj := range newVars {
+ check.declare(scope, nil, obj, scopePos) // recordObject already called
+ }
+ } else {
+ check.softErrorf(pos, "no new variables on left side of :=")
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/builtins.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/builtins.go
new file mode 100644
index 0000000000..f45f930a42
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/builtins.go
@@ -0,0 +1,628 @@
+// Copyright 2012 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.
+
+// This file implements typechecking of builtin function calls.
+
+package types
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/go/exact"
+)
+
+// builtin type-checks a call to the built-in specified by id and
+// returns true if the call is valid, with *x holding the result;
+// but x.expr is not set. If the call is invalid, the result is
+// false, and *x is undefined.
+//
+func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ bool) {
+ // append is the only built-in that permits the use of ... for the last argument
+ bin := predeclaredFuncs[id]
+ if call.Ellipsis.IsValid() && id != _Append {
+ check.invalidOp(call.Ellipsis, "invalid use of ... with built-in %s", bin.name)
+ check.use(call.Args...)
+ return
+ }
+
+ // For len(x) and cap(x) we need to know if x contains any function calls or
+ // receive operations. Save/restore current setting and set hasCallOrRecv to
+ // false for the evaluation of x so that we can check it afterwards.
+ // Note: We must do this _before_ calling unpack because unpack evaluates the
+ // first argument before we even call arg(x, 0)!
+ if id == _Len || id == _Cap {
+ defer func(b bool) {
+ check.hasCallOrRecv = b
+ }(check.hasCallOrRecv)
+ check.hasCallOrRecv = false
+ }
+
+ // determine actual arguments
+ var arg getter
+ nargs := len(call.Args)
+ switch id {
+ default:
+ // make argument getter
+ arg, nargs, _ = unpack(func(x *operand, i int) { check.expr(x, call.Args[i]) }, nargs, false)
+ if arg == nil {
+ return
+ }
+ // evaluate first argument, if present
+ if nargs > 0 {
+ arg(x, 0)
+ if x.mode == invalid {
+ return
+ }
+ }
+ case _Make, _New, _Offsetof, _Trace:
+ // arguments require special handling
+ }
+
+ // check argument count
+ {
+ msg := ""
+ if nargs < bin.nargs {
+ msg = "not enough"
+ } else if !bin.variadic && nargs > bin.nargs {
+ msg = "too many"
+ }
+ if msg != "" {
+ check.invalidOp(call.Rparen, "%s arguments for %s (expected %d, found %d)", msg, call, bin.nargs, nargs)
+ return
+ }
+ }
+
+ switch id {
+ case _Append:
+ // append(s S, x ...T) S, where T is the element type of S
+ // spec: "The variadic function append appends zero or more values x to s of type
+ // S, which must be a slice type, and returns the resulting slice, also of type S.
+ // The values x are passed to a parameter of type ...T where T is the element type
+ // of S and the respective parameter passing rules apply."
+ S := x.typ
+ var T Type
+ if s, _ := S.Underlying().(*Slice); s != nil {
+ T = s.elem
+ } else {
+ check.invalidArg(x.pos(), "%s is not a slice", x)
+ return
+ }
+
+ // remember arguments that have been evaluated already
+ alist := []operand{*x}
+
+ // spec: "As a special case, append also accepts a first argument assignable
+ // to type []byte with a second argument of string type followed by ... .
+ // This form appends the bytes of the string.
+ if nargs == 2 && call.Ellipsis.IsValid() && x.assignableTo(check.conf, NewSlice(universeByte)) {
+ arg(x, 1)
+ if x.mode == invalid {
+ return
+ }
+ if isString(x.typ) {
+ if check.Types != nil {
+ sig := makeSig(S, S, x.typ)
+ sig.variadic = true
+ check.recordBuiltinType(call.Fun, sig)
+ }
+ x.mode = value
+ x.typ = S
+ break
+ }
+ alist = append(alist, *x)
+ // fallthrough
+ }
+
+ // check general case by creating custom signature
+ sig := makeSig(S, S, NewSlice(T)) // []T required for variadic signature
+ sig.variadic = true
+ check.arguments(x, call, sig, func(x *operand, i int) {
+ // only evaluate arguments that have not been evaluated before
+ if i < len(alist) {
+ *x = alist[i]
+ return
+ }
+ arg(x, i)
+ }, nargs)
+ // ok to continue even if check.arguments reported errors
+
+ x.mode = value
+ x.typ = S
+ if check.Types != nil {
+ check.recordBuiltinType(call.Fun, sig)
+ }
+
+ case _Cap, _Len:
+ // cap(x)
+ // len(x)
+ mode := invalid
+ var typ Type
+ var val exact.Value
+ switch typ = implicitArrayDeref(x.typ.Underlying()); t := typ.(type) {
+ case *Basic:
+ if isString(t) && id == _Len {
+ if x.mode == constant {
+ mode = constant
+ val = exact.MakeInt64(int64(len(exact.StringVal(x.val))))
+ } else {
+ mode = value
+ }
+ }
+
+ case *Array:
+ mode = value
+ // spec: "The expressions len(s) and cap(s) are constants
+ // if the type of s is an array or pointer to an array and
+ // the expression s does not contain channel receives or
+ // function calls; in this case s is not evaluated."
+ if !check.hasCallOrRecv {
+ mode = constant
+ val = exact.MakeInt64(t.len)
+ }
+
+ case *Slice, *Chan:
+ mode = value
+
+ case *Map:
+ if id == _Len {
+ mode = value
+ }
+ }
+
+ if mode == invalid {
+ check.invalidArg(x.pos(), "%s for %s", x, bin.name)
+ return
+ }
+
+ x.mode = mode
+ x.typ = Typ[Int]
+ x.val = val
+ if check.Types != nil && mode != constant {
+ check.recordBuiltinType(call.Fun, makeSig(x.typ, typ))
+ }
+
+ case _Close:
+ // close(c)
+ c, _ := x.typ.Underlying().(*Chan)
+ if c == nil {
+ check.invalidArg(x.pos(), "%s is not a channel", x)
+ return
+ }
+ if c.dir == RecvOnly {
+ check.invalidArg(x.pos(), "%s must not be a receive-only channel", x)
+ return
+ }
+
+ x.mode = novalue
+ if check.Types != nil {
+ check.recordBuiltinType(call.Fun, makeSig(nil, c))
+ }
+
+ case _Complex:
+ // complex(x, y realT) complexT
+ if !check.complexArg(x) {
+ return
+ }
+
+ var y operand
+ arg(&y, 1)
+ if y.mode == invalid {
+ return
+ }
+ if !check.complexArg(&y) {
+ return
+ }
+
+ check.convertUntyped(x, y.typ)
+ if x.mode == invalid {
+ return
+ }
+ check.convertUntyped(&y, x.typ)
+ if y.mode == invalid {
+ return
+ }
+
+ if !Identical(x.typ, y.typ) {
+ check.invalidArg(x.pos(), "mismatched types %s and %s", x.typ, y.typ)
+ return
+ }
+
+ if x.mode == constant && y.mode == constant {
+ x.val = exact.BinaryOp(x.val, token.ADD, exact.MakeImag(y.val))
+ } else {
+ x.mode = value
+ }
+
+ realT := x.typ
+ complexT := Typ[Invalid]
+ switch realT.Underlying().(*Basic).kind {
+ case Float32:
+ complexT = Typ[Complex64]
+ case Float64:
+ complexT = Typ[Complex128]
+ case UntypedInt, UntypedRune, UntypedFloat:
+ if x.mode == constant {
+ realT = defaultType(realT).(*Basic)
+ complexT = Typ[UntypedComplex]
+ } else {
+ // untyped but not constant; probably because one
+ // operand is a non-constant shift of untyped lhs
+ realT = Typ[Float64]
+ complexT = Typ[Complex128]
+ }
+ default:
+ check.invalidArg(x.pos(), "float32 or float64 arguments expected")
+ return
+ }
+
+ x.typ = complexT
+ if check.Types != nil && x.mode != constant {
+ check.recordBuiltinType(call.Fun, makeSig(complexT, realT, realT))
+ }
+
+ if x.mode != constant {
+ // The arguments have now their final types, which at run-
+ // time will be materialized. Update the expression trees.
+ // If the current types are untyped, the materialized type
+ // is the respective default type.
+ // (If the result is constant, the arguments are never
+ // materialized and there is nothing to do.)
+ check.updateExprType(x.expr, realT, true)
+ check.updateExprType(y.expr, realT, true)
+ }
+
+ case _Copy:
+ // copy(x, y []T) int
+ var dst Type
+ if t, _ := x.typ.Underlying().(*Slice); t != nil {
+ dst = t.elem
+ }
+
+ var y operand
+ arg(&y, 1)
+ if y.mode == invalid {
+ return
+ }
+ var src Type
+ switch t := y.typ.Underlying().(type) {
+ case *Basic:
+ if isString(y.typ) {
+ src = universeByte
+ }
+ case *Slice:
+ src = t.elem
+ }
+
+ if dst == nil || src == nil {
+ check.invalidArg(x.pos(), "copy expects slice arguments; found %s and %s", x, &y)
+ return
+ }
+
+ if !Identical(dst, src) {
+ check.invalidArg(x.pos(), "arguments to copy %s and %s have different element types %s and %s", x, &y, dst, src)
+ return
+ }
+
+ if check.Types != nil {
+ check.recordBuiltinType(call.Fun, makeSig(Typ[Int], x.typ, y.typ))
+ }
+ x.mode = value
+ x.typ = Typ[Int]
+
+ case _Delete:
+ // delete(m, k)
+ m, _ := x.typ.Underlying().(*Map)
+ if m == nil {
+ check.invalidArg(x.pos(), "%s is not a map", x)
+ return
+ }
+ arg(x, 1) // k
+ if x.mode == invalid {
+ return
+ }
+
+ if !x.assignableTo(check.conf, m.key) {
+ check.invalidArg(x.pos(), "%s is not assignable to %s", x, m.key)
+ return
+ }
+
+ x.mode = novalue
+ if check.Types != nil {
+ check.recordBuiltinType(call.Fun, makeSig(nil, m, m.key))
+ }
+
+ case _Imag, _Real:
+ // imag(complexT) realT
+ // real(complexT) realT
+ if !isComplex(x.typ) {
+ check.invalidArg(x.pos(), "%s must be a complex number", x)
+ return
+ }
+ if x.mode == constant {
+ if id == _Real {
+ x.val = exact.Real(x.val)
+ } else {
+ x.val = exact.Imag(x.val)
+ }
+ } else {
+ x.mode = value
+ }
+ var k BasicKind
+ switch x.typ.Underlying().(*Basic).kind {
+ case Complex64:
+ k = Float32
+ case Complex128:
+ k = Float64
+ case UntypedComplex:
+ k = UntypedFloat
+ default:
+ unreachable()
+ }
+
+ if check.Types != nil && x.mode != constant {
+ check.recordBuiltinType(call.Fun, makeSig(Typ[k], x.typ))
+ }
+ x.typ = Typ[k]
+
+ case _Make:
+ // make(T, n)
+ // make(T, n, m)
+ // (no argument evaluated yet)
+ arg0 := call.Args[0]
+ T := check.typ(arg0)
+ if T == Typ[Invalid] {
+ return
+ }
+
+ var min int // minimum number of arguments
+ switch T.Underlying().(type) {
+ case *Slice:
+ min = 2
+ case *Map, *Chan:
+ min = 1
+ default:
+ check.invalidArg(arg0.Pos(), "cannot make %s; type must be slice, map, or channel", arg0)
+ return
+ }
+ if nargs < min || min+1 < nargs {
+ check.errorf(call.Pos(), "%s expects %d or %d arguments; found %d", call, min, min+1, nargs)
+ return
+ }
+ var sizes []int64 // constant integer arguments, if any
+ for _, arg := range call.Args[1:] {
+ if s, ok := check.index(arg, -1); ok && s >= 0 {
+ sizes = append(sizes, s)
+ }
+ }
+ if len(sizes) == 2 && sizes[0] > sizes[1] {
+ check.invalidArg(call.Args[1].Pos(), "length and capacity swapped")
+ // safe to continue
+ }
+ x.mode = value
+ x.typ = T
+ if check.Types != nil {
+ params := [...]Type{T, Typ[Int], Typ[Int]}
+ check.recordBuiltinType(call.Fun, makeSig(x.typ, params[:1+len(sizes)]...))
+ }
+
+ case _New:
+ // new(T)
+ // (no argument evaluated yet)
+ T := check.typ(call.Args[0])
+ if T == Typ[Invalid] {
+ return
+ }
+
+ x.mode = value
+ x.typ = &Pointer{base: T}
+ if check.Types != nil {
+ check.recordBuiltinType(call.Fun, makeSig(x.typ, T))
+ }
+
+ case _Panic:
+ // panic(x)
+ T := new(Interface)
+ if !check.assignment(x, T) {
+ assert(x.mode == invalid)
+ return
+ }
+
+ x.mode = novalue
+ if check.Types != nil {
+ check.recordBuiltinType(call.Fun, makeSig(nil, T))
+ }
+
+ case _Print, _Println:
+ // print(x, y, ...)
+ // println(x, y, ...)
+ var params []Type
+ if nargs > 0 {
+ params = make([]Type, nargs)
+ for i := 0; i < nargs; i++ {
+ if i > 0 {
+ arg(x, i) // first argument already evaluated
+ }
+ if !check.assignment(x, nil) {
+ assert(x.mode == invalid)
+ return
+ }
+ params[i] = x.typ
+ }
+ }
+
+ x.mode = novalue
+ if check.Types != nil {
+ check.recordBuiltinType(call.Fun, makeSig(nil, params...))
+ }
+
+ case _Recover:
+ // recover() interface{}
+ x.mode = value
+ x.typ = new(Interface)
+ if check.Types != nil {
+ check.recordBuiltinType(call.Fun, makeSig(x.typ))
+ }
+
+ case _Alignof:
+ // unsafe.Alignof(x T) uintptr
+ if !check.assignment(x, nil) {
+ assert(x.mode == invalid)
+ return
+ }
+
+ x.mode = constant
+ x.val = exact.MakeInt64(check.conf.alignof(x.typ))
+ x.typ = Typ[Uintptr]
+ // result is constant - no need to record signature
+
+ case _Offsetof:
+ // unsafe.Offsetof(x T) uintptr, where x must be a selector
+ // (no argument evaluated yet)
+ arg0 := call.Args[0]
+ selx, _ := unparen(arg0).(*ast.SelectorExpr)
+ if selx == nil {
+ check.invalidArg(arg0.Pos(), "%s is not a selector expression", arg0)
+ check.use(arg0)
+ return
+ }
+
+ check.expr(x, selx.X)
+ if x.mode == invalid {
+ return
+ }
+
+ base := derefStructPtr(x.typ)
+ sel := selx.Sel.Name
+ obj, index, indirect := LookupFieldOrMethod(base, false, check.pkg, sel)
+ switch obj.(type) {
+ case nil:
+ check.invalidArg(x.pos(), "%s has no single field %s", base, sel)
+ return
+ case *Func:
+ // TODO(gri) Using derefStructPtr may result in methods being found
+ // that don't actually exist. An error either way, but the error
+ // message is confusing. See: http://play.golang.org/p/al75v23kUy ,
+ // but go/types reports: "invalid argument: x.m is a method value".
+ check.invalidArg(arg0.Pos(), "%s is a method value", arg0)
+ return
+ }
+ if indirect {
+ check.invalidArg(x.pos(), "field %s is embedded via a pointer in %s", sel, base)
+ return
+ }
+
+ // TODO(gri) Should we pass x.typ instead of base (and indirect report if derefStructPtr indirected)?
+ check.recordSelection(selx, FieldVal, base, obj, index, false)
+
+ offs := check.conf.offsetof(base, index)
+ x.mode = constant
+ x.val = exact.MakeInt64(offs)
+ x.typ = Typ[Uintptr]
+ // result is constant - no need to record signature
+
+ case _Sizeof:
+ // unsafe.Sizeof(x T) uintptr
+ if !check.assignment(x, nil) {
+ assert(x.mode == invalid)
+ return
+ }
+
+ x.mode = constant
+ x.val = exact.MakeInt64(check.conf.sizeof(x.typ))
+ x.typ = Typ[Uintptr]
+ // result is constant - no need to record signature
+
+ case _Assert:
+ // assert(pred) causes a typechecker error if pred is false.
+ // The result of assert is the value of pred if there is no error.
+ // Note: assert is only available in self-test mode.
+ if x.mode != constant || !isBoolean(x.typ) {
+ check.invalidArg(x.pos(), "%s is not a boolean constant", x)
+ return
+ }
+ if x.val.Kind() != exact.Bool {
+ check.errorf(x.pos(), "internal error: value of %s should be a boolean constant", x)
+ return
+ }
+ if !exact.BoolVal(x.val) {
+ check.errorf(call.Pos(), "%s failed", call)
+ // compile-time assertion failure - safe to continue
+ }
+ // result is constant - no need to record signature
+
+ case _Trace:
+ // trace(x, y, z, ...) dumps the positions, expressions, and
+ // values of its arguments. The result of trace is the value
+ // of the first argument.
+ // Note: trace is only available in self-test mode.
+ // (no argument evaluated yet)
+ if nargs == 0 {
+ check.dump("%s: trace() without arguments", call.Pos())
+ x.mode = novalue
+ break
+ }
+ var t operand
+ x1 := x
+ for _, arg := range call.Args {
+ check.rawExpr(x1, arg, nil) // permit trace for types, e.g.: new(trace(T))
+ check.dump("%s: %s", x1.pos(), x1)
+ x1 = &t // use incoming x only for first argument
+ }
+ // trace is only available in test mode - no need to record signature
+
+ default:
+ unreachable()
+ }
+
+ return true
+}
+
+// makeSig makes a signature for the given argument and result types.
+// Default types are used for untyped arguments, and res may be nil.
+func makeSig(res Type, args ...Type) *Signature {
+ list := make([]*Var, len(args))
+ for i, param := range args {
+ list[i] = NewVar(token.NoPos, nil, "", defaultType(param))
+ }
+ params := NewTuple(list...)
+ var result *Tuple
+ if res != nil {
+ assert(!isUntyped(res))
+ result = NewTuple(NewVar(token.NoPos, nil, "", res))
+ }
+ return &Signature{params: params, results: result}
+}
+
+// implicitArrayDeref returns A if typ is of the form *A and A is an array;
+// otherwise it returns typ.
+//
+func implicitArrayDeref(typ Type) Type {
+ if p, ok := typ.(*Pointer); ok {
+ if a, ok := p.base.Underlying().(*Array); ok {
+ return a
+ }
+ }
+ return typ
+}
+
+// unparen returns e with any enclosing parentheses stripped.
+func unparen(e ast.Expr) ast.Expr {
+ for {
+ p, ok := e.(*ast.ParenExpr)
+ if !ok {
+ return e
+ }
+ e = p.X
+ }
+}
+
+func (check *Checker) complexArg(x *operand) bool {
+ t, _ := x.typ.Underlying().(*Basic)
+ if t != nil && (t.info&IsFloat != 0 || t.kind == UntypedInt || t.kind == UntypedRune) {
+ return true
+ }
+ check.invalidArg(x.pos(), "%s must be a float32, float64, or an untyped non-complex numeric constant", x)
+ return false
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/builtins_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/builtins_test.go
new file mode 100644
index 0000000000..e7857994ac
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/builtins_test.go
@@ -0,0 +1,204 @@
+// 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.
+
+package types_test
+
+import (
+ "fmt"
+ "go/ast"
+ "go/parser"
+ "testing"
+
+ _ "golang.org/x/tools/go/gcimporter"
+ . "golang.org/x/tools/go/types"
+)
+
+var builtinCalls = []struct {
+ name, src, sig string
+}{
+ {"append", `var s []int; _ = append(s)`, `func([]int, ...int) []int`},
+ {"append", `var s []int; _ = append(s, 0)`, `func([]int, ...int) []int`},
+ {"append", `var s []int; _ = (append)(s, 0)`, `func([]int, ...int) []int`},
+ {"append", `var s []byte; _ = ((append))(s, 0)`, `func([]byte, ...byte) []byte`},
+ {"append", `var s []byte; _ = append(s, "foo"...)`, `func([]byte, string...) []byte`},
+ {"append", `type T []byte; var s T; var str string; _ = append(s, str...)`, `func(p.T, string...) p.T`},
+ {"append", `type T []byte; type U string; var s T; var str U; _ = append(s, str...)`, `func(p.T, p.U...) p.T`},
+
+ {"cap", `var s [10]int; _ = cap(s)`, `invalid type`}, // constant
+ {"cap", `var s [10]int; _ = cap(&s)`, `invalid type`}, // constant
+ {"cap", `var s []int64; _ = cap(s)`, `func([]int64) int`},
+ {"cap", `var c chan<-bool; _ = cap(c)`, `func(chan<- bool) int`},
+
+ {"len", `_ = len("foo")`, `invalid type`}, // constant
+ {"len", `var s string; _ = len(s)`, `func(string) int`},
+ {"len", `var s [10]int; _ = len(s)`, `invalid type`}, // constant
+ {"len", `var s [10]int; _ = len(&s)`, `invalid type`}, // constant
+ {"len", `var s []int64; _ = len(s)`, `func([]int64) int`},
+ {"len", `var c chan<-bool; _ = len(c)`, `func(chan<- bool) int`},
+ {"len", `var m map[string]float32; _ = len(m)`, `func(map[string]float32) int`},
+
+ {"close", `var c chan int; close(c)`, `func(chan int)`},
+ {"close", `var c chan<- chan string; close(c)`, `func(chan<- chan string)`},
+
+ {"complex", `_ = complex(1, 0)`, `invalid type`}, // constant
+ {"complex", `var re float32; _ = complex(re, 1.0)`, `func(float32, float32) complex64`},
+ {"complex", `var im float64; _ = complex(1, im)`, `func(float64, float64) complex128`},
+ {"complex", `type F32 float32; var re, im F32; _ = complex(re, im)`, `func(p.F32, p.F32) complex64`},
+ {"complex", `type F64 float64; var re, im F64; _ = complex(re, im)`, `func(p.F64, p.F64) complex128`},
+
+ {"copy", `var src, dst []byte; copy(dst, src)`, `func([]byte, []byte) int`},
+ {"copy", `type T [][]int; var src, dst T; _ = copy(dst, src)`, `func(p.T, p.T) int`},
+ {"copy", `var src string; var dst []byte; copy(dst, src)`, `func([]byte, string) int`},
+ {"copy", `type T string; type U []byte; var src T; var dst U; copy(dst, src)`, `func(p.U, p.T) int`},
+ {"copy", `var dst []byte; copy(dst, "hello")`, `func([]byte, string) int`},
+
+ {"delete", `var m map[string]bool; delete(m, "foo")`, `func(map[string]bool, string)`},
+ {"delete", `type (K string; V int); var m map[K]V; delete(m, "foo")`, `func(map[p.K]p.V, p.K)`},
+
+ {"imag", `_ = imag(1i)`, `invalid type`}, // constant
+ {"imag", `var c complex64; _ = imag(c)`, `func(complex64) float32`},
+ {"imag", `var c complex128; _ = imag(c)`, `func(complex128) float64`},
+ {"imag", `type C64 complex64; var c C64; _ = imag(c)`, `func(p.C64) float32`},
+ {"imag", `type C128 complex128; var c C128; _ = imag(c)`, `func(p.C128) float64`},
+
+ {"real", `_ = real(1i)`, `invalid type`}, // constant
+ {"real", `var c complex64; _ = real(c)`, `func(complex64) float32`},
+ {"real", `var c complex128; _ = real(c)`, `func(complex128) float64`},
+ {"real", `type C64 complex64; var c C64; _ = real(c)`, `func(p.C64) float32`},
+ {"real", `type C128 complex128; var c C128; _ = real(c)`, `func(p.C128) float64`},
+
+ {"make", `_ = make([]int, 10)`, `func([]int, int) []int`},
+ {"make", `type T []byte; _ = make(T, 10, 20)`, `func(p.T, int, int) p.T`},
+
+ {"new", `_ = new(int)`, `func(int) *int`},
+ {"new", `type T struct{}; _ = new(T)`, `func(p.T) *p.T`},
+
+ {"panic", `panic(0)`, `func(interface{})`},
+ {"panic", `panic("foo")`, `func(interface{})`},
+
+ {"print", `print()`, `func()`},
+ {"print", `print(0)`, `func(int)`},
+ {"print", `print(1, 2.0, "foo", true)`, `func(int, float64, string, bool)`},
+
+ {"println", `println()`, `func()`},
+ {"println", `println(0)`, `func(int)`},
+ {"println", `println(1, 2.0, "foo", true)`, `func(int, float64, string, bool)`},
+
+ {"recover", `recover()`, `func() interface{}`},
+ {"recover", `_ = recover()`, `func() interface{}`},
+
+ {"Alignof", `_ = unsafe.Alignof(0)`, `invalid type`}, // constant
+ {"Alignof", `var x struct{}; _ = unsafe.Alignof(x)`, `invalid type`}, // constant
+
+ {"Offsetof", `var x struct{f bool}; _ = unsafe.Offsetof(x.f)`, `invalid type`}, // constant
+ {"Offsetof", `var x struct{_ int; f bool}; _ = unsafe.Offsetof((&x).f)`, `invalid type`}, // constant
+
+ {"Sizeof", `_ = unsafe.Sizeof(0)`, `invalid type`}, // constant
+ {"Sizeof", `var x struct{}; _ = unsafe.Sizeof(x)`, `invalid type`}, // constant
+
+ {"assert", `assert(true)`, `invalid type`}, // constant
+ {"assert", `type B bool; const pred B = 1 < 2; assert(pred)`, `invalid type`}, // constant
+
+ // no tests for trace since it produces output as a side-effect
+}
+
+func TestBuiltinSignatures(t *testing.T) {
+ DefPredeclaredTestFuncs()
+
+ seen := map[string]bool{"trace": true} // no test for trace built-in; add it manually
+ for _, call := range builtinCalls {
+ testBuiltinSignature(t, call.name, call.src, call.sig)
+ seen[call.name] = true
+ }
+
+ // make sure we didn't miss one
+ for _, name := range Universe.Names() {
+ if _, ok := Universe.Lookup(name).(*Builtin); ok && !seen[name] {
+ t.Errorf("missing test for %s", name)
+ }
+ }
+ for _, name := range Unsafe.Scope().Names() {
+ if _, ok := Unsafe.Scope().Lookup(name).(*Builtin); ok && !seen[name] {
+ t.Errorf("missing test for unsafe.%s", name)
+ }
+ }
+}
+
+func testBuiltinSignature(t *testing.T, name, src0, want string) {
+ src := fmt.Sprintf(`package p; import "unsafe"; type _ unsafe.Pointer /* use unsafe */; func _() { %s }`, src0)
+ f, err := parser.ParseFile(fset, "", src, 0)
+ if err != nil {
+ t.Errorf("%s: %s", src0, err)
+ return
+ }
+
+ var conf Config
+ uses := make(map[*ast.Ident]Object)
+ types := make(map[ast.Expr]TypeAndValue)
+ _, err = conf.Check(f.Name.Name, fset, []*ast.File{f}, &Info{Uses: uses, Types: types})
+ if err != nil {
+ t.Errorf("%s: %s", src0, err)
+ return
+ }
+
+ // find called function
+ n := 0
+ var fun ast.Expr
+ for x := range types {
+ if call, _ := x.(*ast.CallExpr); call != nil {
+ fun = call.Fun
+ n++
+ }
+ }
+ if n != 1 {
+ t.Errorf("%s: got %d CallExprs; want 1", src0, n)
+ return
+ }
+
+ // check recorded types for fun and descendents (may be parenthesized)
+ for {
+ // the recorded type for the built-in must match the wanted signature
+ typ := types[fun].Type
+ if typ == nil {
+ t.Errorf("%s: no type recorded for %s", src0, ExprString(fun))
+ return
+ }
+ if got := typ.String(); got != want {
+ t.Errorf("%s: got type %s; want %s", src0, got, want)
+ return
+ }
+
+ // called function must be a (possibly parenthesized, qualified)
+ // identifier denoting the expected built-in
+ switch p := fun.(type) {
+ case *ast.Ident:
+ obj := uses[p]
+ if obj == nil {
+ t.Errorf("%s: no object found for %s", src0, p)
+ return
+ }
+ bin, _ := obj.(*Builtin)
+ if bin == nil {
+ t.Errorf("%s: %s does not denote a built-in", src0, p)
+ return
+ }
+ if bin.Name() != name {
+ t.Errorf("%s: got built-in %s; want %s", src0, bin.Name(), name)
+ return
+ }
+ return // we're done
+
+ case *ast.ParenExpr:
+ fun = p.X // unpack
+
+ case *ast.SelectorExpr:
+ // built-in from package unsafe - ignore details
+ return // we're done
+
+ default:
+ t.Errorf("%s: invalid function call", src0)
+ return
+ }
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/call.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/call.go
new file mode 100644
index 0000000000..1e94212398
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/call.go
@@ -0,0 +1,441 @@
+// 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.
+
+// This file implements typechecking of call and selector expressions.
+
+package types
+
+import (
+ "go/ast"
+ "go/token"
+)
+
+func (check *Checker) call(x *operand, e *ast.CallExpr) exprKind {
+ check.exprOrType(x, e.Fun)
+
+ switch x.mode {
+ case invalid:
+ check.use(e.Args...)
+ x.mode = invalid
+ x.expr = e
+ return statement
+
+ case typexpr:
+ // conversion
+ T := x.typ
+ x.mode = invalid
+ switch n := len(e.Args); n {
+ case 0:
+ check.errorf(e.Rparen, "missing argument in conversion to %s", T)
+ case 1:
+ check.expr(x, e.Args[0])
+ if x.mode != invalid {
+ check.conversion(x, T)
+ }
+ default:
+ check.errorf(e.Args[n-1].Pos(), "too many arguments in conversion to %s", T)
+ }
+ x.expr = e
+ return conversion
+
+ case builtin:
+ id := x.id
+ if !check.builtin(x, e, id) {
+ x.mode = invalid
+ }
+ x.expr = e
+ // a non-constant result implies a function call
+ if x.mode != invalid && x.mode != constant {
+ check.hasCallOrRecv = true
+ }
+ return predeclaredFuncs[id].kind
+
+ default:
+ // function/method call
+ sig, _ := x.typ.Underlying().(*Signature)
+ if sig == nil {
+ check.invalidOp(x.pos(), "cannot call non-function %s", x)
+ x.mode = invalid
+ x.expr = e
+ return statement
+ }
+
+ arg, n, _ := unpack(func(x *operand, i int) { check.expr(x, e.Args[i]) }, len(e.Args), false)
+ if arg == nil {
+ x.mode = invalid
+ x.expr = e
+ return statement
+ }
+
+ check.arguments(x, e, sig, arg, n)
+
+ // determine result
+ switch sig.results.Len() {
+ case 0:
+ x.mode = novalue
+ case 1:
+ x.mode = value
+ x.typ = sig.results.vars[0].typ // unpack tuple
+ default:
+ x.mode = value
+ x.typ = sig.results
+ }
+ x.expr = e
+ check.hasCallOrRecv = true
+
+ return statement
+ }
+}
+
+// use type-checks each argument.
+// Useful to make sure expressions are evaluated
+// (and variables are "used") in the presence of other errors.
+func (check *Checker) use(arg ...ast.Expr) {
+ var x operand
+ for _, e := range arg {
+ check.rawExpr(&x, e, nil)
+ }
+}
+
+// useGetter is like use, but takes a getter instead of a list of expressions.
+// It should be called instead of use if a getter is present to avoid repeated
+// evaluation of the first argument (since the getter was likely obtained via
+// unpack, which may have evaluated the first argument already).
+func (check *Checker) useGetter(get getter, n int) {
+ var x operand
+ for i := 0; i < n; i++ {
+ get(&x, i)
+ }
+}
+
+// A getter sets x as the i'th operand, where 0 <= i < n and n is the total
+// number of operands (context-specific, and maintained elsewhere). A getter
+// type-checks the i'th operand; the details of the actual check are getter-
+// specific.
+type getter func(x *operand, i int)
+
+// unpack takes a getter get and a number of operands n. If n == 1, unpack
+// calls the incoming getter for the first operand. If that operand is
+// invalid, unpack returns (nil, 0, false). Otherwise, if that operand is a
+// function call, or a comma-ok expression and allowCommaOk is set, the result
+// is a new getter and operand count providing access to the function results,
+// or comma-ok values, respectively. The third result value reports if it
+// is indeed the comma-ok case. In all other cases, the incoming getter and
+// operand count are returned unchanged, and the third result value is false.
+//
+// In other words, if there's exactly one operand that - after type-checking
+// by calling get - stands for multiple operands, the resulting getter provides
+// access to those operands instead.
+//
+// If the returned getter is called at most once for a given operand index i
+// (including i == 0), that operand is guaranteed to cause only one call of
+// the incoming getter with that i.
+//
+func unpack(get getter, n int, allowCommaOk bool) (getter, int, bool) {
+ if n == 1 {
+ // possibly result of an n-valued function call or comma,ok value
+ var x0 operand
+ get(&x0, 0)
+ if x0.mode == invalid {
+ return nil, 0, false
+ }
+
+ if t, ok := x0.typ.(*Tuple); ok {
+ // result of an n-valued function call
+ return func(x *operand, i int) {
+ x.mode = value
+ x.expr = x0.expr
+ x.typ = t.At(i).typ
+ }, t.Len(), false
+ }
+
+ if x0.mode == mapindex || x0.mode == commaok {
+ // comma-ok value
+ if allowCommaOk {
+ a := [2]Type{x0.typ, Typ[UntypedBool]}
+ return func(x *operand, i int) {
+ x.mode = value
+ x.expr = x0.expr
+ x.typ = a[i]
+ }, 2, true
+ }
+ x0.mode = value
+ }
+
+ // single value
+ return func(x *operand, i int) {
+ if i != 0 {
+ unreachable()
+ }
+ *x = x0
+ }, 1, false
+ }
+
+ // zero or multiple values
+ return get, n, false
+}
+
+// arguments checks argument passing for the call with the given signature.
+// The arg function provides the operand for the i'th argument.
+func (check *Checker) arguments(x *operand, call *ast.CallExpr, sig *Signature, arg getter, n int) {
+ if call.Ellipsis.IsValid() {
+ // last argument is of the form x...
+ if len(call.Args) == 1 && n > 1 {
+ // f()... is not permitted if f() is multi-valued
+ check.errorf(call.Ellipsis, "cannot use ... with %d-valued expression %s", n, call.Args[0])
+ check.useGetter(arg, n)
+ return
+ }
+ if !sig.variadic {
+ check.errorf(call.Ellipsis, "cannot use ... in call to non-variadic %s", call.Fun)
+ check.useGetter(arg, n)
+ return
+ }
+ }
+
+ // evaluate arguments
+ for i := 0; i < n; i++ {
+ arg(x, i)
+ if x.mode != invalid {
+ var ellipsis token.Pos
+ if i == n-1 && call.Ellipsis.IsValid() {
+ ellipsis = call.Ellipsis
+ }
+ check.argument(sig, i, x, ellipsis)
+ }
+ }
+
+ // check argument count
+ if sig.variadic {
+ // a variadic function accepts an "empty"
+ // last argument: count one extra
+ n++
+ }
+ if n < sig.params.Len() {
+ check.errorf(call.Rparen, "too few arguments in call to %s", call.Fun)
+ // ok to continue
+ }
+}
+
+// argument checks passing of argument x to the i'th parameter of the given signature.
+// If ellipsis is valid, the argument is followed by ... at that position in the call.
+func (check *Checker) argument(sig *Signature, i int, x *operand, ellipsis token.Pos) {
+ n := sig.params.Len()
+
+ // determine parameter type
+ var typ Type
+ switch {
+ case i < n:
+ typ = sig.params.vars[i].typ
+ case sig.variadic:
+ typ = sig.params.vars[n-1].typ
+ if debug {
+ if _, ok := typ.(*Slice); !ok {
+ check.dump("%s: expected unnamed slice type, got %s", sig.params.vars[n-1].Pos(), typ)
+ }
+ }
+ default:
+ check.errorf(x.pos(), "too many arguments")
+ return
+ }
+
+ if ellipsis.IsValid() {
+ // argument is of the form x...
+ if i != n-1 {
+ check.errorf(ellipsis, "can only use ... with matching parameter")
+ return
+ }
+ switch t := x.typ.Underlying().(type) {
+ case *Slice:
+ // ok
+ case *Tuple:
+ check.errorf(ellipsis, "cannot use ... with %d-valued expression %s", t.Len(), x)
+ return
+ default:
+ check.errorf(x.pos(), "cannot use %s as parameter of type %s", x, typ)
+ return
+ }
+ } else if sig.variadic && i >= n-1 {
+ // use the variadic parameter slice's element type
+ typ = typ.(*Slice).elem
+ }
+
+ if !check.assignment(x, typ) && x.mode != invalid {
+ check.errorf(x.pos(), "cannot pass argument %s to parameter of type %s", x, typ)
+ }
+}
+
+func (check *Checker) selector(x *operand, e *ast.SelectorExpr) {
+ // these must be declared before the "goto Error" statements
+ var (
+ obj Object
+ index []int
+ indirect bool
+ )
+
+ sel := e.Sel.Name
+ // If the identifier refers to a package, handle everything here
+ // so we don't need a "package" mode for operands: package names
+ // can only appear in qualified identifiers which are mapped to
+ // selector expressions.
+ if ident, ok := e.X.(*ast.Ident); ok {
+ _, obj := check.scope.LookupParent(ident.Name, check.pos)
+ if pkg, _ := obj.(*PkgName); pkg != nil {
+ assert(pkg.pkg == check.pkg)
+ check.recordUse(ident, pkg)
+ pkg.used = true
+ exp := pkg.imported.scope.Lookup(sel)
+ if exp == nil {
+ if !pkg.imported.fake {
+ check.errorf(e.Pos(), "%s not declared by package %s", sel, ident)
+ }
+ goto Error
+ }
+ if !exp.Exported() {
+ check.errorf(e.Pos(), "%s not exported by package %s", sel, ident)
+ // ok to continue
+ }
+ check.recordUse(e.Sel, exp)
+ // Simplified version of the code for *ast.Idents:
+ // - imported objects are always fully initialized
+ switch exp := exp.(type) {
+ case *Const:
+ assert(exp.Val() != nil)
+ x.mode = constant
+ x.typ = exp.typ
+ x.val = exp.val
+ case *TypeName:
+ x.mode = typexpr
+ x.typ = exp.typ
+ case *Var:
+ x.mode = variable
+ x.typ = exp.typ
+ case *Func:
+ x.mode = value
+ x.typ = exp.typ
+ case *Builtin:
+ x.mode = builtin
+ x.typ = exp.typ
+ x.id = exp.id
+ default:
+ unreachable()
+ }
+ x.expr = e
+ return
+ }
+ }
+
+ check.exprOrType(x, e.X)
+ if x.mode == invalid {
+ goto Error
+ }
+
+ obj, index, indirect = LookupFieldOrMethod(x.typ, x.mode == variable, check.pkg, sel)
+ if obj == nil {
+ switch {
+ case index != nil:
+ // TODO(gri) should provide actual type where the conflict happens
+ check.invalidOp(e.Pos(), "ambiguous selector %s", sel)
+ case indirect:
+ check.invalidOp(e.Pos(), "%s is not in method set of %s", sel, x.typ)
+ default:
+ check.invalidOp(e.Pos(), "%s has no field or method %s", x, sel)
+ }
+ goto Error
+ }
+
+ if x.mode == typexpr {
+ // method expression
+ m, _ := obj.(*Func)
+ if m == nil {
+ check.invalidOp(e.Pos(), "%s has no method %s", x, sel)
+ goto Error
+ }
+
+ check.recordSelection(e, MethodExpr, x.typ, m, index, indirect)
+
+ // the receiver type becomes the type of the first function
+ // argument of the method expression's function type
+ var params []*Var
+ sig := m.typ.(*Signature)
+ if sig.params != nil {
+ params = sig.params.vars
+ }
+ x.mode = value
+ x.typ = &Signature{
+ params: NewTuple(append([]*Var{NewVar(token.NoPos, check.pkg, "", x.typ)}, params...)...),
+ results: sig.results,
+ variadic: sig.variadic,
+ }
+
+ check.addDeclDep(m)
+
+ } else {
+ // regular selector
+ switch obj := obj.(type) {
+ case *Var:
+ check.recordSelection(e, FieldVal, x.typ, obj, index, indirect)
+ if x.mode == variable || indirect {
+ x.mode = variable
+ } else {
+ x.mode = value
+ }
+ x.typ = obj.typ
+
+ case *Func:
+ // TODO(gri) If we needed to take into account the receiver's
+ // addressability, should we report the type &(x.typ) instead?
+ check.recordSelection(e, MethodVal, x.typ, obj, index, indirect)
+
+ if debug {
+ // Verify that LookupFieldOrMethod and MethodSet.Lookup agree.
+ typ := x.typ
+ if x.mode == variable {
+ // If typ is not an (unnamed) pointer or an interface,
+ // use *typ instead, because the method set of *typ
+ // includes the methods of typ.
+ // Variables are addressable, so we can always take their
+ // address.
+ if _, ok := typ.(*Pointer); !ok && !IsInterface(typ) {
+ typ = &Pointer{base: typ}
+ }
+ }
+ // If we created a synthetic pointer type above, we will throw
+ // away the method set computed here after use.
+ // TODO(gri) Method set computation should probably always compute
+ // both, the value and the pointer receiver method set and represent
+ // them in a single structure.
+ // TODO(gri) Consider also using a method set cache for the lifetime
+ // of checker once we rely on MethodSet lookup instead of individual
+ // lookup.
+ mset := NewMethodSet(typ)
+ if m := mset.Lookup(check.pkg, sel); m == nil || m.obj != obj {
+ check.dump("%s: (%s).%v -> %s", e.Pos(), typ, obj.name, m)
+ check.dump("%s\n", mset)
+ panic("method sets and lookup don't agree")
+ }
+ }
+
+ x.mode = value
+
+ // remove receiver
+ sig := *obj.typ.(*Signature)
+ sig.recv = nil
+ x.typ = &sig
+
+ check.addDeclDep(obj)
+
+ default:
+ unreachable()
+ }
+ }
+
+ // everything went well
+ x.expr = e
+ return
+
+Error:
+ x.mode = invalid
+ x.expr = e
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/check.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/check.go
new file mode 100644
index 0000000000..964d2bde03
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/check.go
@@ -0,0 +1,364 @@
+// Copyright 2011 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.
+
+// This file implements the Check function, which drives type-checking.
+
+package types
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/go/exact"
+)
+
+// debugging/development support
+const (
+ debug = false // leave on during development
+ trace = false // turn on for detailed type resolution traces
+)
+
+// If Strict is set, the type-checker enforces additional
+// rules not specified by the Go 1 spec, but which will
+// catch guaranteed run-time errors if the respective
+// code is executed. In other words, programs passing in
+// Strict mode are Go 1 compliant, but not all Go 1 programs
+// will pass in Strict mode. The additional rules are:
+//
+// - A type assertion x.(T) where T is an interface type
+// is invalid if any (statically known) method that exists
+// for both x and T have different signatures.
+//
+const strict = false
+
+// exprInfo stores information about an untyped expression.
+type exprInfo struct {
+ isLhs bool // expression is lhs operand of a shift with delayed type-check
+ mode operandMode
+ typ *Basic
+ val exact.Value // constant value; or nil (if not a constant)
+}
+
+// funcInfo stores the information required for type-checking a function.
+type funcInfo struct {
+ name string // for debugging/tracing only
+ decl *declInfo // for cycle detection
+ sig *Signature
+ body *ast.BlockStmt
+}
+
+// A context represents the context within which an object is type-checked.
+type context struct {
+ decl *declInfo // package-level declaration whose init expression/function body is checked
+ scope *Scope // top-most scope for lookups
+ iota exact.Value // value of iota in a constant declaration; nil otherwise
+ sig *Signature // function signature if inside a function; nil otherwise
+ hasLabel bool // set if a function makes use of labels (only ~1% of functions); unused outside functions
+ hasCallOrRecv bool // set if an expression contains a function call or channel receive operation
+}
+
+// A Checker maintains the state of the type checker.
+// It must be created with NewChecker.
+type Checker struct {
+ // package information
+ // (initialized by NewChecker, valid for the life-time of checker)
+ conf *Config
+ fset *token.FileSet
+ pkg *Package
+ *Info
+ objMap map[Object]*declInfo // maps package-level object to declaration info
+
+ // information collected during type-checking of a set of package files
+ // (initialized by Files, valid only for the duration of check.Files;
+ // maps and lists are allocated on demand)
+ files []*ast.File // package files
+ unusedDotImports map[*Scope]map[*Package]token.Pos // positions of unused dot-imported packages for each file scope
+
+ firstErr error // first error encountered
+ methods map[string][]*Func // maps type names to associated methods
+ untyped map[ast.Expr]exprInfo // map of expressions without final type
+ funcs []funcInfo // list of functions to type-check
+ delayed []func() // delayed checks requiring fully setup types
+
+ // context within which the current object is type-checked
+ // (valid only for the duration of type-checking a specific object)
+ context
+ pos token.Pos // if valid, identifiers are looked up as if at position pos (used by Eval)
+
+ // debugging
+ indent int // indentation for tracing
+}
+
+// addUnusedImport adds the position of a dot-imported package
+// pkg to the map of dot imports for the given file scope.
+func (check *Checker) addUnusedDotImport(scope *Scope, pkg *Package, pos token.Pos) {
+ mm := check.unusedDotImports
+ if mm == nil {
+ mm = make(map[*Scope]map[*Package]token.Pos)
+ check.unusedDotImports = mm
+ }
+ m := mm[scope]
+ if m == nil {
+ m = make(map[*Package]token.Pos)
+ mm[scope] = m
+ }
+ m[pkg] = pos
+}
+
+// addDeclDep adds the dependency edge (check.decl -> to) if check.decl exists
+func (check *Checker) addDeclDep(to Object) {
+ from := check.decl
+ if from == nil {
+ return // not in a package-level init expression
+ }
+ if _, found := check.objMap[to]; !found {
+ return // to is not a package-level object
+ }
+ from.addDep(to)
+}
+
+func (check *Checker) assocMethod(tname string, meth *Func) {
+ m := check.methods
+ if m == nil {
+ m = make(map[string][]*Func)
+ check.methods = m
+ }
+ m[tname] = append(m[tname], meth)
+}
+
+func (check *Checker) rememberUntyped(e ast.Expr, lhs bool, mode operandMode, typ *Basic, val exact.Value) {
+ m := check.untyped
+ if m == nil {
+ m = make(map[ast.Expr]exprInfo)
+ check.untyped = m
+ }
+ m[e] = exprInfo{lhs, mode, typ, val}
+}
+
+func (check *Checker) later(name string, decl *declInfo, sig *Signature, body *ast.BlockStmt) {
+ check.funcs = append(check.funcs, funcInfo{name, decl, sig, body})
+}
+
+func (check *Checker) delay(f func()) {
+ check.delayed = append(check.delayed, f)
+}
+
+// NewChecker returns a new Checker instance for a given package.
+// Package files may be added incrementally via checker.Files.
+func NewChecker(conf *Config, fset *token.FileSet, pkg *Package, info *Info) *Checker {
+ // make sure we have a configuration
+ if conf == nil {
+ conf = new(Config)
+ }
+
+ // make sure we have a package canonicalization map
+ if conf.Packages == nil {
+ conf.Packages = make(map[string]*Package)
+ }
+
+ // make sure we have an info struct
+ if info == nil {
+ info = new(Info)
+ }
+
+ return &Checker{
+ conf: conf,
+ fset: fset,
+ pkg: pkg,
+ Info: info,
+ objMap: make(map[Object]*declInfo),
+ }
+}
+
+// initFiles initializes the files-specific portion of checker.
+// The provided files must all belong to the same package.
+func (check *Checker) initFiles(files []*ast.File) {
+ // start with a clean slate (check.Files may be called multiple times)
+ check.files = nil
+ check.unusedDotImports = nil
+
+ check.firstErr = nil
+ check.methods = nil
+ check.untyped = nil
+ check.funcs = nil
+ check.delayed = nil
+
+ // determine package name and collect valid files
+ pkg := check.pkg
+ for _, file := range files {
+ switch name := file.Name.Name; pkg.name {
+ case "":
+ if name != "_" {
+ pkg.name = name
+ } else {
+ check.errorf(file.Name.Pos(), "invalid package name _")
+ }
+ fallthrough
+
+ case name:
+ check.files = append(check.files, file)
+
+ default:
+ check.errorf(file.Package, "package %s; expected %s", name, pkg.name)
+ // ignore this file
+ }
+ }
+}
+
+// A bailout panic is used for early termination.
+type bailout struct{}
+
+func (check *Checker) handleBailout(err *error) {
+ switch p := recover().(type) {
+ case nil, bailout:
+ // normal return or early exit
+ *err = check.firstErr
+ default:
+ // re-panic
+ panic(p)
+ }
+}
+
+// Files checks the provided files as part of the checker's package.
+func (check *Checker) Files(files []*ast.File) (err error) {
+ defer check.handleBailout(&err)
+
+ check.initFiles(files)
+
+ check.collectObjects()
+
+ check.packageObjects(check.resolveOrder())
+
+ check.functionBodies()
+
+ check.initOrder()
+
+ if !check.conf.DisableUnusedImportCheck {
+ check.unusedImports()
+ }
+
+ // perform delayed checks
+ for _, f := range check.delayed {
+ f()
+ }
+
+ check.recordUntyped()
+
+ check.pkg.complete = true
+ return
+}
+
+func (check *Checker) recordUntyped() {
+ if !debug && check.Types == nil {
+ return // nothing to do
+ }
+
+ for x, info := range check.untyped {
+ if debug && isTyped(info.typ) {
+ check.dump("%s: %s (type %s) is typed", x.Pos(), x, info.typ)
+ unreachable()
+ }
+ check.recordTypeAndValue(x, info.mode, info.typ, info.val)
+ }
+}
+
+func (check *Checker) recordTypeAndValue(x ast.Expr, mode operandMode, typ Type, val exact.Value) {
+ assert(x != nil)
+ assert(typ != nil)
+ if mode == invalid {
+ return // omit
+ }
+ assert(typ != nil)
+ if mode == constant {
+ assert(val != nil)
+ assert(typ == Typ[Invalid] || isConstType(typ))
+ }
+ if m := check.Types; m != nil {
+ m[x] = TypeAndValue{mode, typ, val}
+ }
+}
+
+func (check *Checker) recordBuiltinType(f ast.Expr, sig *Signature) {
+ // f must be a (possibly parenthesized) identifier denoting a built-in
+ // (built-ins in package unsafe always produce a constant result and
+ // we don't record their signatures, so we don't see qualified idents
+ // here): record the signature for f and possible children.
+ for {
+ check.recordTypeAndValue(f, builtin, sig, nil)
+ switch p := f.(type) {
+ case *ast.Ident:
+ return // we're done
+ case *ast.ParenExpr:
+ f = p.X
+ default:
+ unreachable()
+ }
+ }
+}
+
+func (check *Checker) recordCommaOkTypes(x ast.Expr, a [2]Type) {
+ assert(x != nil)
+ if a[0] == nil || a[1] == nil {
+ return
+ }
+ assert(isTyped(a[0]) && isTyped(a[1]) && isBoolean(a[1]))
+ if m := check.Types; m != nil {
+ for {
+ tv := m[x]
+ assert(tv.Type != nil) // should have been recorded already
+ pos := x.Pos()
+ tv.Type = NewTuple(
+ NewVar(pos, check.pkg, "", a[0]),
+ NewVar(pos, check.pkg, "", a[1]),
+ )
+ m[x] = tv
+ // if x is a parenthesized expression (p.X), update p.X
+ p, _ := x.(*ast.ParenExpr)
+ if p == nil {
+ break
+ }
+ x = p.X
+ }
+ }
+}
+
+func (check *Checker) recordDef(id *ast.Ident, obj Object) {
+ assert(id != nil)
+ if m := check.Defs; m != nil {
+ m[id] = obj
+ }
+}
+
+func (check *Checker) recordUse(id *ast.Ident, obj Object) {
+ assert(id != nil)
+ assert(obj != nil)
+ if m := check.Uses; m != nil {
+ m[id] = obj
+ }
+}
+
+func (check *Checker) recordImplicit(node ast.Node, obj Object) {
+ assert(node != nil)
+ assert(obj != nil)
+ if m := check.Implicits; m != nil {
+ m[node] = obj
+ }
+}
+
+func (check *Checker) recordSelection(x *ast.SelectorExpr, kind SelectionKind, recv Type, obj Object, index []int, indirect bool) {
+ assert(obj != nil && (recv == nil || len(index) > 0))
+ check.recordUse(x.Sel, obj)
+ // TODO(gri) Should we also call recordTypeAndValue?
+ if m := check.Selections; m != nil {
+ m[x] = &Selection{kind, recv, obj, index, indirect}
+ }
+}
+
+func (check *Checker) recordScope(node ast.Node, scope *Scope) {
+ assert(node != nil)
+ assert(scope != nil)
+ if m := check.Scopes; m != nil {
+ m[node] = scope
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/check_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/check_test.go
new file mode 100644
index 0000000000..b6caccb34a
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/check_test.go
@@ -0,0 +1,296 @@
+// Copyright 2011 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.
+
+// This file implements a typechecker test harness. The packages specified
+// in tests are typechecked. Error messages reported by the typechecker are
+// compared against the error messages expected in the test files.
+//
+// Expected errors are indicated in the test files by putting a comment
+// of the form /* ERROR "rx" */ immediately following an offending token.
+// The harness will verify that an error matching the regular expression
+// rx is reported at that source position. Consecutive comments may be
+// used to indicate multiple errors for the same token position.
+//
+// For instance, the following test file indicates that a "not declared"
+// error should be reported for the undeclared variable x:
+//
+// package p
+// func f() {
+// _ = x /* ERROR "not declared" */ + 1
+// }
+
+// TODO(gri) Also collect strict mode errors of the form /* STRICT ... */
+// and test against strict mode.
+
+package types_test
+
+import (
+ "flag"
+ "go/ast"
+ "go/parser"
+ "go/scanner"
+ "go/token"
+ "io/ioutil"
+ "regexp"
+ "strings"
+ "testing"
+
+ _ "golang.org/x/tools/go/gcimporter"
+ . "golang.org/x/tools/go/types"
+)
+
+var (
+ listErrors = flag.Bool("list", false, "list errors")
+ testFiles = flag.String("files", "", "space-separated list of test files")
+)
+
+// The test filenames do not end in .go so that they are invisible
+// to gofmt since they contain comments that must not change their
+// positions relative to surrounding tokens.
+
+// Each tests entry is list of files belonging to the same package.
+var tests = [][]string{
+ {"testdata/errors.src"},
+ {"testdata/importdecl0a.src", "testdata/importdecl0b.src"},
+ {"testdata/importdecl1a.src", "testdata/importdecl1b.src"},
+ {"testdata/cycles.src"},
+ {"testdata/cycles1.src"},
+ {"testdata/cycles2.src"},
+ {"testdata/cycles3.src"},
+ {"testdata/cycles4.src"},
+ {"testdata/init0.src"},
+ {"testdata/init1.src"},
+ {"testdata/init2.src"},
+ {"testdata/decls0.src"},
+ {"testdata/decls1.src"},
+ {"testdata/decls2a.src", "testdata/decls2b.src"},
+ {"testdata/decls3.src"},
+ {"testdata/const0.src"},
+ {"testdata/const1.src"},
+ {"testdata/constdecl.src"},
+ {"testdata/vardecl.src"},
+ {"testdata/expr0.src"},
+ {"testdata/expr1.src"},
+ {"testdata/expr2.src"},
+ {"testdata/expr3.src"},
+ {"testdata/methodsets.src"},
+ {"testdata/shifts.src"},
+ {"testdata/builtins.src"},
+ {"testdata/conversions.src"},
+ {"testdata/stmt0.src"},
+ {"testdata/stmt1.src"},
+ {"testdata/gotos.src"},
+ {"testdata/labels.src"},
+ {"testdata/issues.src"},
+ {"testdata/blank.src"},
+}
+
+var fset = token.NewFileSet()
+
+// Positioned errors are of the form filename:line:column: message .
+var posMsgRx = regexp.MustCompile(`^(.*:[0-9]+:[0-9]+): *(.*)`)
+
+// splitError splits an error's error message into a position string
+// and the actual error message. If there's no position information,
+// pos is the empty string, and msg is the entire error message.
+//
+func splitError(err error) (pos, msg string) {
+ msg = err.Error()
+ if m := posMsgRx.FindStringSubmatch(msg); len(m) == 3 {
+ pos = m[1]
+ msg = m[2]
+ }
+ return
+}
+
+func parseFiles(t *testing.T, filenames []string) ([]*ast.File, []error) {
+ var files []*ast.File
+ var errlist []error
+ for _, filename := range filenames {
+ file, err := parser.ParseFile(fset, filename, nil, parser.AllErrors)
+ if file == nil {
+ t.Fatalf("%s: %s", filename, err)
+ }
+ files = append(files, file)
+ if err != nil {
+ if list, _ := err.(scanner.ErrorList); len(list) > 0 {
+ for _, err := range list {
+ errlist = append(errlist, err)
+ }
+ } else {
+ errlist = append(errlist, err)
+ }
+ }
+ }
+ return files, errlist
+}
+
+// ERROR comments must start with text `ERROR "rx"` or `ERROR rx` where
+// rx is a regular expression that matches the expected error message.
+// Space around "rx" or rx is ignored. Use the form `ERROR HERE "rx"`
+// for error messages that are located immediately after rather than
+// at a token's position.
+//
+var errRx = regexp.MustCompile(`^ *ERROR *(HERE)? *"?([^"]*)"?`)
+
+// errMap collects the regular expressions of ERROR comments found
+// in files and returns them as a map of error positions to error messages.
+//
+func errMap(t *testing.T, testname string, files []*ast.File) map[string][]string {
+ // map of position strings to lists of error message patterns
+ errmap := make(map[string][]string)
+
+ for _, file := range files {
+ filename := fset.Position(file.Package).Filename
+ src, err := ioutil.ReadFile(filename)
+ if err != nil {
+ t.Fatalf("%s: could not read %s", testname, filename)
+ }
+
+ var s scanner.Scanner
+ s.Init(fset.AddFile(filename, -1, len(src)), src, nil, scanner.ScanComments)
+ var prev token.Pos // position of last non-comment, non-semicolon token
+ var here token.Pos // position immediately after the token at position prev
+
+ scanFile:
+ for {
+ pos, tok, lit := s.Scan()
+ switch tok {
+ case token.EOF:
+ break scanFile
+ case token.COMMENT:
+ if lit[1] == '*' {
+ lit = lit[:len(lit)-2] // strip trailing */
+ }
+ if s := errRx.FindStringSubmatch(lit[2:]); len(s) == 3 {
+ pos := prev
+ if s[1] == "HERE" {
+ pos = here
+ }
+ p := fset.Position(pos).String()
+ errmap[p] = append(errmap[p], strings.TrimSpace(s[2]))
+ }
+ case token.SEMICOLON:
+ // ignore automatically inserted semicolon
+ if lit == "\n" {
+ continue scanFile
+ }
+ fallthrough
+ default:
+ prev = pos
+ var l int // token length
+ if tok.IsLiteral() {
+ l = len(lit)
+ } else {
+ l = len(tok.String())
+ }
+ here = prev + token.Pos(l)
+ }
+ }
+ }
+
+ return errmap
+}
+
+func eliminate(t *testing.T, errmap map[string][]string, errlist []error) {
+ for _, err := range errlist {
+ pos, gotMsg := splitError(err)
+ list := errmap[pos]
+ index := -1 // list index of matching message, if any
+ // we expect one of the messages in list to match the error at pos
+ for i, wantRx := range list {
+ rx, err := regexp.Compile(wantRx)
+ if err != nil {
+ t.Errorf("%s: %v", pos, err)
+ continue
+ }
+ if rx.MatchString(gotMsg) {
+ index = i
+ break
+ }
+ }
+ if index >= 0 {
+ // eliminate from list
+ if n := len(list) - 1; n > 0 {
+ // not the last entry - swap in last element and shorten list by 1
+ list[index] = list[n]
+ errmap[pos] = list[:n]
+ } else {
+ // last entry - remove list from map
+ delete(errmap, pos)
+ }
+ } else {
+ t.Errorf("%s: no error expected: %q", pos, gotMsg)
+ }
+ }
+}
+
+func checkFiles(t *testing.T, testfiles []string) {
+ // parse files and collect parser errors
+ files, errlist := parseFiles(t, testfiles)
+
+ pkgName := ""
+ if len(files) > 0 {
+ pkgName = files[0].Name.Name
+ }
+
+ if *listErrors && len(errlist) > 0 {
+ t.Errorf("--- %s:", pkgName)
+ for _, err := range errlist {
+ t.Error(err)
+ }
+ }
+
+ // typecheck and collect typechecker errors
+ var conf Config
+ conf.Error = func(err error) {
+ if *listErrors {
+ t.Error(err)
+ return
+ }
+ // Ignore secondary error messages starting with "\t";
+ // they are clarifying messages for a primary error.
+ if !strings.Contains(err.Error(), ": \t") {
+ errlist = append(errlist, err)
+ }
+ }
+ conf.Check(pkgName, fset, files, nil)
+
+ if *listErrors {
+ return
+ }
+
+ // match and eliminate errors;
+ // we are expecting the following errors
+ errmap := errMap(t, pkgName, files)
+ eliminate(t, errmap, errlist)
+
+ // there should be no expected errors left
+ if len(errmap) > 0 {
+ t.Errorf("--- %s: %d source positions with expected (but not reported) errors:", pkgName, len(errmap))
+ for pos, list := range errmap {
+ for _, rx := range list {
+ t.Errorf("%s: %q", pos, rx)
+ }
+ }
+ }
+}
+
+func TestCheck(t *testing.T) {
+ skipSpecialPlatforms(t)
+
+ // Declare builtins for testing.
+ DefPredeclaredTestFuncs()
+
+ // If explicit test files are specified, only check those.
+ if files := *testFiles; files != "" {
+ checkFiles(t, strings.Split(files, " "))
+ return
+ }
+
+ // Otherwise, run all the tests.
+ for _, files := range tests {
+ checkFiles(t, files)
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/conversions.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/conversions.go
new file mode 100644
index 0000000000..6e279ca3ee
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/conversions.go
@@ -0,0 +1,146 @@
+// Copyright 2012 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.
+
+// This file implements typechecking of conversions.
+
+package types
+
+import "golang.org/x/tools/go/exact"
+
+// Conversion type-checks the conversion T(x).
+// The result is in x.
+func (check *Checker) conversion(x *operand, T Type) {
+ constArg := x.mode == constant
+
+ var ok bool
+ switch {
+ case constArg && isConstType(T):
+ // constant conversion
+ switch t := T.Underlying().(*Basic); {
+ case representableConst(x.val, check.conf, t.kind, &x.val):
+ ok = true
+ case isInteger(x.typ) && isString(t):
+ codepoint := int64(-1)
+ if i, ok := exact.Int64Val(x.val); ok {
+ codepoint = i
+ }
+ // If codepoint < 0 the absolute value is too large (or unknown) for
+ // conversion. This is the same as converting any other out-of-range
+ // value - let string(codepoint) do the work.
+ x.val = exact.MakeString(string(codepoint))
+ ok = true
+ }
+ case x.convertibleTo(check.conf, T):
+ // non-constant conversion
+ x.mode = value
+ ok = true
+ }
+
+ if !ok {
+ check.errorf(x.pos(), "cannot convert %s to %s", x, T)
+ x.mode = invalid
+ return
+ }
+
+ // The conversion argument types are final. For untyped values the
+ // conversion provides the type, per the spec: "A constant may be
+ // given a type explicitly by a constant declaration or conversion,...".
+ final := x.typ
+ if isUntyped(x.typ) {
+ final = T
+ // - For conversions to interfaces, use the argument's default type.
+ // - For conversions of untyped constants to non-constant types, also
+ // use the default type (e.g., []byte("foo") should report string
+ // not []byte as type for the constant "foo").
+ // - Keep untyped nil for untyped nil arguments.
+ if IsInterface(T) || constArg && !isConstType(T) {
+ final = defaultType(x.typ)
+ }
+ check.updateExprType(x.expr, final, true)
+ }
+
+ x.typ = T
+}
+
+func (x *operand) convertibleTo(conf *Config, T Type) bool {
+ // "x is assignable to T"
+ if x.assignableTo(conf, T) {
+ return true
+ }
+
+ // "x's type and T have identical underlying types"
+ V := x.typ
+ Vu := V.Underlying()
+ Tu := T.Underlying()
+ if Identical(Vu, Tu) {
+ return true
+ }
+
+ // "x's type and T are unnamed pointer types and their pointer base types have identical underlying types"
+ if V, ok := V.(*Pointer); ok {
+ if T, ok := T.(*Pointer); ok {
+ if Identical(V.base.Underlying(), T.base.Underlying()) {
+ return true
+ }
+ }
+ }
+
+ // "x's type and T are both integer or floating point types"
+ if (isInteger(V) || isFloat(V)) && (isInteger(T) || isFloat(T)) {
+ return true
+ }
+
+ // "x's type and T are both complex types"
+ if isComplex(V) && isComplex(T) {
+ return true
+ }
+
+ // "x is an integer or a slice of bytes or runes and T is a string type"
+ if (isInteger(V) || isBytesOrRunes(Vu)) && isString(T) {
+ return true
+ }
+
+ // "x is a string and T is a slice of bytes or runes"
+ if isString(V) && isBytesOrRunes(Tu) {
+ return true
+ }
+
+ // package unsafe:
+ // "any pointer or value of underlying type uintptr can be converted into a unsafe.Pointer"
+ if (isPointer(Vu) || isUintptr(Vu)) && isUnsafePointer(T) {
+ return true
+ }
+ // "and vice versa"
+ if isUnsafePointer(V) && (isPointer(Tu) || isUintptr(Tu)) {
+ return true
+ }
+
+ return false
+}
+
+func isUintptr(typ Type) bool {
+ t, ok := typ.Underlying().(*Basic)
+ return ok && t.kind == Uintptr
+}
+
+func isUnsafePointer(typ Type) bool {
+ // TODO(gri): Is this (typ.Underlying() instead of just typ) correct?
+ // The spec does not say so, but gc claims it is. See also
+ // issue 6326.
+ t, ok := typ.Underlying().(*Basic)
+ return ok && t.kind == UnsafePointer
+}
+
+func isPointer(typ Type) bool {
+ _, ok := typ.Underlying().(*Pointer)
+ return ok
+}
+
+func isBytesOrRunes(typ Type) bool {
+ if s, ok := typ.(*Slice); ok {
+ t, ok := s.elem.Underlying().(*Basic)
+ return ok && (t.kind == Byte || t.kind == Rune)
+ }
+ return false
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/decl.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/decl.go
new file mode 100644
index 0000000000..9eba85c1c3
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/decl.go
@@ -0,0 +1,431 @@
+// Copyright 2014 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.
+
+package types
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/go/exact"
+)
+
+func (check *Checker) reportAltDecl(obj Object) {
+ if pos := obj.Pos(); pos.IsValid() {
+ // We use "other" rather than "previous" here because
+ // the first declaration seen may not be textually
+ // earlier in the source.
+ check.errorf(pos, "\tother declaration of %s", obj.Name()) // secondary error, \t indented
+ }
+}
+
+func (check *Checker) declare(scope *Scope, id *ast.Ident, obj Object, pos token.Pos) {
+ // spec: "The blank identifier, represented by the underscore
+ // character _, may be used in a declaration like any other
+ // identifier but the declaration does not introduce a new
+ // binding."
+ if obj.Name() != "_" {
+ if alt := scope.Insert(obj); alt != nil {
+ check.errorf(obj.Pos(), "%s redeclared in this block", obj.Name())
+ check.reportAltDecl(alt)
+ return
+ }
+ obj.setScopePos(pos)
+ }
+ if id != nil {
+ check.recordDef(id, obj)
+ }
+}
+
+// objDecl type-checks the declaration of obj in its respective (file) context.
+// See check.typ for the details on def and path.
+func (check *Checker) objDecl(obj Object, def *Named, path []*TypeName) {
+ if obj.Type() != nil {
+ return // already checked - nothing to do
+ }
+
+ if trace {
+ check.trace(obj.Pos(), "-- declaring %s", obj.Name())
+ check.indent++
+ defer func() {
+ check.indent--
+ check.trace(obj.Pos(), "=> %s", obj)
+ }()
+ }
+
+ d := check.objMap[obj]
+ if d == nil {
+ check.dump("%s: %s should have been declared", obj.Pos(), obj.Name())
+ unreachable()
+ }
+
+ // save/restore current context and setup object context
+ defer func(ctxt context) {
+ check.context = ctxt
+ }(check.context)
+ check.context = context{
+ scope: d.file,
+ }
+
+ // Const and var declarations must not have initialization
+ // cycles. We track them by remembering the current declaration
+ // in check.decl. Initialization expressions depending on other
+ // consts, vars, or functions, add dependencies to the current
+ // check.decl.
+ switch obj := obj.(type) {
+ case *Const:
+ check.decl = d // new package-level const decl
+ check.constDecl(obj, d.typ, d.init)
+ case *Var:
+ check.decl = d // new package-level var decl
+ check.varDecl(obj, d.lhs, d.typ, d.init)
+ case *TypeName:
+ // invalid recursive types are detected via path
+ check.typeDecl(obj, d.typ, def, path)
+ case *Func:
+ // functions may be recursive - no need to track dependencies
+ check.funcDecl(obj, d)
+ default:
+ unreachable()
+ }
+}
+
+func (check *Checker) constDecl(obj *Const, typ, init ast.Expr) {
+ assert(obj.typ == nil)
+
+ if obj.visited {
+ obj.typ = Typ[Invalid]
+ return
+ }
+ obj.visited = true
+
+ // use the correct value of iota
+ assert(check.iota == nil)
+ check.iota = obj.val
+ defer func() { check.iota = nil }()
+
+ // provide valid constant value under all circumstances
+ obj.val = exact.MakeUnknown()
+
+ // determine type, if any
+ if typ != nil {
+ t := check.typ(typ)
+ if !isConstType(t) {
+ check.errorf(typ.Pos(), "invalid constant type %s", t)
+ obj.typ = Typ[Invalid]
+ return
+ }
+ obj.typ = t
+ }
+
+ // check initialization
+ var x operand
+ if init != nil {
+ check.expr(&x, init)
+ }
+ check.initConst(obj, &x)
+}
+
+func (check *Checker) varDecl(obj *Var, lhs []*Var, typ, init ast.Expr) {
+ assert(obj.typ == nil)
+
+ if obj.visited {
+ obj.typ = Typ[Invalid]
+ return
+ }
+ obj.visited = true
+
+ // var declarations cannot use iota
+ assert(check.iota == nil)
+
+ // determine type, if any
+ if typ != nil {
+ obj.typ = check.typ(typ)
+ }
+
+ // check initialization
+ if init == nil {
+ if typ == nil {
+ // error reported before by arityMatch
+ obj.typ = Typ[Invalid]
+ }
+ return
+ }
+
+ if lhs == nil || len(lhs) == 1 {
+ assert(lhs == nil || lhs[0] == obj)
+ var x operand
+ check.expr(&x, init)
+ check.initVar(obj, &x, false)
+ return
+ }
+
+ if debug {
+ // obj must be one of lhs
+ found := false
+ for _, lhs := range lhs {
+ if obj == lhs {
+ found = true
+ break
+ }
+ }
+ if !found {
+ panic("inconsistent lhs")
+ }
+ }
+ check.initVars(lhs, []ast.Expr{init}, token.NoPos)
+}
+
+// underlying returns the underlying type of typ; possibly by following
+// forward chains of named types. Such chains only exist while named types
+// are incomplete.
+func underlying(typ Type) Type {
+ for {
+ n, _ := typ.(*Named)
+ if n == nil {
+ break
+ }
+ typ = n.underlying
+ }
+ return typ
+}
+
+func (n *Named) setUnderlying(typ Type) {
+ if n != nil {
+ n.underlying = typ
+ }
+}
+
+func (check *Checker) typeDecl(obj *TypeName, typ ast.Expr, def *Named, path []*TypeName) {
+ assert(obj.typ == nil)
+
+ // type declarations cannot use iota
+ assert(check.iota == nil)
+
+ named := &Named{obj: obj}
+ def.setUnderlying(named)
+ obj.typ = named // make sure recursive type declarations terminate
+
+ // determine underlying type of named
+ check.typExpr(typ, named, append(path, obj))
+
+ // The underlying type of named may be itself a named type that is
+ // incomplete:
+ //
+ // type (
+ // A B
+ // B *C
+ // C A
+ // )
+ //
+ // The type of C is the (named) type of A which is incomplete,
+ // and which has as its underlying type the named type B.
+ // Determine the (final, unnamed) underlying type by resolving
+ // any forward chain (they always end in an unnamed type).
+ named.underlying = underlying(named.underlying)
+
+ // check and add associated methods
+ // TODO(gri) It's easy to create pathological cases where the
+ // current approach is incorrect: In general we need to know
+ // and add all methods _before_ type-checking the type.
+ // See http://play.golang.org/p/WMpE0q2wK8
+ check.addMethodDecls(obj)
+}
+
+func (check *Checker) addMethodDecls(obj *TypeName) {
+ // get associated methods
+ methods := check.methods[obj.name]
+ if len(methods) == 0 {
+ return // no methods
+ }
+ delete(check.methods, obj.name)
+
+ // use an objset to check for name conflicts
+ var mset objset
+
+ // spec: "If the base type is a struct type, the non-blank method
+ // and field names must be distinct."
+ base := obj.typ.(*Named)
+ if t, _ := base.underlying.(*Struct); t != nil {
+ for _, fld := range t.fields {
+ if fld.name != "_" {
+ assert(mset.insert(fld) == nil)
+ }
+ }
+ }
+
+ // Checker.Files may be called multiple times; additional package files
+ // may add methods to already type-checked types. Add pre-existing methods
+ // so that we can detect redeclarations.
+ for _, m := range base.methods {
+ assert(m.name != "_")
+ assert(mset.insert(m) == nil)
+ }
+
+ // type-check methods
+ for _, m := range methods {
+ // spec: "For a base type, the non-blank names of methods bound
+ // to it must be unique."
+ if m.name != "_" {
+ if alt := mset.insert(m); alt != nil {
+ switch alt.(type) {
+ case *Var:
+ check.errorf(m.pos, "field and method with the same name %s", m.name)
+ case *Func:
+ check.errorf(m.pos, "method %s already declared for %s", m.name, base)
+ default:
+ unreachable()
+ }
+ check.reportAltDecl(alt)
+ continue
+ }
+ }
+ check.objDecl(m, nil, nil)
+ // methods with blank _ names cannot be found - don't keep them
+ if m.name != "_" {
+ base.methods = append(base.methods, m)
+ }
+ }
+}
+
+func (check *Checker) funcDecl(obj *Func, decl *declInfo) {
+ assert(obj.typ == nil)
+
+ // func declarations cannot use iota
+ assert(check.iota == nil)
+
+ sig := new(Signature)
+ obj.typ = sig // guard against cycles
+ fdecl := decl.fdecl
+ check.funcType(sig, fdecl.Recv, fdecl.Type)
+ if sig.recv == nil && obj.name == "init" && (sig.params.Len() > 0 || sig.results.Len() > 0) {
+ check.errorf(fdecl.Pos(), "func init must have no arguments and no return values")
+ // ok to continue
+ }
+
+ // function body must be type-checked after global declarations
+ // (functions implemented elsewhere have no body)
+ if !check.conf.IgnoreFuncBodies && fdecl.Body != nil {
+ check.later(obj.name, decl, sig, fdecl.Body)
+ }
+}
+
+func (check *Checker) declStmt(decl ast.Decl) {
+ pkg := check.pkg
+
+ switch d := decl.(type) {
+ case *ast.BadDecl:
+ // ignore
+
+ case *ast.GenDecl:
+ var last *ast.ValueSpec // last ValueSpec with type or init exprs seen
+ for iota, spec := range d.Specs {
+ switch s := spec.(type) {
+ case *ast.ValueSpec:
+ switch d.Tok {
+ case token.CONST:
+ // determine which init exprs to use
+ switch {
+ case s.Type != nil || len(s.Values) > 0:
+ last = s
+ case last == nil:
+ last = new(ast.ValueSpec) // make sure last exists
+ }
+
+ // declare all constants
+ lhs := make([]*Const, len(s.Names))
+ for i, name := range s.Names {
+ obj := NewConst(name.Pos(), pkg, name.Name, nil, exact.MakeInt64(int64(iota)))
+ lhs[i] = obj
+
+ var init ast.Expr
+ if i < len(last.Values) {
+ init = last.Values[i]
+ }
+
+ check.constDecl(obj, last.Type, init)
+ }
+
+ check.arityMatch(s, last)
+
+ // spec: "The scope of a constant or variable identifier declared
+ // inside a function begins at the end of the ConstSpec or VarSpec
+ // (ShortVarDecl for short variable declarations) and ends at the
+ // end of the innermost containing block."
+ scopePos := s.End()
+ for i, name := range s.Names {
+ check.declare(check.scope, name, lhs[i], scopePos)
+ }
+
+ case token.VAR:
+ lhs0 := make([]*Var, len(s.Names))
+ for i, name := range s.Names {
+ lhs0[i] = NewVar(name.Pos(), pkg, name.Name, nil)
+ }
+
+ // initialize all variables
+ for i, obj := range lhs0 {
+ var lhs []*Var
+ var init ast.Expr
+ switch len(s.Values) {
+ case len(s.Names):
+ // lhs and rhs match
+ init = s.Values[i]
+ case 1:
+ // rhs is expected to be a multi-valued expression
+ lhs = lhs0
+ init = s.Values[0]
+ default:
+ if i < len(s.Values) {
+ init = s.Values[i]
+ }
+ }
+ check.varDecl(obj, lhs, s.Type, init)
+ if len(s.Values) == 1 {
+ // If we have a single lhs variable we are done either way.
+ // If we have a single rhs expression, it must be a multi-
+ // valued expression, in which case handling the first lhs
+ // variable will cause all lhs variables to have a type
+ // assigned, and we are done as well.
+ if debug {
+ for _, obj := range lhs0 {
+ assert(obj.typ != nil)
+ }
+ }
+ break
+ }
+ }
+
+ check.arityMatch(s, nil)
+
+ // declare all variables
+ // (only at this point are the variable scopes (parents) set)
+ scopePos := s.End() // see constant declarations
+ for i, name := range s.Names {
+ // see constant declarations
+ check.declare(check.scope, name, lhs0[i], scopePos)
+ }
+
+ default:
+ check.invalidAST(s.Pos(), "invalid token %s", d.Tok)
+ }
+
+ case *ast.TypeSpec:
+ obj := NewTypeName(s.Name.Pos(), pkg, s.Name.Name, nil)
+ // spec: "The scope of a type identifier declared inside a function
+ // begins at the identifier in the TypeSpec and ends at the end of
+ // the innermost containing block."
+ scopePos := s.Name.Pos()
+ check.declare(check.scope, s.Name, obj, scopePos)
+ check.typeDecl(obj, s.Type, nil, nil)
+
+ default:
+ check.invalidAST(s.Pos(), "const, type, or var declaration expected")
+ }
+ }
+
+ default:
+ check.invalidAST(d.Pos(), "unknown ast.Decl node %T", d)
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/errors.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/errors.go
new file mode 100644
index 0000000000..0c0049b1f3
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/errors.go
@@ -0,0 +1,103 @@
+// Copyright 2012 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.
+
+// This file implements various error reporters.
+
+package types
+
+import (
+ "fmt"
+ "go/ast"
+ "go/token"
+ "strings"
+)
+
+func assert(p bool) {
+ if !p {
+ panic("assertion failed")
+ }
+}
+
+func unreachable() {
+ panic("unreachable")
+}
+
+func (check *Checker) qualifier(pkg *Package) string {
+ if pkg != check.pkg {
+ return pkg.path
+ }
+ return ""
+}
+
+func (check *Checker) sprintf(format string, args ...interface{}) string {
+ for i, arg := range args {
+ switch a := arg.(type) {
+ case nil:
+ arg = ""
+ case operand:
+ panic("internal error: should always pass *operand")
+ case *operand:
+ arg = operandString(a, check.qualifier)
+ case token.Pos:
+ arg = check.fset.Position(a).String()
+ case ast.Expr:
+ arg = ExprString(a)
+ case Object:
+ arg = ObjectString(a, check.qualifier)
+ case Type:
+ arg = TypeString(a, check.qualifier)
+ }
+ args[i] = arg
+ }
+ return fmt.Sprintf(format, args...)
+}
+
+func (check *Checker) trace(pos token.Pos, format string, args ...interface{}) {
+ fmt.Printf("%s:\t%s%s\n",
+ check.fset.Position(pos),
+ strings.Repeat(". ", check.indent),
+ check.sprintf(format, args...),
+ )
+}
+
+// dump is only needed for debugging
+func (check *Checker) dump(format string, args ...interface{}) {
+ fmt.Println(check.sprintf(format, args...))
+}
+
+func (check *Checker) err(pos token.Pos, msg string, soft bool) {
+ err := Error{check.fset, pos, msg, soft}
+ if check.firstErr == nil {
+ check.firstErr = err
+ }
+ f := check.conf.Error
+ if f == nil {
+ panic(bailout{}) // report only first error
+ }
+ f(err)
+}
+
+func (check *Checker) error(pos token.Pos, msg string) {
+ check.err(pos, msg, false)
+}
+
+func (check *Checker) errorf(pos token.Pos, format string, args ...interface{}) {
+ check.err(pos, check.sprintf(format, args...), false)
+}
+
+func (check *Checker) softErrorf(pos token.Pos, format string, args ...interface{}) {
+ check.err(pos, check.sprintf(format, args...), true)
+}
+
+func (check *Checker) invalidAST(pos token.Pos, format string, args ...interface{}) {
+ check.errorf(pos, "invalid AST: "+format, args...)
+}
+
+func (check *Checker) invalidArg(pos token.Pos, format string, args ...interface{}) {
+ check.errorf(pos, "invalid argument: "+format, args...)
+}
+
+func (check *Checker) invalidOp(pos token.Pos, format string, args ...interface{}) {
+ check.errorf(pos, "invalid operation: "+format, args...)
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/eval.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/eval.go
new file mode 100644
index 0000000000..c09f2a3ba4
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/eval.go
@@ -0,0 +1,87 @@
+// 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.
+
+package types
+
+import (
+ "fmt"
+ "go/parser"
+ "go/token"
+)
+
+// Eval returns the type and, if constant, the value for the
+// expression expr, evaluated at position pos of package pkg,
+// which must have been derived from type-checking an AST with
+// complete position information relative to the provided file
+// set.
+//
+// If the expression contains function literals, their bodies
+// are ignored (i.e., the bodies are not type-checked).
+//
+// If pkg == nil, the Universe scope is used and the provided
+// position pos is ignored. If pkg != nil, and pos is invalid,
+// the package scope is used. Otherwise, pos must belong to the
+// package.
+//
+// An error is returned if pos is not within the package or
+// if the node cannot be evaluated.
+//
+// Note: Eval should not be used instead of running Check to compute
+// types and values, but in addition to Check. Eval will re-evaluate
+// its argument each time, and it also does not know about the context
+// in which an expression is used (e.g., an assignment). Thus, top-
+// level untyped constants will return an untyped type rather then the
+// respective context-specific type.
+//
+func Eval(fset *token.FileSet, pkg *Package, pos token.Pos, expr string) (tv TypeAndValue, err error) {
+ // determine scope
+ var scope *Scope
+ if pkg == nil {
+ scope = Universe
+ pos = token.NoPos
+ } else if !pos.IsValid() {
+ scope = pkg.scope
+ } else {
+ // The package scope extent (position information) may be
+ // incorrect (files spread accross a wide range of fset
+ // positions) - ignore it and just consider its children
+ // (file scopes).
+ for _, fscope := range pkg.scope.children {
+ if scope = fscope.Innermost(pos); scope != nil {
+ break
+ }
+ }
+ if scope == nil || debug {
+ s := scope
+ for s != nil && s != pkg.scope {
+ s = s.parent
+ }
+ // s == nil || s == pkg.scope
+ if s == nil {
+ return TypeAndValue{}, fmt.Errorf("no position %s found in package %s", fset.Position(pos), pkg.name)
+ }
+ }
+ }
+
+ // parse expressions
+ // BUG(gri) In case of type-checking errors below, the type checker
+ // doesn't have the correct file set for expr. The correct
+ // solution requires a ParseExpr that uses the incoming
+ // file set fset.
+ node, err := parser.ParseExpr(expr)
+ if err != nil {
+ return TypeAndValue{}, err
+ }
+
+ // initialize checker
+ check := NewChecker(nil, fset, pkg, nil)
+ check.scope = scope
+ check.pos = pos
+ defer check.handleBailout(&err)
+
+ // evaluate node
+ var x operand
+ check.rawExpr(&x, node, nil)
+ return TypeAndValue{x.mode, x.typ, x.val}, err
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/eval_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/eval_test.go
new file mode 100644
index 0000000000..b68b244f95
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/eval_test.go
@@ -0,0 +1,186 @@
+// 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.
+
+// This file contains tests for Eval.
+
+package types_test
+
+import (
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "strings"
+ "testing"
+
+ _ "golang.org/x/tools/go/gcimporter"
+ . "golang.org/x/tools/go/types"
+)
+
+func testEval(t *testing.T, fset *token.FileSet, pkg *Package, pos token.Pos, expr string, typ Type, typStr, valStr string) {
+ gotTv, err := Eval(fset, pkg, pos, expr)
+ if err != nil {
+ t.Errorf("Eval(%q) failed: %s", expr, err)
+ return
+ }
+ if gotTv.Type == nil {
+ t.Errorf("Eval(%q) got nil type but no error", expr)
+ return
+ }
+
+ // compare types
+ if typ != nil {
+ // we have a type, check identity
+ if !Identical(gotTv.Type, typ) {
+ t.Errorf("Eval(%q) got type %s, want %s", expr, gotTv.Type, typ)
+ return
+ }
+ } else {
+ // we have a string, compare type string
+ gotStr := gotTv.Type.String()
+ if gotStr != typStr {
+ t.Errorf("Eval(%q) got type %s, want %s", expr, gotStr, typStr)
+ return
+ }
+ }
+
+ // compare values
+ gotStr := ""
+ if gotTv.Value != nil {
+ gotStr = gotTv.Value.String()
+ }
+ if gotStr != valStr {
+ t.Errorf("Eval(%q) got value %s, want %s", expr, gotStr, valStr)
+ }
+}
+
+func TestEvalBasic(t *testing.T) {
+ fset := token.NewFileSet()
+ for _, typ := range Typ[Bool : String+1] {
+ testEval(t, fset, nil, token.NoPos, typ.Name(), typ, "", "")
+ }
+}
+
+func TestEvalComposite(t *testing.T) {
+ fset := token.NewFileSet()
+ for _, test := range independentTestTypes {
+ testEval(t, fset, nil, token.NoPos, test.src, nil, test.str, "")
+ }
+}
+
+func TestEvalArith(t *testing.T) {
+ var tests = []string{
+ `true`,
+ `false == false`,
+ `12345678 + 87654321 == 99999999`,
+ `10 * 20 == 200`,
+ `(1<<1000)*2 >> 100 == 2<<900`,
+ `"foo" + "bar" == "foobar"`,
+ `"abc" <= "bcd"`,
+ `len([10]struct{}{}) == 2*5`,
+ }
+ fset := token.NewFileSet()
+ for _, test := range tests {
+ testEval(t, fset, nil, token.NoPos, test, Typ[UntypedBool], "", "true")
+ }
+}
+
+func TestEvalPos(t *testing.T) {
+ skipSpecialPlatforms(t)
+
+ // The contents of /*-style comments are of the form
+ // expr => value, type
+ // where value may be the empty string.
+ // Each expr is evaluated at the position of the comment
+ // and the result is compared with the expected value
+ // and type.
+ var sources = []string{
+ `
+ package p
+ import "fmt"
+ import m "math"
+ const c = 3.0
+ type T []int
+ func f(a int, s string) float64 {
+ fmt.Println("calling f")
+ _ = m.Pi // use package math
+ const d int = c + 1
+ var x int
+ x = a + len(s)
+ return float64(x)
+ /* true => true, untyped bool */
+ /* fmt.Println => , func(a ...interface{}) (n int, err error) */
+ /* c => 3, untyped float */
+ /* T => , p.T */
+ /* a => , int */
+ /* s => , string */
+ /* d => 4, int */
+ /* x => , int */
+ /* d/c => 1, int */
+ /* c/2 => 3/2, untyped float */
+ /* m.Pi < m.E => false, untyped bool */
+ }
+ `,
+ `
+ package p
+ /* c => 3, untyped float */
+ type T1 /* T1 => , p.T1 */ struct {}
+ var v1 /* v1 => , int */ = 42
+ func /* f1 => , func(v1 float64) */ f1(v1 float64) {
+ /* f1 => , func(v1 float64) */
+ /* v1 => , float64 */
+ var c /* c => 3, untyped float */ = "foo" /* c => , string */
+ {
+ var c struct {
+ c /* c => , string */ int
+ }
+ /* c => , struct{c int} */
+ _ = c
+ }
+ _ = func(a, b, c int) /* c => , string */ {
+ /* c => , int */
+ }
+ _ = c
+ type FT /* FT => , p.FT */ interface{}
+ }
+ `,
+ `
+ package p
+ /* T => , p.T */
+ `,
+ }
+
+ fset := token.NewFileSet()
+ var files []*ast.File
+ for i, src := range sources {
+ file, err := parser.ParseFile(fset, "p", src, parser.ParseComments)
+ if err != nil {
+ t.Fatalf("could not parse file %d: %s", i, err)
+ }
+ files = append(files, file)
+ }
+
+ pkg, err := Check("p", fset, files)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ for _, file := range files {
+ for _, group := range file.Comments {
+ for _, comment := range group.List {
+ s := comment.Text
+ if len(s) >= 4 && s[:2] == "/*" && s[len(s)-2:] == "*/" {
+ str, typ := split(s[2:len(s)-2], ", ")
+ str, val := split(str, "=>")
+ testEval(t, fset, pkg, comment.Pos(), str, nil, typ, val)
+ }
+ }
+ }
+ }
+}
+
+// split splits string s at the first occurrence of s.
+func split(s, sep string) (string, string) {
+ i := strings.Index(s, sep)
+ return strings.TrimSpace(s[:i]), strings.TrimSpace(s[i+len(sep):])
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/expr.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/expr.go
new file mode 100644
index 0000000000..6efc7b4309
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/expr.go
@@ -0,0 +1,1497 @@
+// Copyright 2012 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.
+
+// This file implements typechecking of expressions.
+
+package types
+
+import (
+ "fmt"
+ "go/ast"
+ "go/token"
+ "math"
+
+ "golang.org/x/tools/go/exact"
+)
+
+/*
+Basic algorithm:
+
+Expressions are checked recursively, top down. Expression checker functions
+are generally of the form:
+
+ func f(x *operand, e *ast.Expr, ...)
+
+where e is the expression to be checked, and x is the result of the check.
+The check performed by f may fail in which case x.mode == invalid, and
+related error messages will have been issued by f.
+
+If a hint argument is present, it is the composite literal element type
+of an outer composite literal; it is used to type-check composite literal
+elements that have no explicit type specification in the source
+(e.g.: []T{{...}, {...}}, the hint is the type T in this case).
+
+All expressions are checked via rawExpr, which dispatches according
+to expression kind. Upon returning, rawExpr is recording the types and
+constant values for all expressions that have an untyped type (those types
+may change on the way up in the expression tree). Usually these are constants,
+but the results of comparisons or non-constant shifts of untyped constants
+may also be untyped, but not constant.
+
+Untyped expressions may eventually become fully typed (i.e., not untyped),
+typically when the value is assigned to a variable, or is used otherwise.
+The updateExprType method is used to record this final type and update
+the recorded types: the type-checked expression tree is again traversed down,
+and the new type is propagated as needed. Untyped constant expression values
+that become fully typed must now be representable by the full type (constant
+sub-expression trees are left alone except for their roots). This mechanism
+ensures that a client sees the actual (run-time) type an untyped value would
+have. It also permits type-checking of lhs shift operands "as if the shift
+were not present": when updateExprType visits an untyped lhs shift operand
+and assigns it it's final type, that type must be an integer type, and a
+constant lhs must be representable as an integer.
+
+When an expression gets its final type, either on the way out from rawExpr,
+on the way down in updateExprType, or at the end of the type checker run,
+the type (and constant value, if any) is recorded via Info.Types, if present.
+*/
+
+type opPredicates map[token.Token]func(Type) bool
+
+var unaryOpPredicates = opPredicates{
+ token.ADD: isNumeric,
+ token.SUB: isNumeric,
+ token.XOR: isInteger,
+ token.NOT: isBoolean,
+}
+
+func (check *Checker) op(m opPredicates, x *operand, op token.Token) bool {
+ if pred := m[op]; pred != nil {
+ if !pred(x.typ) {
+ check.invalidOp(x.pos(), "operator %s not defined for %s", op, x)
+ return false
+ }
+ } else {
+ check.invalidAST(x.pos(), "unknown operator %s", op)
+ return false
+ }
+ return true
+}
+
+// The unary expression e may be nil. It's passed in for better error messages only.
+func (check *Checker) unary(x *operand, e *ast.UnaryExpr, op token.Token) {
+ switch op {
+ case token.AND:
+ // spec: "As an exception to the addressability
+ // requirement x may also be a composite literal."
+ if _, ok := unparen(x.expr).(*ast.CompositeLit); !ok && x.mode != variable {
+ check.invalidOp(x.pos(), "cannot take address of %s", x)
+ x.mode = invalid
+ return
+ }
+ x.mode = value
+ x.typ = &Pointer{base: x.typ}
+ return
+
+ case token.ARROW:
+ typ, ok := x.typ.Underlying().(*Chan)
+ if !ok {
+ check.invalidOp(x.pos(), "cannot receive from non-channel %s", x)
+ x.mode = invalid
+ return
+ }
+ if typ.dir == SendOnly {
+ check.invalidOp(x.pos(), "cannot receive from send-only channel %s", x)
+ x.mode = invalid
+ return
+ }
+ x.mode = commaok
+ x.typ = typ.elem
+ check.hasCallOrRecv = true
+ return
+ }
+
+ if !check.op(unaryOpPredicates, x, op) {
+ x.mode = invalid
+ return
+ }
+
+ if x.mode == constant {
+ typ := x.typ.Underlying().(*Basic)
+ size := -1
+ if isUnsigned(typ) {
+ size = int(check.conf.sizeof(typ))
+ }
+ x.val = exact.UnaryOp(op, x.val, size)
+ // Typed constants must be representable in
+ // their type after each constant operation.
+ if isTyped(typ) {
+ if e != nil {
+ x.expr = e // for better error message
+ }
+ check.representable(x, typ)
+ }
+ return
+ }
+
+ x.mode = value
+ // x.typ remains unchanged
+}
+
+func isShift(op token.Token) bool {
+ return op == token.SHL || op == token.SHR
+}
+
+func isComparison(op token.Token) bool {
+ // Note: tokens are not ordered well to make this much easier
+ switch op {
+ case token.EQL, token.NEQ, token.LSS, token.LEQ, token.GTR, token.GEQ:
+ return true
+ }
+ return false
+}
+
+func fitsFloat32(x exact.Value) bool {
+ f32, _ := exact.Float32Val(x)
+ f := float64(f32)
+ return !math.IsInf(f, 0)
+}
+
+func roundFloat32(x exact.Value) exact.Value {
+ f32, _ := exact.Float32Val(x)
+ f := float64(f32)
+ if !math.IsInf(f, 0) {
+ return exact.MakeFloat64(f)
+ }
+ return nil
+}
+
+func fitsFloat64(x exact.Value) bool {
+ f, _ := exact.Float64Val(x)
+ return !math.IsInf(f, 0)
+}
+
+func roundFloat64(x exact.Value) exact.Value {
+ f, _ := exact.Float64Val(x)
+ if !math.IsInf(f, 0) {
+ return exact.MakeFloat64(f)
+ }
+ return nil
+}
+
+// representableConst reports whether x can be represented as
+// value of the given basic type kind and for the configuration
+// provided (only needed for int/uint sizes).
+//
+// If rounded != nil, *rounded is set to the rounded value of x for
+// representable floating-point values; it is left alone otherwise.
+// It is ok to provide the addressof the first argument for rounded.
+func representableConst(x exact.Value, conf *Config, as BasicKind, rounded *exact.Value) bool {
+ switch x.Kind() {
+ case exact.Unknown:
+ return true
+
+ case exact.Bool:
+ return as == Bool || as == UntypedBool
+
+ case exact.Int:
+ if x, ok := exact.Int64Val(x); ok {
+ switch as {
+ case Int:
+ var s = uint(conf.sizeof(Typ[as])) * 8
+ return int64(-1)<<(s-1) <= x && x <= int64(1)<<(s-1)-1
+ case Int8:
+ const s = 8
+ return -1<<(s-1) <= x && x <= 1<<(s-1)-1
+ case Int16:
+ const s = 16
+ return -1<<(s-1) <= x && x <= 1<<(s-1)-1
+ case Int32:
+ const s = 32
+ return -1<<(s-1) <= x && x <= 1<<(s-1)-1
+ case Int64:
+ return true
+ case Uint, Uintptr:
+ if s := uint(conf.sizeof(Typ[as])) * 8; s < 64 {
+ return 0 <= x && x <= int64(1)<= 0 && n <= int(s)
+ case Uint64:
+ return exact.Sign(x) >= 0 && n <= 64
+ case Float32, Complex64:
+ if rounded == nil {
+ return fitsFloat32(x)
+ }
+ r := roundFloat32(x)
+ if r != nil {
+ *rounded = r
+ return true
+ }
+ case Float64, Complex128:
+ if rounded == nil {
+ return fitsFloat64(x)
+ }
+ r := roundFloat64(x)
+ if r != nil {
+ *rounded = r
+ return true
+ }
+ case UntypedInt, UntypedFloat, UntypedComplex:
+ return true
+ }
+
+ case exact.Float:
+ switch as {
+ case Float32, Complex64:
+ if rounded == nil {
+ return fitsFloat32(x)
+ }
+ r := roundFloat32(x)
+ if r != nil {
+ *rounded = r
+ return true
+ }
+ case Float64, Complex128:
+ if rounded == nil {
+ return fitsFloat64(x)
+ }
+ r := roundFloat64(x)
+ if r != nil {
+ *rounded = r
+ return true
+ }
+ case UntypedFloat, UntypedComplex:
+ return true
+ }
+
+ case exact.Complex:
+ switch as {
+ case Complex64:
+ if rounded == nil {
+ return fitsFloat32(exact.Real(x)) && fitsFloat32(exact.Imag(x))
+ }
+ re := roundFloat32(exact.Real(x))
+ im := roundFloat32(exact.Imag(x))
+ if re != nil && im != nil {
+ *rounded = exact.BinaryOp(re, token.ADD, exact.MakeImag(im))
+ return true
+ }
+ case Complex128:
+ if rounded == nil {
+ return fitsFloat64(exact.Real(x)) && fitsFloat64(exact.Imag(x))
+ }
+ re := roundFloat64(exact.Real(x))
+ im := roundFloat64(exact.Imag(x))
+ if re != nil && im != nil {
+ *rounded = exact.BinaryOp(re, token.ADD, exact.MakeImag(im))
+ return true
+ }
+ case UntypedComplex:
+ return true
+ }
+
+ case exact.String:
+ return as == String || as == UntypedString
+
+ default:
+ unreachable()
+ }
+
+ return false
+}
+
+// representable checks that a constant operand is representable in the given basic type.
+func (check *Checker) representable(x *operand, typ *Basic) {
+ assert(x.mode == constant)
+ if !representableConst(x.val, check.conf, typ.kind, &x.val) {
+ var msg string
+ if isNumeric(x.typ) && isNumeric(typ) {
+ // numeric conversion : error msg
+ //
+ // integer -> integer : overflows
+ // integer -> float : overflows (actually not possible)
+ // float -> integer : truncated
+ // float -> float : overflows
+ //
+ if !isInteger(x.typ) && isInteger(typ) {
+ msg = "%s truncated to %s"
+ } else {
+ msg = "%s overflows %s"
+ }
+ } else {
+ msg = "cannot convert %s to %s"
+ }
+ check.errorf(x.pos(), msg, x, typ)
+ x.mode = invalid
+ }
+}
+
+// updateExprType updates the type of x to typ and invokes itself
+// recursively for the operands of x, depending on expression kind.
+// If typ is still an untyped and not the final type, updateExprType
+// only updates the recorded untyped type for x and possibly its
+// operands. Otherwise (i.e., typ is not an untyped type anymore,
+// or it is the final type for x), the type and value are recorded.
+// Also, if x is a constant, it must be representable as a value of typ,
+// and if x is the (formerly untyped) lhs operand of a non-constant
+// shift, it must be an integer value.
+//
+func (check *Checker) updateExprType(x ast.Expr, typ Type, final bool) {
+ old, found := check.untyped[x]
+ if !found {
+ return // nothing to do
+ }
+
+ // update operands of x if necessary
+ switch x := x.(type) {
+ case *ast.BadExpr,
+ *ast.FuncLit,
+ *ast.CompositeLit,
+ *ast.IndexExpr,
+ *ast.SliceExpr,
+ *ast.TypeAssertExpr,
+ *ast.StarExpr,
+ *ast.KeyValueExpr,
+ *ast.ArrayType,
+ *ast.StructType,
+ *ast.FuncType,
+ *ast.InterfaceType,
+ *ast.MapType,
+ *ast.ChanType:
+ // These expression are never untyped - nothing to do.
+ // The respective sub-expressions got their final types
+ // upon assignment or use.
+ if debug {
+ check.dump("%s: found old type(%s): %s (new: %s)", x.Pos(), x, old.typ, typ)
+ unreachable()
+ }
+ return
+
+ case *ast.CallExpr:
+ // Resulting in an untyped constant (e.g., built-in complex).
+ // The respective calls take care of calling updateExprType
+ // for the arguments if necessary.
+
+ case *ast.Ident, *ast.BasicLit, *ast.SelectorExpr:
+ // An identifier denoting a constant, a constant literal,
+ // or a qualified identifier (imported untyped constant).
+ // No operands to take care of.
+
+ case *ast.ParenExpr:
+ check.updateExprType(x.X, typ, final)
+
+ case *ast.UnaryExpr:
+ // If x is a constant, the operands were constants.
+ // They don't need to be updated since they never
+ // get "materialized" into a typed value; and they
+ // will be processed at the end of the type check.
+ if old.val != nil {
+ break
+ }
+ check.updateExprType(x.X, typ, final)
+
+ case *ast.BinaryExpr:
+ if old.val != nil {
+ break // see comment for unary expressions
+ }
+ if isComparison(x.Op) {
+ // The result type is independent of operand types
+ // and the operand types must have final types.
+ } else if isShift(x.Op) {
+ // The result type depends only on lhs operand.
+ // The rhs type was updated when checking the shift.
+ check.updateExprType(x.X, typ, final)
+ } else {
+ // The operand types match the result type.
+ check.updateExprType(x.X, typ, final)
+ check.updateExprType(x.Y, typ, final)
+ }
+
+ default:
+ unreachable()
+ }
+
+ // If the new type is not final and still untyped, just
+ // update the recorded type.
+ if !final && isUntyped(typ) {
+ old.typ = typ.Underlying().(*Basic)
+ check.untyped[x] = old
+ return
+ }
+
+ // Otherwise we have the final (typed or untyped type).
+ // Remove it from the map of yet untyped expressions.
+ delete(check.untyped, x)
+
+ // If x is the lhs of a shift, its final type must be integer.
+ // We already know from the shift check that it is representable
+ // as an integer if it is a constant.
+ if old.isLhs && !isInteger(typ) {
+ check.invalidOp(x.Pos(), "shifted operand %s (type %s) must be integer", x, typ)
+ return
+ }
+
+ // Everything's fine, record final type and value for x.
+ check.recordTypeAndValue(x, old.mode, typ, old.val)
+}
+
+// updateExprVal updates the value of x to val.
+func (check *Checker) updateExprVal(x ast.Expr, val exact.Value) {
+ if info, ok := check.untyped[x]; ok {
+ info.val = val
+ check.untyped[x] = info
+ }
+}
+
+// convertUntyped attempts to set the type of an untyped value to the target type.
+func (check *Checker) convertUntyped(x *operand, target Type) {
+ if x.mode == invalid || isTyped(x.typ) || target == Typ[Invalid] {
+ return
+ }
+
+ // TODO(gri) Sloppy code - clean up. This function is central
+ // to assignment and expression checking.
+
+ if isUntyped(target) {
+ // both x and target are untyped
+ xkind := x.typ.(*Basic).kind
+ tkind := target.(*Basic).kind
+ if isNumeric(x.typ) && isNumeric(target) {
+ if xkind < tkind {
+ x.typ = target
+ check.updateExprType(x.expr, target, false)
+ }
+ } else if xkind != tkind {
+ goto Error
+ }
+ return
+ }
+
+ // typed target
+ switch t := target.Underlying().(type) {
+ case *Basic:
+ if x.mode == constant {
+ check.representable(x, t)
+ if x.mode == invalid {
+ return
+ }
+ // expression value may have been rounded - update if needed
+ // TODO(gri) A floating-point value may silently underflow to
+ // zero. If it was negative, the sign is lost. See issue 6898.
+ check.updateExprVal(x.expr, x.val)
+ } else {
+ // Non-constant untyped values may appear as the
+ // result of comparisons (untyped bool), intermediate
+ // (delayed-checked) rhs operands of shifts, and as
+ // the value nil.
+ switch x.typ.(*Basic).kind {
+ case UntypedBool:
+ if !isBoolean(target) {
+ goto Error
+ }
+ case UntypedInt, UntypedRune, UntypedFloat, UntypedComplex:
+ if !isNumeric(target) {
+ goto Error
+ }
+ case UntypedString:
+ // Non-constant untyped string values are not
+ // permitted by the spec and should not occur.
+ unreachable()
+ case UntypedNil:
+ // Unsafe.Pointer is a basic type that includes nil.
+ if !hasNil(target) {
+ goto Error
+ }
+ default:
+ goto Error
+ }
+ }
+ case *Interface:
+ if !x.isNil() && !t.Empty() /* empty interfaces are ok */ {
+ goto Error
+ }
+ // Update operand types to the default type rather then
+ // the target (interface) type: values must have concrete
+ // dynamic types. If the value is nil, keep it untyped
+ // (this is important for tools such as go vet which need
+ // the dynamic type for argument checking of say, print
+ // functions)
+ if x.isNil() {
+ target = Typ[UntypedNil]
+ } else {
+ // cannot assign untyped values to non-empty interfaces
+ if !t.Empty() {
+ goto Error
+ }
+ target = defaultType(x.typ)
+ }
+ case *Pointer, *Signature, *Slice, *Map, *Chan:
+ if !x.isNil() {
+ goto Error
+ }
+ // keep nil untyped - see comment for interfaces, above
+ target = Typ[UntypedNil]
+ default:
+ goto Error
+ }
+
+ x.typ = target
+ check.updateExprType(x.expr, target, true) // UntypedNils are final
+ return
+
+Error:
+ check.errorf(x.pos(), "cannot convert %s to %s", x, target)
+ x.mode = invalid
+}
+
+func (check *Checker) comparison(x, y *operand, op token.Token) {
+ // spec: "In any comparison, the first operand must be assignable
+ // to the type of the second operand, or vice versa."
+ err := ""
+ if x.assignableTo(check.conf, y.typ) || y.assignableTo(check.conf, x.typ) {
+ defined := false
+ switch op {
+ case token.EQL, token.NEQ:
+ // spec: "The equality operators == and != apply to operands that are comparable."
+ defined = Comparable(x.typ) || x.isNil() && hasNil(y.typ) || y.isNil() && hasNil(x.typ)
+ case token.LSS, token.LEQ, token.GTR, token.GEQ:
+ // spec: The ordering operators <, <=, >, and >= apply to operands that are ordered."
+ defined = isOrdered(x.typ)
+ default:
+ unreachable()
+ }
+ if !defined {
+ typ := x.typ
+ if x.isNil() {
+ typ = y.typ
+ }
+ err = check.sprintf("operator %s not defined for %s", op, typ)
+ }
+ } else {
+ err = check.sprintf("mismatched types %s and %s", x.typ, y.typ)
+ }
+
+ if err != "" {
+ check.errorf(x.pos(), "cannot compare %s %s %s (%s)", x.expr, op, y.expr, err)
+ x.mode = invalid
+ return
+ }
+
+ if x.mode == constant && y.mode == constant {
+ x.val = exact.MakeBool(exact.Compare(x.val, op, y.val))
+ // The operands are never materialized; no need to update
+ // their types.
+ } else {
+ x.mode = value
+ // The operands have now their final types, which at run-
+ // time will be materialized. Update the expression trees.
+ // If the current types are untyped, the materialized type
+ // is the respective default type.
+ check.updateExprType(x.expr, defaultType(x.typ), true)
+ check.updateExprType(y.expr, defaultType(y.typ), true)
+ }
+
+ // spec: "Comparison operators compare two operands and yield
+ // an untyped boolean value."
+ x.typ = Typ[UntypedBool]
+}
+
+func (check *Checker) shift(x, y *operand, op token.Token) {
+ untypedx := isUntyped(x.typ)
+
+ // The lhs must be of integer type or be representable
+ // as an integer; otherwise the shift has no chance.
+ if !x.isInteger() {
+ check.invalidOp(x.pos(), "shifted operand %s must be integer", x)
+ x.mode = invalid
+ return
+ }
+
+ // spec: "The right operand in a shift expression must have unsigned
+ // integer type or be an untyped constant that can be converted to
+ // unsigned integer type."
+ switch {
+ case isInteger(y.typ) && isUnsigned(y.typ):
+ // nothing to do
+ case isUntyped(y.typ):
+ check.convertUntyped(y, Typ[UntypedInt])
+ if y.mode == invalid {
+ x.mode = invalid
+ return
+ }
+ default:
+ check.invalidOp(y.pos(), "shift count %s must be unsigned integer", y)
+ x.mode = invalid
+ return
+ }
+
+ if x.mode == constant {
+ if y.mode == constant {
+ // rhs must be an integer value
+ if !y.isInteger() {
+ check.invalidOp(y.pos(), "shift count %s must be unsigned integer", y)
+ x.mode = invalid
+ return
+ }
+ // rhs must be within reasonable bounds
+ const stupidShift = 1023 - 1 + 52 // so we can express smallestFloat64
+ s, ok := exact.Uint64Val(y.val)
+ if !ok || s > stupidShift {
+ check.invalidOp(y.pos(), "stupid shift count %s", y)
+ x.mode = invalid
+ return
+ }
+ // The lhs is representable as an integer but may not be an integer
+ // (e.g., 2.0, an untyped float) - this can only happen for untyped
+ // non-integer numeric constants. Correct the type so that the shift
+ // result is of integer type.
+ if !isInteger(x.typ) {
+ x.typ = Typ[UntypedInt]
+ }
+ x.val = exact.Shift(x.val, op, uint(s))
+ return
+ }
+
+ // non-constant shift with constant lhs
+ if untypedx {
+ // spec: "If the left operand of a non-constant shift
+ // expression is an untyped constant, the type of the
+ // constant is what it would be if the shift expression
+ // were replaced by its left operand alone.".
+ //
+ // Delay operand checking until we know the final type:
+ // The lhs expression must be in the untyped map, mark
+ // the entry as lhs shift operand.
+ info, found := check.untyped[x.expr]
+ assert(found)
+ info.isLhs = true
+ check.untyped[x.expr] = info
+ // keep x's type
+ x.mode = value
+ return
+ }
+ }
+
+ // constant rhs must be >= 0
+ if y.mode == constant && exact.Sign(y.val) < 0 {
+ check.invalidOp(y.pos(), "shift count %s must not be negative", y)
+ }
+
+ // non-constant shift - lhs must be an integer
+ if !isInteger(x.typ) {
+ check.invalidOp(x.pos(), "shifted operand %s must be integer", x)
+ x.mode = invalid
+ return
+ }
+
+ x.mode = value
+}
+
+var binaryOpPredicates = opPredicates{
+ token.ADD: func(typ Type) bool { return isNumeric(typ) || isString(typ) },
+ token.SUB: isNumeric,
+ token.MUL: isNumeric,
+ token.QUO: isNumeric,
+ token.REM: isInteger,
+
+ token.AND: isInteger,
+ token.OR: isInteger,
+ token.XOR: isInteger,
+ token.AND_NOT: isInteger,
+
+ token.LAND: isBoolean,
+ token.LOR: isBoolean,
+}
+
+// The binary expression e may be nil. It's passed in for better error messages only.
+func (check *Checker) binary(x *operand, e *ast.BinaryExpr, lhs, rhs ast.Expr, op token.Token) {
+ var y operand
+
+ check.expr(x, lhs)
+ check.expr(&y, rhs)
+
+ if x.mode == invalid {
+ return
+ }
+ if y.mode == invalid {
+ x.mode = invalid
+ x.expr = y.expr
+ return
+ }
+
+ if isShift(op) {
+ check.shift(x, &y, op)
+ return
+ }
+
+ check.convertUntyped(x, y.typ)
+ if x.mode == invalid {
+ return
+ }
+ check.convertUntyped(&y, x.typ)
+ if y.mode == invalid {
+ x.mode = invalid
+ return
+ }
+
+ if isComparison(op) {
+ check.comparison(x, &y, op)
+ return
+ }
+
+ if !Identical(x.typ, y.typ) {
+ // only report an error if we have valid types
+ // (otherwise we had an error reported elsewhere already)
+ if x.typ != Typ[Invalid] && y.typ != Typ[Invalid] {
+ check.invalidOp(x.pos(), "mismatched types %s and %s", x.typ, y.typ)
+ }
+ x.mode = invalid
+ return
+ }
+
+ if !check.op(binaryOpPredicates, x, op) {
+ x.mode = invalid
+ return
+ }
+
+ if (op == token.QUO || op == token.REM) && (x.mode == constant || isInteger(x.typ)) && y.mode == constant && exact.Sign(y.val) == 0 {
+ check.invalidOp(y.pos(), "division by zero")
+ x.mode = invalid
+ return
+ }
+
+ if x.mode == constant && y.mode == constant {
+ typ := x.typ.Underlying().(*Basic)
+ // force integer division of integer operands
+ if op == token.QUO && isInteger(typ) {
+ op = token.QUO_ASSIGN
+ }
+ x.val = exact.BinaryOp(x.val, op, y.val)
+ // Typed constants must be representable in
+ // their type after each constant operation.
+ if isTyped(typ) {
+ if e != nil {
+ x.expr = e // for better error message
+ }
+ check.representable(x, typ)
+ }
+ return
+ }
+
+ x.mode = value
+ // x.typ is unchanged
+}
+
+// index checks an index expression for validity.
+// If max >= 0, it is the upper bound for index.
+// If index is valid and the result i >= 0, then i is the constant value of index.
+func (check *Checker) index(index ast.Expr, max int64) (i int64, valid bool) {
+ var x operand
+ check.expr(&x, index)
+ if x.mode == invalid {
+ return
+ }
+
+ // an untyped constant must be representable as Int
+ check.convertUntyped(&x, Typ[Int])
+ if x.mode == invalid {
+ return
+ }
+
+ // the index must be of integer type
+ if !isInteger(x.typ) {
+ check.invalidArg(x.pos(), "index %s must be integer", &x)
+ return
+ }
+
+ // a constant index i must be in bounds
+ if x.mode == constant {
+ if exact.Sign(x.val) < 0 {
+ check.invalidArg(x.pos(), "index %s must not be negative", &x)
+ return
+ }
+ i, valid = exact.Int64Val(x.val)
+ if !valid || max >= 0 && i >= max {
+ check.errorf(x.pos(), "index %s is out of bounds", &x)
+ return i, false
+ }
+ // 0 <= i [ && i < max ]
+ return i, true
+ }
+
+ return -1, true
+}
+
+// indexElts checks the elements (elts) of an array or slice composite literal
+// against the literal's element type (typ), and the element indices against
+// the literal length if known (length >= 0). It returns the length of the
+// literal (maximum index value + 1).
+//
+func (check *Checker) indexedElts(elts []ast.Expr, typ Type, length int64) int64 {
+ visited := make(map[int64]bool, len(elts))
+ var index, max int64
+ for _, e := range elts {
+ // determine and check index
+ validIndex := false
+ eval := e
+ if kv, _ := e.(*ast.KeyValueExpr); kv != nil {
+ if i, ok := check.index(kv.Key, length); ok {
+ if i >= 0 {
+ index = i
+ validIndex = true
+ } else {
+ check.errorf(e.Pos(), "index %s must be integer constant", kv.Key)
+ }
+ }
+ eval = kv.Value
+ } else if length >= 0 && index >= length {
+ check.errorf(e.Pos(), "index %d is out of bounds (>= %d)", index, length)
+ } else {
+ validIndex = true
+ }
+
+ // if we have a valid index, check for duplicate entries
+ if validIndex {
+ if visited[index] {
+ check.errorf(e.Pos(), "duplicate index %d in array or slice literal", index)
+ }
+ visited[index] = true
+ }
+ index++
+ if index > max {
+ max = index
+ }
+
+ // check element against composite literal element type
+ var x operand
+ check.exprWithHint(&x, eval, typ)
+ if !check.assignment(&x, typ) && x.mode != invalid {
+ check.errorf(x.pos(), "cannot use %s as %s value in array or slice literal", &x, typ)
+ }
+ }
+ return max
+}
+
+// exprKind describes the kind of an expression; the kind
+// determines if an expression is valid in 'statement context'.
+type exprKind int
+
+const (
+ conversion exprKind = iota
+ expression
+ statement
+)
+
+// rawExpr typechecks expression e and initializes x with the expression
+// value or type. If an error occurred, x.mode is set to invalid.
+// If hint != nil, it is the type of a composite literal element.
+//
+func (check *Checker) rawExpr(x *operand, e ast.Expr, hint Type) exprKind {
+ if trace {
+ check.trace(e.Pos(), "%s", e)
+ check.indent++
+ defer func() {
+ check.indent--
+ check.trace(e.Pos(), "=> %s", x)
+ }()
+ }
+
+ kind := check.exprInternal(x, e, hint)
+
+ // convert x into a user-friendly set of values
+ // TODO(gri) this code can be simplified
+ var typ Type
+ var val exact.Value
+ switch x.mode {
+ case invalid:
+ typ = Typ[Invalid]
+ case novalue:
+ typ = (*Tuple)(nil)
+ case constant:
+ typ = x.typ
+ val = x.val
+ default:
+ typ = x.typ
+ }
+ assert(x.expr != nil && typ != nil)
+
+ if isUntyped(typ) {
+ // delay type and value recording until we know the type
+ // or until the end of type checking
+ check.rememberUntyped(x.expr, false, x.mode, typ.(*Basic), val)
+ } else {
+ check.recordTypeAndValue(e, x.mode, typ, val)
+ }
+
+ return kind
+}
+
+// exprInternal contains the core of type checking of expressions.
+// Must only be called by rawExpr.
+//
+func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
+ // make sure x has a valid state in case of bailout
+ // (was issue 5770)
+ x.mode = invalid
+ x.typ = Typ[Invalid]
+
+ switch e := e.(type) {
+ case *ast.BadExpr:
+ goto Error // error was reported before
+
+ case *ast.Ident:
+ check.ident(x, e, nil, nil)
+
+ case *ast.Ellipsis:
+ // ellipses are handled explicitly where they are legal
+ // (array composite literals and parameter lists)
+ check.error(e.Pos(), "invalid use of '...'")
+ goto Error
+
+ case *ast.BasicLit:
+ x.setConst(e.Kind, e.Value)
+ if x.mode == invalid {
+ check.invalidAST(e.Pos(), "invalid literal %v", e.Value)
+ goto Error
+ }
+
+ case *ast.FuncLit:
+ if sig, ok := check.typ(e.Type).(*Signature); ok {
+ // Anonymous functions are considered part of the
+ // init expression/func declaration which contains
+ // them: use existing package-level declaration info.
+ check.funcBody(check.decl, "", sig, e.Body)
+ x.mode = value
+ x.typ = sig
+ } else {
+ check.invalidAST(e.Pos(), "invalid function literal %s", e)
+ goto Error
+ }
+
+ case *ast.CompositeLit:
+ typ := hint
+ openArray := false
+ if e.Type != nil {
+ // [...]T array types may only appear with composite literals.
+ // Check for them here so we don't have to handle ... in general.
+ typ = nil
+ if atyp, _ := e.Type.(*ast.ArrayType); atyp != nil && atyp.Len != nil {
+ if ellip, _ := atyp.Len.(*ast.Ellipsis); ellip != nil && ellip.Elt == nil {
+ // We have an "open" [...]T array type.
+ // Create a new ArrayType with unknown length (-1)
+ // and finish setting it up after analyzing the literal.
+ typ = &Array{len: -1, elem: check.typ(atyp.Elt)}
+ openArray = true
+ }
+ }
+ if typ == nil {
+ typ = check.typ(e.Type)
+ }
+ }
+ if typ == nil {
+ // TODO(gri) provide better error messages depending on context
+ check.error(e.Pos(), "missing type in composite literal")
+ goto Error
+ }
+
+ switch typ, _ := deref(typ); utyp := typ.Underlying().(type) {
+ case *Struct:
+ if len(e.Elts) == 0 {
+ break
+ }
+ fields := utyp.fields
+ if _, ok := e.Elts[0].(*ast.KeyValueExpr); ok {
+ // all elements must have keys
+ visited := make([]bool, len(fields))
+ for _, e := range e.Elts {
+ kv, _ := e.(*ast.KeyValueExpr)
+ if kv == nil {
+ check.error(e.Pos(), "mixture of field:value and value elements in struct literal")
+ continue
+ }
+ key, _ := kv.Key.(*ast.Ident)
+ if key == nil {
+ check.errorf(kv.Pos(), "invalid field name %s in struct literal", kv.Key)
+ continue
+ }
+ i := fieldIndex(utyp.fields, check.pkg, key.Name)
+ if i < 0 {
+ check.errorf(kv.Pos(), "unknown field %s in struct literal", key.Name)
+ continue
+ }
+ fld := fields[i]
+ check.recordUse(key, fld)
+ // 0 <= i < len(fields)
+ if visited[i] {
+ check.errorf(kv.Pos(), "duplicate field name %s in struct literal", key.Name)
+ continue
+ }
+ visited[i] = true
+ check.expr(x, kv.Value)
+ etyp := fld.typ
+ if !check.assignment(x, etyp) {
+ if x.mode != invalid {
+ check.errorf(x.pos(), "cannot use %s as %s value in struct literal", x, etyp)
+ }
+ continue
+ }
+ }
+ } else {
+ // no element must have a key
+ for i, e := range e.Elts {
+ if kv, _ := e.(*ast.KeyValueExpr); kv != nil {
+ check.error(kv.Pos(), "mixture of field:value and value elements in struct literal")
+ continue
+ }
+ check.expr(x, e)
+ if i >= len(fields) {
+ check.error(x.pos(), "too many values in struct literal")
+ break // cannot continue
+ }
+ // i < len(fields)
+ fld := fields[i]
+ if !fld.Exported() && fld.pkg != check.pkg {
+ check.errorf(x.pos(), "implicit assignment to unexported field %s in %s literal", fld.name, typ)
+ continue
+ }
+ etyp := fld.typ
+ if !check.assignment(x, etyp) {
+ if x.mode != invalid {
+ check.errorf(x.pos(), "cannot use %s as %s value in struct literal", x, etyp)
+ }
+ continue
+ }
+ }
+ if len(e.Elts) < len(fields) {
+ check.error(e.Rbrace, "too few values in struct literal")
+ // ok to continue
+ }
+ }
+
+ case *Array:
+ n := check.indexedElts(e.Elts, utyp.elem, utyp.len)
+ // if we have an "open" [...]T array, set the length now that we know it
+ if openArray {
+ utyp.len = n
+ }
+
+ case *Slice:
+ check.indexedElts(e.Elts, utyp.elem, -1)
+
+ case *Map:
+ visited := make(map[interface{}][]Type, len(e.Elts))
+ for _, e := range e.Elts {
+ kv, _ := e.(*ast.KeyValueExpr)
+ if kv == nil {
+ check.error(e.Pos(), "missing key in map literal")
+ continue
+ }
+ check.exprWithHint(x, kv.Key, utyp.key)
+ if !check.assignment(x, utyp.key) {
+ if x.mode != invalid {
+ check.errorf(x.pos(), "cannot use %s as %s key in map literal", x, utyp.key)
+ }
+ continue
+ }
+ if x.mode == constant {
+ duplicate := false
+ // if the key is of interface type, the type is also significant when checking for duplicates
+ if _, ok := utyp.key.Underlying().(*Interface); ok {
+ for _, vtyp := range visited[x.val] {
+ if Identical(vtyp, x.typ) {
+ duplicate = true
+ break
+ }
+ }
+ visited[x.val] = append(visited[x.val], x.typ)
+ } else {
+ _, duplicate = visited[x.val]
+ visited[x.val] = nil
+ }
+ if duplicate {
+ check.errorf(x.pos(), "duplicate key %s in map literal", x.val)
+ continue
+ }
+ }
+ check.exprWithHint(x, kv.Value, utyp.elem)
+ if !check.assignment(x, utyp.elem) {
+ if x.mode != invalid {
+ check.errorf(x.pos(), "cannot use %s as %s value in map literal", x, utyp.elem)
+ }
+ continue
+ }
+ }
+
+ default:
+ // if utyp is invalid, an error was reported before
+ if utyp != Typ[Invalid] {
+ check.errorf(e.Pos(), "invalid composite literal type %s", typ)
+ goto Error
+ }
+ }
+
+ x.mode = value
+ x.typ = typ
+
+ case *ast.ParenExpr:
+ kind := check.rawExpr(x, e.X, nil)
+ x.expr = e
+ return kind
+
+ case *ast.SelectorExpr:
+ check.selector(x, e)
+
+ case *ast.IndexExpr:
+ check.expr(x, e.X)
+ if x.mode == invalid {
+ goto Error
+ }
+
+ valid := false
+ length := int64(-1) // valid if >= 0
+ switch typ := x.typ.Underlying().(type) {
+ case *Basic:
+ if isString(typ) {
+ valid = true
+ if x.mode == constant {
+ length = int64(len(exact.StringVal(x.val)))
+ }
+ // an indexed string always yields a byte value
+ // (not a constant) even if the string and the
+ // index are constant
+ x.mode = value
+ x.typ = universeByte // use 'byte' name
+ }
+
+ case *Array:
+ valid = true
+ length = typ.len
+ if x.mode != variable {
+ x.mode = value
+ }
+ x.typ = typ.elem
+
+ case *Pointer:
+ if typ, _ := typ.base.Underlying().(*Array); typ != nil {
+ valid = true
+ length = typ.len
+ x.mode = variable
+ x.typ = typ.elem
+ }
+
+ case *Slice:
+ valid = true
+ x.mode = variable
+ x.typ = typ.elem
+
+ case *Map:
+ var key operand
+ check.expr(&key, e.Index)
+ if !check.assignment(&key, typ.key) {
+ if key.mode != invalid {
+ check.invalidOp(key.pos(), "cannot use %s as map index of type %s", &key, typ.key)
+ }
+ goto Error
+ }
+ x.mode = mapindex
+ x.typ = typ.elem
+ x.expr = e
+ return expression
+ }
+
+ if !valid {
+ check.invalidOp(x.pos(), "cannot index %s", x)
+ goto Error
+ }
+
+ if e.Index == nil {
+ check.invalidAST(e.Pos(), "missing index for %s", x)
+ goto Error
+ }
+
+ check.index(e.Index, length)
+ // ok to continue
+
+ case *ast.SliceExpr:
+ check.expr(x, e.X)
+ if x.mode == invalid {
+ goto Error
+ }
+
+ valid := false
+ length := int64(-1) // valid if >= 0
+ switch typ := x.typ.Underlying().(type) {
+ case *Basic:
+ if isString(typ) {
+ if slice3(e) {
+ check.invalidOp(x.pos(), "3-index slice of string")
+ goto Error
+ }
+ valid = true
+ if x.mode == constant {
+ length = int64(len(exact.StringVal(x.val)))
+ }
+ // spec: "For untyped string operands the result
+ // is a non-constant value of type string."
+ if typ.kind == UntypedString {
+ x.typ = Typ[String]
+ }
+ }
+
+ case *Array:
+ valid = true
+ length = typ.len
+ if x.mode != variable {
+ check.invalidOp(x.pos(), "cannot slice %s (value not addressable)", x)
+ goto Error
+ }
+ x.typ = &Slice{elem: typ.elem}
+
+ case *Pointer:
+ if typ, _ := typ.base.Underlying().(*Array); typ != nil {
+ valid = true
+ length = typ.len
+ x.typ = &Slice{elem: typ.elem}
+ }
+
+ case *Slice:
+ valid = true
+ // x.typ doesn't change
+ }
+
+ if !valid {
+ check.invalidOp(x.pos(), "cannot slice %s", x)
+ goto Error
+ }
+
+ x.mode = value
+
+ // spec: "Only the first index may be omitted; it defaults to 0."
+ if slice3(e) && (e.High == nil || sliceMax(e) == nil) {
+ check.error(e.Rbrack, "2nd and 3rd index required in 3-index slice")
+ goto Error
+ }
+
+ // check indices
+ var ind [3]int64
+ for i, expr := range []ast.Expr{e.Low, e.High, sliceMax(e)} {
+ x := int64(-1)
+ switch {
+ case expr != nil:
+ // The "capacity" is only known statically for strings, arrays,
+ // and pointers to arrays, and it is the same as the length for
+ // those types.
+ max := int64(-1)
+ if length >= 0 {
+ max = length + 1
+ }
+ if t, ok := check.index(expr, max); ok && t >= 0 {
+ x = t
+ }
+ case i == 0:
+ // default is 0 for the first index
+ x = 0
+ case length >= 0:
+ // default is length (== capacity) otherwise
+ x = length
+ }
+ ind[i] = x
+ }
+
+ // constant indices must be in range
+ // (check.index already checks that existing indices >= 0)
+ L:
+ for i, x := range ind[:len(ind)-1] {
+ if x > 0 {
+ for _, y := range ind[i+1:] {
+ if y >= 0 && x > y {
+ check.errorf(e.Rbrack, "invalid slice indices: %d > %d", x, y)
+ break L // only report one error, ok to continue
+ }
+ }
+ }
+ }
+
+ case *ast.TypeAssertExpr:
+ check.expr(x, e.X)
+ if x.mode == invalid {
+ goto Error
+ }
+ xtyp, _ := x.typ.Underlying().(*Interface)
+ if xtyp == nil {
+ check.invalidOp(x.pos(), "%s is not an interface", x)
+ goto Error
+ }
+ // x.(type) expressions are handled explicitly in type switches
+ if e.Type == nil {
+ check.invalidAST(e.Pos(), "use of .(type) outside type switch")
+ goto Error
+ }
+ T := check.typ(e.Type)
+ if T == Typ[Invalid] {
+ goto Error
+ }
+ check.typeAssertion(x.pos(), x, xtyp, T)
+ x.mode = commaok
+ x.typ = T
+
+ case *ast.CallExpr:
+ return check.call(x, e)
+
+ case *ast.StarExpr:
+ check.exprOrType(x, e.X)
+ switch x.mode {
+ case invalid:
+ goto Error
+ case typexpr:
+ x.typ = &Pointer{base: x.typ}
+ default:
+ if typ, ok := x.typ.Underlying().(*Pointer); ok {
+ x.mode = variable
+ x.typ = typ.base
+ } else {
+ check.invalidOp(x.pos(), "cannot indirect %s", x)
+ goto Error
+ }
+ }
+
+ case *ast.UnaryExpr:
+ check.expr(x, e.X)
+ if x.mode == invalid {
+ goto Error
+ }
+ check.unary(x, e, e.Op)
+ if x.mode == invalid {
+ goto Error
+ }
+ if e.Op == token.ARROW {
+ x.expr = e
+ return statement // receive operations may appear in statement context
+ }
+
+ case *ast.BinaryExpr:
+ check.binary(x, e, e.X, e.Y, e.Op)
+ if x.mode == invalid {
+ goto Error
+ }
+
+ case *ast.KeyValueExpr:
+ // key:value expressions are handled in composite literals
+ check.invalidAST(e.Pos(), "no key:value expected")
+ goto Error
+
+ case *ast.ArrayType, *ast.StructType, *ast.FuncType,
+ *ast.InterfaceType, *ast.MapType, *ast.ChanType:
+ x.mode = typexpr
+ x.typ = check.typ(e)
+ // Note: rawExpr (caller of exprInternal) will call check.recordTypeAndValue
+ // even though check.typ has already called it. This is fine as both
+ // times the same expression and type are recorded. It is also not a
+ // performance issue because we only reach here for composite literal
+ // types, which are comparatively rare.
+
+ default:
+ panic(fmt.Sprintf("%s: unknown expression type %T", check.fset.Position(e.Pos()), e))
+ }
+
+ // everything went well
+ x.expr = e
+ return expression
+
+Error:
+ x.mode = invalid
+ x.expr = e
+ return statement // avoid follow-up errors
+}
+
+// typeAssertion checks that x.(T) is legal; xtyp must be the type of x.
+func (check *Checker) typeAssertion(pos token.Pos, x *operand, xtyp *Interface, T Type) {
+ method, wrongType := assertableTo(xtyp, T)
+ if method == nil {
+ return
+ }
+
+ var msg string
+ if wrongType {
+ msg = "wrong type for method"
+ } else {
+ msg = "missing method"
+ }
+ check.errorf(pos, "%s cannot have dynamic type %s (%s %s)", x, T, msg, method.name)
+}
+
+// expr typechecks expression e and initializes x with the expression value.
+// If an error occurred, x.mode is set to invalid.
+//
+func (check *Checker) expr(x *operand, e ast.Expr) {
+ check.rawExpr(x, e, nil)
+ var msg string
+ switch x.mode {
+ default:
+ return
+ case novalue:
+ msg = "used as value"
+ case builtin:
+ msg = "must be called"
+ case typexpr:
+ msg = "is not an expression"
+ }
+ check.errorf(x.pos(), "%s %s", x, msg)
+ x.mode = invalid
+}
+
+// exprWithHint typechecks expression e and initializes x with the expression value.
+// If an error occurred, x.mode is set to invalid.
+// If hint != nil, it is the type of a composite literal element.
+//
+func (check *Checker) exprWithHint(x *operand, e ast.Expr, hint Type) {
+ assert(hint != nil)
+ check.rawExpr(x, e, hint)
+ var msg string
+ switch x.mode {
+ default:
+ return
+ case novalue:
+ msg = "used as value"
+ case builtin:
+ msg = "must be called"
+ case typexpr:
+ msg = "is not an expression"
+ }
+ check.errorf(x.pos(), "%s %s", x, msg)
+ x.mode = invalid
+}
+
+// exprOrType typechecks expression or type e and initializes x with the expression value or type.
+// If an error occurred, x.mode is set to invalid.
+//
+func (check *Checker) exprOrType(x *operand, e ast.Expr) {
+ check.rawExpr(x, e, nil)
+ if x.mode == novalue {
+ check.errorf(x.pos(), "%s used as value or type", x)
+ x.mode = invalid
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/exprstring.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/exprstring.go
new file mode 100644
index 0000000000..370bdf3532
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/exprstring.go
@@ -0,0 +1,220 @@
+// 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.
+
+// This file implements printing of expressions.
+
+package types
+
+import (
+ "bytes"
+ "go/ast"
+)
+
+// ExprString returns the (possibly simplified) string representation for x.
+func ExprString(x ast.Expr) string {
+ var buf bytes.Buffer
+ WriteExpr(&buf, x)
+ return buf.String()
+}
+
+// WriteExpr writes the (possibly simplified) string representation for x to buf.
+func WriteExpr(buf *bytes.Buffer, x ast.Expr) {
+ // The AST preserves source-level parentheses so there is
+ // no need to introduce them here to correct for different
+ // operator precedences. (This assumes that the AST was
+ // generated by a Go parser.)
+
+ switch x := x.(type) {
+ default:
+ buf.WriteString("(bad expr)") // nil, ast.BadExpr, ast.KeyValueExpr
+
+ case *ast.Ident:
+ buf.WriteString(x.Name)
+
+ case *ast.Ellipsis:
+ buf.WriteString("...")
+ if x.Elt != nil {
+ WriteExpr(buf, x.Elt)
+ }
+
+ case *ast.BasicLit:
+ buf.WriteString(x.Value)
+
+ case *ast.FuncLit:
+ buf.WriteByte('(')
+ WriteExpr(buf, x.Type)
+ buf.WriteString(" literal)") // simplified
+
+ case *ast.CompositeLit:
+ buf.WriteByte('(')
+ WriteExpr(buf, x.Type)
+ buf.WriteString(" literal)") // simplified
+
+ case *ast.ParenExpr:
+ buf.WriteByte('(')
+ WriteExpr(buf, x.X)
+ buf.WriteByte(')')
+
+ case *ast.SelectorExpr:
+ WriteExpr(buf, x.X)
+ buf.WriteByte('.')
+ buf.WriteString(x.Sel.Name)
+
+ case *ast.IndexExpr:
+ WriteExpr(buf, x.X)
+ buf.WriteByte('[')
+ WriteExpr(buf, x.Index)
+ buf.WriteByte(']')
+
+ case *ast.SliceExpr:
+ WriteExpr(buf, x.X)
+ buf.WriteByte('[')
+ if x.Low != nil {
+ WriteExpr(buf, x.Low)
+ }
+ buf.WriteByte(':')
+ if x.High != nil {
+ WriteExpr(buf, x.High)
+ }
+ if x.Slice3 {
+ buf.WriteByte(':')
+ if x.Max != nil {
+ WriteExpr(buf, x.Max)
+ }
+ }
+ buf.WriteByte(']')
+
+ case *ast.TypeAssertExpr:
+ WriteExpr(buf, x.X)
+ buf.WriteString(".(")
+ WriteExpr(buf, x.Type)
+ buf.WriteByte(')')
+
+ case *ast.CallExpr:
+ WriteExpr(buf, x.Fun)
+ buf.WriteByte('(')
+ for i, arg := range x.Args {
+ if i > 0 {
+ buf.WriteString(", ")
+ }
+ WriteExpr(buf, arg)
+ }
+ if x.Ellipsis.IsValid() {
+ buf.WriteString("...")
+ }
+ buf.WriteByte(')')
+
+ case *ast.StarExpr:
+ buf.WriteByte('*')
+ WriteExpr(buf, x.X)
+
+ case *ast.UnaryExpr:
+ buf.WriteString(x.Op.String())
+ WriteExpr(buf, x.X)
+
+ case *ast.BinaryExpr:
+ WriteExpr(buf, x.X)
+ buf.WriteByte(' ')
+ buf.WriteString(x.Op.String())
+ buf.WriteByte(' ')
+ WriteExpr(buf, x.Y)
+
+ case *ast.ArrayType:
+ buf.WriteByte('[')
+ if x.Len != nil {
+ WriteExpr(buf, x.Len)
+ }
+ buf.WriteByte(']')
+ WriteExpr(buf, x.Elt)
+
+ case *ast.StructType:
+ buf.WriteString("struct{")
+ writeFieldList(buf, x.Fields, "; ", false)
+ buf.WriteByte('}')
+
+ case *ast.FuncType:
+ buf.WriteString("func")
+ writeSigExpr(buf, x)
+
+ case *ast.InterfaceType:
+ buf.WriteString("interface{")
+ writeFieldList(buf, x.Methods, "; ", true)
+ buf.WriteByte('}')
+
+ case *ast.MapType:
+ buf.WriteString("map[")
+ WriteExpr(buf, x.Key)
+ buf.WriteByte(']')
+ WriteExpr(buf, x.Value)
+
+ case *ast.ChanType:
+ var s string
+ switch x.Dir {
+ case ast.SEND:
+ s = "chan<- "
+ case ast.RECV:
+ s = "<-chan "
+ default:
+ s = "chan "
+ }
+ buf.WriteString(s)
+ WriteExpr(buf, x.Value)
+ }
+}
+
+func writeSigExpr(buf *bytes.Buffer, sig *ast.FuncType) {
+ buf.WriteByte('(')
+ writeFieldList(buf, sig.Params, ", ", false)
+ buf.WriteByte(')')
+
+ res := sig.Results
+ n := res.NumFields()
+ if n == 0 {
+ // no result
+ return
+ }
+
+ buf.WriteByte(' ')
+ if n == 1 && len(res.List[0].Names) == 0 {
+ // single unnamed result
+ WriteExpr(buf, res.List[0].Type)
+ return
+ }
+
+ // multiple or named result(s)
+ buf.WriteByte('(')
+ writeFieldList(buf, res, ", ", false)
+ buf.WriteByte(')')
+}
+
+func writeFieldList(buf *bytes.Buffer, fields *ast.FieldList, sep string, iface bool) {
+ for i, f := range fields.List {
+ if i > 0 {
+ buf.WriteString(sep)
+ }
+
+ // field list names
+ for i, name := range f.Names {
+ if i > 0 {
+ buf.WriteString(", ")
+ }
+ buf.WriteString(name.Name)
+ }
+
+ // types of interface methods consist of signatures only
+ if sig, _ := f.Type.(*ast.FuncType); sig != nil && iface {
+ writeSigExpr(buf, sig)
+ continue
+ }
+
+ // named fields are separated with a blank from the field type
+ if len(f.Names) > 0 {
+ buf.WriteByte(' ')
+ }
+
+ WriteExpr(buf, f.Type)
+
+ // ignore tag
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/exprstring_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/exprstring_test.go
new file mode 100644
index 0000000000..cfd1472216
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/exprstring_test.go
@@ -0,0 +1,94 @@
+// 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.
+
+package types_test
+
+import (
+ "go/parser"
+ "testing"
+
+ . "golang.org/x/tools/go/types"
+)
+
+var testExprs = []testEntry{
+ // basic type literals
+ dup("x"),
+ dup("true"),
+ dup("42"),
+ dup("3.1415"),
+ dup("2.71828i"),
+ dup(`'a'`),
+ dup(`"foo"`),
+ dup("`bar`"),
+
+ // func and composite literals
+ {"func(){}", "(func() literal)"},
+ {"func(x int) complex128 {}", "(func(x int) complex128 literal)"},
+ {"[]int{1, 2, 3}", "([]int literal)"},
+
+ // non-type expressions
+ dup("(x)"),
+ dup("x.f"),
+ dup("a[i]"),
+
+ dup("s[:]"),
+ dup("s[i:]"),
+ dup("s[:j]"),
+ dup("s[i:j]"),
+ dup("s[:j:k]"),
+ dup("s[i:j:k]"),
+
+ dup("x.(T)"),
+
+ dup("x.([10]int)"),
+ dup("x.([...]int)"),
+
+ dup("x.(struct{})"),
+ dup("x.(struct{x int; y, z float32; E})"),
+
+ dup("x.(func())"),
+ dup("x.(func(x int))"),
+ dup("x.(func() int)"),
+ dup("x.(func(x, y int, z float32) (r int))"),
+ dup("x.(func(a, b, c int))"),
+ dup("x.(func(x ...T))"),
+
+ dup("x.(interface{})"),
+ dup("x.(interface{m(); n(x int); E})"),
+ dup("x.(interface{m(); n(x int) T; E; F})"),
+
+ dup("x.(map[K]V)"),
+
+ dup("x.(chan E)"),
+ dup("x.(<-chan E)"),
+ dup("x.(chan<- chan int)"),
+ dup("x.(chan<- <-chan int)"),
+ dup("x.(<-chan chan int)"),
+ dup("x.(chan (<-chan int))"),
+
+ dup("f()"),
+ dup("f(x)"),
+ dup("int(x)"),
+ dup("f(x, x + y)"),
+ dup("f(s...)"),
+ dup("f(a, s...)"),
+
+ dup("*x"),
+ dup("&x"),
+ dup("x + y"),
+ dup("x + y << (2 * s)"),
+}
+
+func TestExprString(t *testing.T) {
+ for _, test := range testExprs {
+ x, err := parser.ParseExpr(test.src)
+ if err != nil {
+ t.Errorf("%s: %s", test.src, err)
+ continue
+ }
+ if got := ExprString(x); got != test.str {
+ t.Errorf("%s: got %s, want %s", test.src, got, test.str)
+ }
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/go11.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/go11.go
new file mode 100644
index 0000000000..cf41cabeea
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/go11.go
@@ -0,0 +1,17 @@
+// 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.2
+
+package types
+
+import "go/ast"
+
+func slice3(x *ast.SliceExpr) bool {
+ return false
+}
+
+func sliceMax(x *ast.SliceExpr) ast.Expr {
+ return nil
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/go12.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/go12.go
new file mode 100644
index 0000000000..2017442154
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/go12.go
@@ -0,0 +1,17 @@
+// 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.2
+
+package types
+
+import "go/ast"
+
+func slice3(x *ast.SliceExpr) bool {
+ return x.Slice3
+}
+
+func sliceMax(x *ast.SliceExpr) ast.Expr {
+ return x.Max
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/hilbert_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/hilbert_test.go
new file mode 100644
index 0000000000..b555721819
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/hilbert_test.go
@@ -0,0 +1,232 @@
+// 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.
+
+package types_test
+
+import (
+ "bytes"
+ "flag"
+ "fmt"
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "io/ioutil"
+ "testing"
+
+ . "golang.org/x/tools/go/types"
+)
+
+var (
+ H = flag.Int("H", 5, "Hilbert matrix size")
+ out = flag.String("out", "", "write generated program to out")
+)
+
+func TestHilbert(t *testing.T) {
+ // generate source
+ src := program(*H, *out)
+ if *out != "" {
+ ioutil.WriteFile(*out, src, 0666)
+ return
+ }
+
+ // parse source
+ fset := token.NewFileSet()
+ f, err := parser.ParseFile(fset, "hilbert.go", src, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // type-check file
+ DefPredeclaredTestFuncs() // define assert built-in
+ _, err = Check(f.Name.Name, fset, []*ast.File{f})
+ if err != nil {
+ t.Fatal(err)
+ }
+}
+
+func program(n int, out string) []byte {
+ var g gen
+
+ g.p(`// WARNING: GENERATED FILE - DO NOT MODIFY MANUALLY!
+// (To generate, in go/types directory: go test -run=Hilbert -H=%d -out=%q)
+
+// This program tests arbitrary precision constant arithmetic
+// by generating the constant elements of a Hilbert matrix H,
+// its inverse I, and the product P = H*I. The product should
+// be the identity matrix.
+package main
+
+func main() {
+ if !ok {
+ printProduct()
+ return
+ }
+ println("PASS")
+}
+
+`, n, out)
+ g.hilbert(n)
+ g.inverse(n)
+ g.product(n)
+ g.verify(n)
+ g.printProduct(n)
+ g.binomials(2*n - 1)
+ g.factorials(2*n - 1)
+
+ return g.Bytes()
+}
+
+type gen struct {
+ bytes.Buffer
+}
+
+func (g *gen) p(format string, args ...interface{}) {
+ fmt.Fprintf(&g.Buffer, format, args...)
+}
+
+func (g *gen) hilbert(n int) {
+ g.p(`// Hilbert matrix, n = %d
+const (
+`, n)
+ for i := 0; i < n; i++ {
+ g.p("\t")
+ for j := 0; j < n; j++ {
+ if j > 0 {
+ g.p(", ")
+ }
+ g.p("h%d_%d", i, j)
+ }
+ if i == 0 {
+ g.p(" = ")
+ for j := 0; j < n; j++ {
+ if j > 0 {
+ g.p(", ")
+ }
+ g.p("1.0/(iota + %d)", j+1)
+ }
+ }
+ g.p("\n")
+ }
+ g.p(")\n\n")
+}
+
+func (g *gen) inverse(n int) {
+ g.p(`// Inverse Hilbert matrix
+const (
+`)
+ for i := 0; i < n; i++ {
+ for j := 0; j < n; j++ {
+ s := "+"
+ if (i+j)&1 != 0 {
+ s = "-"
+ }
+ g.p("\ti%d_%d = %s%d * b%d_%d * b%d_%d * b%d_%d * b%d_%d\n",
+ i, j, s, i+j+1, n+i, n-j-1, n+j, n-i-1, i+j, i, i+j, i)
+ }
+ g.p("\n")
+ }
+ g.p(")\n\n")
+}
+
+func (g *gen) product(n int) {
+ g.p(`// Product matrix
+const (
+`)
+ for i := 0; i < n; i++ {
+ for j := 0; j < n; j++ {
+ g.p("\tp%d_%d = ", i, j)
+ for k := 0; k < n; k++ {
+ if k > 0 {
+ g.p(" + ")
+ }
+ g.p("h%d_%d*i%d_%d", i, k, k, j)
+ }
+ g.p("\n")
+ }
+ g.p("\n")
+ }
+ g.p(")\n\n")
+}
+
+func (g *gen) verify(n int) {
+ g.p(`// Verify that product is the identity matrix
+const ok =
+`)
+ for i := 0; i < n; i++ {
+ for j := 0; j < n; j++ {
+ if j == 0 {
+ g.p("\t")
+ } else {
+ g.p(" && ")
+ }
+ v := 0
+ if i == j {
+ v = 1
+ }
+ g.p("p%d_%d == %d", i, j, v)
+ }
+ g.p(" &&\n")
+ }
+ g.p("\ttrue\n\n")
+
+ // verify ok at type-check time
+ if *out == "" {
+ g.p("const _ = assert(ok)\n\n")
+ }
+}
+
+func (g *gen) printProduct(n int) {
+ g.p("func printProduct() {\n")
+ for i := 0; i < n; i++ {
+ g.p("\tprintln(")
+ for j := 0; j < n; j++ {
+ if j > 0 {
+ g.p(", ")
+ }
+ g.p("p%d_%d", i, j)
+ }
+ g.p(")\n")
+ }
+ g.p("}\n\n")
+}
+
+func (g *gen) mulRange(a, b int) {
+ if a > b {
+ g.p("1")
+ return
+ }
+ for i := a; i <= b; i++ {
+ if i > a {
+ g.p("*")
+ }
+ g.p("%d", i)
+ }
+}
+
+func (g *gen) binomials(n int) {
+ g.p(`// Binomials
+const (
+`)
+ for j := 0; j <= n; j++ {
+ if j > 0 {
+ g.p("\n")
+ }
+ for k := 0; k <= j; k++ {
+ g.p("\tb%d_%d = f%d / (f%d*f%d)\n", j, k, j, k, j-k)
+ }
+ }
+ g.p(")\n\n")
+}
+
+func (g *gen) factorials(n int) {
+ g.p(`// Factorials
+const (
+ f0 = 1
+ f1 = 1
+`)
+ for i := 2; i <= n; i++ {
+ g.p("\tf%d = f%d * %d\n", i, i-1, i)
+ }
+ g.p(")\n\n")
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/initorder.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/initorder.go
new file mode 100644
index 0000000000..0fd567b269
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/initorder.go
@@ -0,0 +1,222 @@
+// Copyright 2014 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.
+
+package types
+
+import (
+ "container/heap"
+ "fmt"
+)
+
+// initOrder computes the Info.InitOrder for package variables.
+func (check *Checker) initOrder() {
+ // An InitOrder may already have been computed if a package is
+ // built from several calls to (*Checker).Files. Clear it.
+ check.Info.InitOrder = check.Info.InitOrder[:0]
+
+ // compute the object dependency graph and
+ // initialize a priority queue with the list
+ // of graph nodes
+ pq := nodeQueue(dependencyGraph(check.objMap))
+ heap.Init(&pq)
+
+ const debug = false
+ if debug {
+ fmt.Printf("package %s: object dependency graph\n", check.pkg.Name())
+ for _, n := range pq {
+ for _, o := range n.out {
+ fmt.Printf("\t%s -> %s\n", n.obj.Name(), o.obj.Name())
+ }
+ }
+ fmt.Println()
+ fmt.Printf("package %s: initialization order\n", check.pkg.Name())
+ }
+
+ // determine initialization order by removing the highest priority node
+ // (the one with the fewest dependencies) and its edges from the graph,
+ // repeatedly, until there are no nodes left.
+ // In a valid Go program, those nodes always have zero dependencies (after
+ // removing all incoming dependencies), otherwise there are initialization
+ // cycles.
+ mark := 0
+ emitted := make(map[*declInfo]bool)
+ for len(pq) > 0 {
+ // get the next node
+ n := heap.Pop(&pq).(*objNode)
+
+ // if n still depends on other nodes, we have a cycle
+ if n.in > 0 {
+ mark++ // mark nodes using a different value each time
+ cycle := findPath(n, n, mark)
+ if i := valIndex(cycle); i >= 0 {
+ check.reportCycle(cycle, i)
+ }
+ // ok to continue, but the variable initialization order
+ // will be incorrect at this point since it assumes no
+ // cycle errors
+ }
+
+ // reduce dependency count of all dependent nodes
+ // and update priority queue
+ for _, out := range n.out {
+ out.in--
+ heap.Fix(&pq, out.index)
+ }
+
+ // record the init order for variables with initializers only
+ v, _ := n.obj.(*Var)
+ info := check.objMap[v]
+ if v == nil || !info.hasInitializer() {
+ continue
+ }
+
+ // n:1 variable declarations such as: a, b = f()
+ // introduce a node for each lhs variable (here: a, b);
+ // but they all have the same initializer - emit only
+ // one, for the first variable seen
+ if emitted[info] {
+ continue // initializer already emitted, if any
+ }
+ emitted[info] = true
+
+ infoLhs := info.lhs // possibly nil (see declInfo.lhs field comment)
+ if infoLhs == nil {
+ infoLhs = []*Var{v}
+ }
+ init := &Initializer{infoLhs, info.init}
+ check.Info.InitOrder = append(check.Info.InitOrder, init)
+
+ if debug {
+ fmt.Printf("\t%s\n", init)
+ }
+ }
+
+ if debug {
+ fmt.Println()
+ }
+}
+
+// findPath returns the (reversed) list of nodes z, ... c, b, a,
+// such that there is a path (list of edges) from a to z.
+// If there is no such path, the result is nil.
+// Nodes marked with the value mark are considered "visited";
+// unvisited nodes are marked during the graph search.
+func findPath(a, z *objNode, mark int) []*objNode {
+ if a.mark == mark {
+ return nil // node already seen
+ }
+ a.mark = mark
+
+ for _, n := range a.out {
+ if n == z {
+ return []*objNode{z}
+ }
+ if P := findPath(n, z, mark); P != nil {
+ return append(P, n)
+ }
+ }
+
+ return nil
+}
+
+// valIndex returns the index of the first constant or variable in a,
+// if any; or a value < 0.
+func valIndex(a []*objNode) int {
+ for i, n := range a {
+ switch n.obj.(type) {
+ case *Const, *Var:
+ return i
+ }
+ }
+ return -1
+}
+
+// reportCycle reports an error for the cycle starting at i.
+func (check *Checker) reportCycle(cycle []*objNode, i int) {
+ obj := cycle[i].obj
+ check.errorf(obj.Pos(), "initialization cycle for %s", obj.Name())
+ // print cycle
+ for _ = range cycle {
+ check.errorf(obj.Pos(), "\t%s refers to", obj.Name()) // secondary error, \t indented
+ i++
+ if i >= len(cycle) {
+ i = 0
+ }
+ obj = cycle[i].obj
+ }
+ check.errorf(obj.Pos(), "\t%s", obj.Name())
+}
+
+// An objNode represents a node in the object dependency graph.
+// Each node b in a.out represents an edge a->b indicating that
+// b depends on a.
+// Nodes may be marked for cycle detection. A node n is marked
+// if n.mark corresponds to the current mark value.
+type objNode struct {
+ obj Object // object represented by this node
+ in int // number of nodes this node depends on
+ out []*objNode // list of nodes that depend on this node
+ index int // node index in list of nodes
+ mark int // for cycle detection
+}
+
+// dependencyGraph computes the transposed object dependency graph
+// from the given objMap. The transposed graph is returned as a list
+// of nodes; an edge d->n indicates that node n depends on node d.
+func dependencyGraph(objMap map[Object]*declInfo) []*objNode {
+ // M maps each object to its corresponding node
+ M := make(map[Object]*objNode, len(objMap))
+ for obj := range objMap {
+ M[obj] = &objNode{obj: obj}
+ }
+
+ // G is the graph of nodes n
+ G := make([]*objNode, len(M))
+ i := 0
+ for obj, n := range M {
+ deps := objMap[obj].deps
+ n.in = len(deps)
+ for d := range deps {
+ d := M[d] // node n depends on node d
+ d.out = append(d.out, n) // add edge d->n
+ }
+
+ G[i] = n
+ n.index = i
+ i++
+ }
+
+ return G
+}
+
+// nodeQueue implements the container/heap interface;
+// a nodeQueue may be used as a priority queue.
+type nodeQueue []*objNode
+
+func (a nodeQueue) Len() int { return len(a) }
+
+func (a nodeQueue) Swap(i, j int) {
+ x, y := a[i], a[j]
+ a[i], a[j] = y, x
+ x.index, y.index = j, i
+}
+
+func (a nodeQueue) Less(i, j int) bool {
+ x, y := a[i], a[j]
+ // nodes are prioritized by number of incoming dependencies (1st key)
+ // and source order (2nd key)
+ return x.in < y.in || x.in == y.in && x.obj.order() < y.obj.order()
+}
+
+func (a *nodeQueue) Push(x interface{}) {
+ panic("unreachable")
+}
+
+func (a *nodeQueue) Pop() interface{} {
+ n := len(*a)
+ x := (*a)[n-1]
+ x.index = -1 // for safety
+ *a = (*a)[:n-1]
+ return x
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/issues_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/issues_test.go
new file mode 100644
index 0000000000..04d8b37192
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/issues_test.go
@@ -0,0 +1,205 @@
+// 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.
+
+// This file implements tests for various issues.
+
+package types_test
+
+import (
+ "fmt"
+ "go/ast"
+ "go/parser"
+ "sort"
+ "strings"
+ "testing"
+
+ _ "golang.org/x/tools/go/gcimporter"
+ . "golang.org/x/tools/go/types"
+)
+
+func TestIssue5770(t *testing.T) {
+ src := `package p; type S struct{T}`
+ f, err := parser.ParseFile(fset, "", src, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ _, err = Check(f.Name.Name, fset, []*ast.File{f}) // do not crash
+ want := "undeclared name: T"
+ if err == nil || !strings.Contains(err.Error(), want) {
+ t.Errorf("got: %v; want: %s", err, want)
+ }
+}
+
+func TestIssue5849(t *testing.T) {
+ src := `
+package p
+var (
+ s uint
+ _ = uint8(8)
+ _ = uint16(16) << s
+ _ = uint32(32 << s)
+ _ = uint64(64 << s + s)
+ _ = (interface{})("foo")
+ _ = (interface{})(nil)
+)`
+ f, err := parser.ParseFile(fset, "", src, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ var conf Config
+ types := make(map[ast.Expr]TypeAndValue)
+ _, err = conf.Check(f.Name.Name, fset, []*ast.File{f}, &Info{Types: types})
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ for x, tv := range types {
+ var want Type
+ switch x := x.(type) {
+ case *ast.BasicLit:
+ switch x.Value {
+ case `8`:
+ want = Typ[Uint8]
+ case `16`:
+ want = Typ[Uint16]
+ case `32`:
+ want = Typ[Uint32]
+ case `64`:
+ want = Typ[Uint] // because of "+ s", s is of type uint
+ case `"foo"`:
+ want = Typ[String]
+ }
+ case *ast.Ident:
+ if x.Name == "nil" {
+ want = Typ[UntypedNil]
+ }
+ }
+ if want != nil && !Identical(tv.Type, want) {
+ t.Errorf("got %s; want %s", tv.Type, want)
+ }
+ }
+}
+
+func TestIssue6413(t *testing.T) {
+ src := `
+package p
+func f() int {
+ defer f()
+ go f()
+ return 0
+}
+`
+ f, err := parser.ParseFile(fset, "", src, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ var conf Config
+ types := make(map[ast.Expr]TypeAndValue)
+ _, err = conf.Check(f.Name.Name, fset, []*ast.File{f}, &Info{Types: types})
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ want := Typ[Int]
+ n := 0
+ for x, tv := range types {
+ if _, ok := x.(*ast.CallExpr); ok {
+ if tv.Type != want {
+ t.Errorf("%s: got %s; want %s", fset.Position(x.Pos()), tv.Type, want)
+ }
+ n++
+ }
+ }
+
+ if n != 2 {
+ t.Errorf("got %d CallExprs; want 2", n)
+ }
+}
+
+func TestIssue7245(t *testing.T) {
+ src := `
+package p
+func (T) m() (res bool) { return }
+type T struct{} // receiver type after method declaration
+`
+ f, err := parser.ParseFile(fset, "", src, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ var conf Config
+ defs := make(map[*ast.Ident]Object)
+ _, err = conf.Check(f.Name.Name, fset, []*ast.File{f}, &Info{Defs: defs})
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ m := f.Decls[0].(*ast.FuncDecl)
+ res1 := defs[m.Name].(*Func).Type().(*Signature).Results().At(0)
+ res2 := defs[m.Type.Results.List[0].Names[0]].(*Var)
+
+ if res1 != res2 {
+ t.Errorf("got %s (%p) != %s (%p)", res1, res2, res1, res2)
+ }
+}
+
+// This tests that uses of existing vars on the LHS of an assignment
+// are Uses, not Defs; and also that the (illegal) use of a non-var on
+// the LHS of an assignment is a Use nonetheless.
+func TestIssue7827(t *testing.T) {
+ const src = `
+package p
+func _() {
+ const w = 1 // defs w
+ x, y := 2, 3 // defs x, y
+ w, x, z := 4, 5, 6 // uses w, x, defs z; error: cannot assign to w
+ _, _, _ = x, y, z // uses x, y, z
+}
+`
+ const want = `L3 defs func p._()
+L4 defs const w untyped int
+L5 defs var x int
+L5 defs var y int
+L6 defs var z int
+L6 uses const w untyped int
+L6 uses var x int
+L7 uses var x int
+L7 uses var y int
+L7 uses var z int`
+
+ f, err := parser.ParseFile(fset, "", src, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // don't abort at the first error
+ conf := Config{Error: func(err error) { t.Log(err) }}
+ defs := make(map[*ast.Ident]Object)
+ uses := make(map[*ast.Ident]Object)
+ _, err = conf.Check(f.Name.Name, fset, []*ast.File{f}, &Info{Defs: defs, Uses: uses})
+ if s := fmt.Sprint(err); !strings.HasSuffix(s, "cannot assign to w") {
+ t.Errorf("Check: unexpected error: %s", s)
+ }
+
+ var facts []string
+ for id, obj := range defs {
+ if obj != nil {
+ fact := fmt.Sprintf("L%d defs %s", fset.Position(id.Pos()).Line, obj)
+ facts = append(facts, fact)
+ }
+ }
+ for id, obj := range uses {
+ fact := fmt.Sprintf("L%d uses %s", fset.Position(id.Pos()).Line, obj)
+ facts = append(facts, fact)
+ }
+ sort.Strings(facts)
+
+ got := strings.Join(facts, "\n")
+ if got != want {
+ t.Errorf("Unexpected defs/uses\ngot:\n%s\nwant:\n%s", got, want)
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/labels.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/labels.go
new file mode 100644
index 0000000000..7364d4dbe6
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/labels.go
@@ -0,0 +1,268 @@
+// 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.
+
+package types
+
+import (
+ "go/ast"
+ "go/token"
+)
+
+// labels checks correct label use in body.
+func (check *Checker) labels(body *ast.BlockStmt) {
+ // set of all labels in this body
+ all := NewScope(nil, body.Pos(), body.End(), "label")
+
+ fwdJumps := check.blockBranches(all, nil, nil, body.List)
+
+ // If there are any forward jumps left, no label was found for
+ // the corresponding goto statements. Either those labels were
+ // never defined, or they are inside blocks and not reachable
+ // for the respective gotos.
+ for _, jmp := range fwdJumps {
+ var msg string
+ name := jmp.Label.Name
+ if alt := all.Lookup(name); alt != nil {
+ msg = "goto %s jumps into block"
+ alt.(*Label).used = true // avoid another error
+ } else {
+ msg = "label %s not declared"
+ }
+ check.errorf(jmp.Label.Pos(), msg, name)
+ }
+
+ // spec: "It is illegal to define a label that is never used."
+ for _, obj := range all.elems {
+ if lbl := obj.(*Label); !lbl.used {
+ check.softErrorf(lbl.pos, "label %s declared but not used", lbl.name)
+ }
+ }
+}
+
+// A block tracks label declarations in a block and its enclosing blocks.
+type block struct {
+ parent *block // enclosing block
+ lstmt *ast.LabeledStmt // labeled statement to which this block belongs, or nil
+ labels map[string]*ast.LabeledStmt // allocated lazily
+}
+
+// insert records a new label declaration for the current block.
+// The label must not have been declared before in any block.
+func (b *block) insert(s *ast.LabeledStmt) {
+ name := s.Label.Name
+ if debug {
+ assert(b.gotoTarget(name) == nil)
+ }
+ labels := b.labels
+ if labels == nil {
+ labels = make(map[string]*ast.LabeledStmt)
+ b.labels = labels
+ }
+ labels[name] = s
+}
+
+// gotoTarget returns the labeled statement in the current
+// or an enclosing block with the given label name, or nil.
+func (b *block) gotoTarget(name string) *ast.LabeledStmt {
+ for s := b; s != nil; s = s.parent {
+ if t := s.labels[name]; t != nil {
+ return t
+ }
+ }
+ return nil
+}
+
+// enclosingTarget returns the innermost enclosing labeled
+// statement with the given label name, or nil.
+func (b *block) enclosingTarget(name string) *ast.LabeledStmt {
+ for s := b; s != nil; s = s.parent {
+ if t := s.lstmt; t != nil && t.Label.Name == name {
+ return t
+ }
+ }
+ return nil
+}
+
+// blockBranches processes a block's statement list and returns the set of outgoing forward jumps.
+// all is the scope of all declared labels, parent the set of labels declared in the immediately
+// enclosing block, and lstmt is the labeled statement this block is associated with (or nil).
+func (check *Checker) blockBranches(all *Scope, parent *block, lstmt *ast.LabeledStmt, list []ast.Stmt) []*ast.BranchStmt {
+ b := &block{parent: parent, lstmt: lstmt}
+
+ var (
+ varDeclPos token.Pos
+ fwdJumps, badJumps []*ast.BranchStmt
+ )
+
+ // All forward jumps jumping over a variable declaration are possibly
+ // invalid (they may still jump out of the block and be ok).
+ // recordVarDecl records them for the given position.
+ recordVarDecl := func(pos token.Pos) {
+ varDeclPos = pos
+ badJumps = append(badJumps[:0], fwdJumps...) // copy fwdJumps to badJumps
+ }
+
+ jumpsOverVarDecl := func(jmp *ast.BranchStmt) bool {
+ if varDeclPos.IsValid() {
+ for _, bad := range badJumps {
+ if jmp == bad {
+ return true
+ }
+ }
+ }
+ return false
+ }
+
+ blockBranches := func(lstmt *ast.LabeledStmt, list []ast.Stmt) {
+ // Unresolved forward jumps inside the nested block
+ // become forward jumps in the current block.
+ fwdJumps = append(fwdJumps, check.blockBranches(all, b, lstmt, list)...)
+ }
+
+ var stmtBranches func(ast.Stmt)
+ stmtBranches = func(s ast.Stmt) {
+ switch s := s.(type) {
+ case *ast.DeclStmt:
+ if d, _ := s.Decl.(*ast.GenDecl); d != nil && d.Tok == token.VAR {
+ recordVarDecl(d.Pos())
+ }
+
+ case *ast.LabeledStmt:
+ // declare non-blank label
+ if name := s.Label.Name; name != "_" {
+ lbl := NewLabel(s.Label.Pos(), check.pkg, name)
+ if alt := all.Insert(lbl); alt != nil {
+ check.softErrorf(lbl.pos, "label %s already declared", name)
+ check.reportAltDecl(alt)
+ // ok to continue
+ } else {
+ b.insert(s)
+ check.recordDef(s.Label, lbl)
+ }
+ // resolve matching forward jumps and remove them from fwdJumps
+ i := 0
+ for _, jmp := range fwdJumps {
+ if jmp.Label.Name == name {
+ // match
+ lbl.used = true
+ check.recordUse(jmp.Label, lbl)
+ if jumpsOverVarDecl(jmp) {
+ check.softErrorf(
+ jmp.Label.Pos(),
+ "goto %s jumps over variable declaration at line %d",
+ name,
+ check.fset.Position(varDeclPos).Line,
+ )
+ // ok to continue
+ }
+ } else {
+ // no match - record new forward jump
+ fwdJumps[i] = jmp
+ i++
+ }
+ }
+ fwdJumps = fwdJumps[:i]
+ lstmt = s
+ }
+ stmtBranches(s.Stmt)
+
+ case *ast.BranchStmt:
+ if s.Label == nil {
+ return // checked in 1st pass (check.stmt)
+ }
+
+ // determine and validate target
+ name := s.Label.Name
+ switch s.Tok {
+ case token.BREAK:
+ // spec: "If there is a label, it must be that of an enclosing
+ // "for", "switch", or "select" statement, and that is the one
+ // whose execution terminates."
+ valid := false
+ if t := b.enclosingTarget(name); t != nil {
+ switch t.Stmt.(type) {
+ case *ast.SwitchStmt, *ast.TypeSwitchStmt, *ast.SelectStmt, *ast.ForStmt, *ast.RangeStmt:
+ valid = true
+ }
+ }
+ if !valid {
+ check.errorf(s.Label.Pos(), "invalid break label %s", name)
+ return
+ }
+
+ case token.CONTINUE:
+ // spec: "If there is a label, it must be that of an enclosing
+ // "for" statement, and that is the one whose execution advances."
+ valid := false
+ if t := b.enclosingTarget(name); t != nil {
+ switch t.Stmt.(type) {
+ case *ast.ForStmt, *ast.RangeStmt:
+ valid = true
+ }
+ }
+ if !valid {
+ check.errorf(s.Label.Pos(), "invalid continue label %s", name)
+ return
+ }
+
+ case token.GOTO:
+ if b.gotoTarget(name) == nil {
+ // label may be declared later - add branch to forward jumps
+ fwdJumps = append(fwdJumps, s)
+ return
+ }
+
+ default:
+ check.invalidAST(s.Pos(), "branch statement: %s %s", s.Tok, name)
+ return
+ }
+
+ // record label use
+ obj := all.Lookup(name)
+ obj.(*Label).used = true
+ check.recordUse(s.Label, obj)
+
+ case *ast.AssignStmt:
+ if s.Tok == token.DEFINE {
+ recordVarDecl(s.Pos())
+ }
+
+ case *ast.BlockStmt:
+ blockBranches(lstmt, s.List)
+
+ case *ast.IfStmt:
+ stmtBranches(s.Body)
+ if s.Else != nil {
+ stmtBranches(s.Else)
+ }
+
+ case *ast.CaseClause:
+ blockBranches(nil, s.Body)
+
+ case *ast.SwitchStmt:
+ stmtBranches(s.Body)
+
+ case *ast.TypeSwitchStmt:
+ stmtBranches(s.Body)
+
+ case *ast.CommClause:
+ blockBranches(nil, s.Body)
+
+ case *ast.SelectStmt:
+ stmtBranches(s.Body)
+
+ case *ast.ForStmt:
+ stmtBranches(s.Body)
+
+ case *ast.RangeStmt:
+ stmtBranches(s.Body)
+ }
+ }
+
+ for _, s := range list {
+ stmtBranches(s)
+ }
+
+ return fwdJumps
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/lookup.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/lookup.go
new file mode 100644
index 0000000000..3caca5519b
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/lookup.go
@@ -0,0 +1,341 @@
+// 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.
+
+// This file implements various field and method lookup functions.
+
+package types
+
+// LookupFieldOrMethod looks up a field or method with given package and name
+// in T and returns the corresponding *Var or *Func, an index sequence, and a
+// bool indicating if there were any pointer indirections on the path to the
+// field or method. If addressable is set, T is the type of an addressable
+// variable (only matters for method lookups).
+//
+// The last index entry is the field or method index in the (possibly embedded)
+// type where the entry was found, either:
+//
+// 1) the list of declared methods of a named type; or
+// 2) the list of all methods (method set) of an interface type; or
+// 3) the list of fields of a struct type.
+//
+// The earlier index entries are the indices of the anonymous struct fields
+// traversed to get to the found entry, starting at depth 0.
+//
+// If no entry is found, a nil object is returned. In this case, the returned
+// index and indirect values have the following meaning:
+//
+// - If index != nil, the index sequence points to an ambiguous entry
+// (the same name appeared more than once at the same embedding level).
+//
+// - If indirect is set, a method with a pointer receiver type was found
+// but there was no pointer on the path from the actual receiver type to
+// the method's formal receiver base type, nor was the receiver addressable.
+//
+func LookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string) (obj Object, index []int, indirect bool) {
+ // Methods cannot be associated to a named pointer type
+ // (spec: "The type denoted by T is called the receiver base type;
+ // it must not be a pointer or interface type and it must be declared
+ // in the same package as the method.").
+ // Thus, if we have a named pointer type, proceed with the underlying
+ // pointer type but discard the result if it is a method since we would
+ // not have found it for T (see also issue 8590).
+ if t, _ := T.(*Named); t != nil {
+ if p, _ := t.underlying.(*Pointer); p != nil {
+ obj, index, indirect = lookupFieldOrMethod(p, false, pkg, name)
+ if _, ok := obj.(*Func); ok {
+ return nil, nil, false
+ }
+ return
+ }
+ }
+
+ return lookupFieldOrMethod(T, addressable, pkg, name)
+}
+
+// TODO(gri) The named type consolidation and seen maps below must be
+// indexed by unique keys for a given type. Verify that named
+// types always have only one representation (even when imported
+// indirectly via different packages.)
+
+func lookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string) (obj Object, index []int, indirect bool) {
+ // WARNING: The code in this function is extremely subtle - do not modify casually!
+ // This function and NewMethodSet should be kept in sync.
+
+ if name == "_" {
+ return // blank fields/methods are never found
+ }
+
+ typ, isPtr := deref(T)
+ named, _ := typ.(*Named)
+
+ // *typ where typ is an interface has no methods.
+ if isPtr {
+ utyp := typ
+ if named != nil {
+ utyp = named.underlying
+ }
+ if _, ok := utyp.(*Interface); ok {
+ return
+ }
+ }
+
+ // Start with typ as single entry at shallowest depth.
+ // If typ is not a named type, insert a nil type instead.
+ current := []embeddedType{{named, nil, isPtr, false}}
+
+ // named types that we have seen already, allocated lazily
+ var seen map[*Named]bool
+
+ // search current depth
+ for len(current) > 0 {
+ var next []embeddedType // embedded types found at current depth
+
+ // look for (pkg, name) in all types at current depth
+ for _, e := range current {
+ // The very first time only, e.typ may be nil.
+ // In this case, we don't have a named type and
+ // we simply continue with the underlying type.
+ if e.typ != nil {
+ if seen[e.typ] {
+ // We have seen this type before, at a more shallow depth
+ // (note that multiples of this type at the current depth
+ // were consolidated before). The type at that depth shadows
+ // this same type at the current depth, so we can ignore
+ // this one.
+ continue
+ }
+ if seen == nil {
+ seen = make(map[*Named]bool)
+ }
+ seen[e.typ] = true
+
+ // look for a matching attached method
+ if i, m := lookupMethod(e.typ.methods, pkg, name); m != nil {
+ // potential match
+ assert(m.typ != nil)
+ index = concat(e.index, i)
+ if obj != nil || e.multiples {
+ return nil, index, false // collision
+ }
+ obj = m
+ indirect = e.indirect
+ continue // we can't have a matching field or interface method
+ }
+
+ // continue with underlying type
+ typ = e.typ.underlying
+ }
+
+ switch t := typ.(type) {
+ case *Struct:
+ // look for a matching field and collect embedded types
+ for i, f := range t.fields {
+ if f.sameId(pkg, name) {
+ assert(f.typ != nil)
+ index = concat(e.index, i)
+ if obj != nil || e.multiples {
+ return nil, index, false // collision
+ }
+ obj = f
+ indirect = e.indirect
+ continue // we can't have a matching interface method
+ }
+ // Collect embedded struct fields for searching the next
+ // lower depth, but only if we have not seen a match yet
+ // (if we have a match it is either the desired field or
+ // we have a name collision on the same depth; in either
+ // case we don't need to look further).
+ // Embedded fields are always of the form T or *T where
+ // T is a named type. If e.typ appeared multiple times at
+ // this depth, f.typ appears multiple times at the next
+ // depth.
+ if obj == nil && f.anonymous {
+ // Ignore embedded basic types - only user-defined
+ // named types can have methods or struct fields.
+ typ, isPtr := deref(f.typ)
+ if t, _ := typ.(*Named); t != nil {
+ next = append(next, embeddedType{t, concat(e.index, i), e.indirect || isPtr, e.multiples})
+ }
+ }
+ }
+
+ case *Interface:
+ // look for a matching method
+ // TODO(gri) t.allMethods is sorted - use binary search
+ if i, m := lookupMethod(t.allMethods, pkg, name); m != nil {
+ assert(m.typ != nil)
+ index = concat(e.index, i)
+ if obj != nil || e.multiples {
+ return nil, index, false // collision
+ }
+ obj = m
+ indirect = e.indirect
+ }
+ }
+ }
+
+ if obj != nil {
+ // found a potential match
+ // spec: "A method call x.m() is valid if the method set of (the type of) x
+ // contains m and the argument list can be assigned to the parameter
+ // list of m. If x is addressable and &x's method set contains m, x.m()
+ // is shorthand for (&x).m()".
+ if f, _ := obj.(*Func); f != nil && ptrRecv(f) && !indirect && !addressable {
+ return nil, nil, true // pointer/addressable receiver required
+ }
+ return
+ }
+
+ current = consolidateMultiples(next)
+ }
+
+ return nil, nil, false // not found
+}
+
+// embeddedType represents an embedded named type
+type embeddedType struct {
+ typ *Named // nil means use the outer typ variable instead
+ index []int // embedded field indices, starting with index at depth 0
+ indirect bool // if set, there was a pointer indirection on the path to this field
+ multiples bool // if set, typ appears multiple times at this depth
+}
+
+// consolidateMultiples collects multiple list entries with the same type
+// into a single entry marked as containing multiples. The result is the
+// consolidated list.
+func consolidateMultiples(list []embeddedType) []embeddedType {
+ if len(list) <= 1 {
+ return list // at most one entry - nothing to do
+ }
+
+ n := 0 // number of entries w/ unique type
+ prev := make(map[*Named]int) // index at which type was previously seen
+ for _, e := range list {
+ if i, found := prev[e.typ]; found {
+ list[i].multiples = true
+ // ignore this entry
+ } else {
+ prev[e.typ] = n
+ list[n] = e
+ n++
+ }
+ }
+ return list[:n]
+}
+
+// MissingMethod returns (nil, false) if V implements T, otherwise it
+// returns a missing method required by T and whether it is missing or
+// just has the wrong type.
+//
+// For non-interface types V, or if static is set, V implements T if all
+// methods of T are present in V. Otherwise (V is an interface and static
+// is not set), MissingMethod only checks that methods of T which are also
+// present in V have matching types (e.g., for a type assertion x.(T) where
+// x is of interface type V).
+//
+func MissingMethod(V Type, T *Interface, static bool) (method *Func, wrongType bool) {
+ // fast path for common case
+ if T.Empty() {
+ return
+ }
+
+ // TODO(gri) Consider using method sets here. Might be more efficient.
+
+ if ityp, _ := V.Underlying().(*Interface); ityp != nil {
+ // TODO(gri) allMethods is sorted - can do this more efficiently
+ for _, m := range T.allMethods {
+ _, obj := lookupMethod(ityp.allMethods, m.pkg, m.name)
+ switch {
+ case obj == nil:
+ if static {
+ return m, false
+ }
+ case !Identical(obj.Type(), m.typ):
+ return m, true
+ }
+ }
+ return
+ }
+
+ // A concrete type implements T if it implements all methods of T.
+ for _, m := range T.allMethods {
+ obj, _, _ := lookupFieldOrMethod(V, false, m.pkg, m.name)
+
+ f, _ := obj.(*Func)
+ if f == nil {
+ return m, false
+ }
+
+ if !Identical(f.typ, m.typ) {
+ return m, true
+ }
+ }
+
+ return
+}
+
+// assertableTo reports whether a value of type V can be asserted to have type T.
+// It returns (nil, false) as affirmative answer. Otherwise it returns a missing
+// method required by V and whether it is missing or just has the wrong type.
+func assertableTo(V *Interface, T Type) (method *Func, wrongType bool) {
+ // no static check is required if T is an interface
+ // spec: "If T is an interface type, x.(T) asserts that the
+ // dynamic type of x implements the interface T."
+ if _, ok := T.Underlying().(*Interface); ok && !strict {
+ return
+ }
+ return MissingMethod(T, V, false)
+}
+
+// deref dereferences typ if it is a *Pointer and returns its base and true.
+// Otherwise it returns (typ, false).
+func deref(typ Type) (Type, bool) {
+ if p, _ := typ.(*Pointer); p != nil {
+ return p.base, true
+ }
+ return typ, false
+}
+
+// derefStructPtr dereferences typ if it is a (named or unnamed) pointer to a
+// (named or unnamed) struct and returns its base. Otherwise it returns typ.
+func derefStructPtr(typ Type) Type {
+ if p, _ := typ.Underlying().(*Pointer); p != nil {
+ if _, ok := p.base.Underlying().(*Struct); ok {
+ return p.base
+ }
+ }
+ return typ
+}
+
+// concat returns the result of concatenating list and i.
+// The result does not share its underlying array with list.
+func concat(list []int, i int) []int {
+ var t []int
+ t = append(t, list...)
+ return append(t, i)
+}
+
+// fieldIndex returns the index for the field with matching package and name, or a value < 0.
+func fieldIndex(fields []*Var, pkg *Package, name string) int {
+ if name != "_" {
+ for i, f := range fields {
+ if f.sameId(pkg, name) {
+ return i
+ }
+ }
+ }
+ return -1
+}
+
+// lookupMethod returns the index of and method with matching package and name, or (-1, nil).
+func lookupMethod(methods []*Func, pkg *Package, name string) (int, *Func) {
+ if name != "_" {
+ for i, m := range methods {
+ if m.sameId(pkg, name) {
+ return i, m
+ }
+ }
+ }
+ return -1, nil
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/methodset.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/methodset.go
new file mode 100644
index 0000000000..8aff6f9ba4
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/methodset.go
@@ -0,0 +1,271 @@
+// 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.
+
+// This file implements method sets.
+
+package types
+
+import (
+ "bytes"
+ "fmt"
+ "sort"
+)
+
+// A MethodSet is an ordered set of concrete or abstract (interface) methods;
+// a method is a MethodVal selection, and they are ordered by ascending m.Obj().Id().
+// The zero value for a MethodSet is a ready-to-use empty method set.
+type MethodSet struct {
+ list []*Selection
+}
+
+func (s *MethodSet) String() string {
+ if s.Len() == 0 {
+ return "MethodSet {}"
+ }
+
+ var buf bytes.Buffer
+ fmt.Fprintln(&buf, "MethodSet {")
+ for _, f := range s.list {
+ fmt.Fprintf(&buf, "\t%s\n", f)
+ }
+ fmt.Fprintln(&buf, "}")
+ return buf.String()
+}
+
+// Len returns the number of methods in s.
+func (s *MethodSet) Len() int { return len(s.list) }
+
+// At returns the i'th method in s for 0 <= i < s.Len().
+func (s *MethodSet) At(i int) *Selection { return s.list[i] }
+
+// Lookup returns the method with matching package and name, or nil if not found.
+func (s *MethodSet) Lookup(pkg *Package, name string) *Selection {
+ if s.Len() == 0 {
+ return nil
+ }
+
+ key := Id(pkg, name)
+ i := sort.Search(len(s.list), func(i int) bool {
+ m := s.list[i]
+ return m.obj.Id() >= key
+ })
+ if i < len(s.list) {
+ m := s.list[i]
+ if m.obj.Id() == key {
+ return m
+ }
+ }
+ return nil
+}
+
+// Shared empty method set.
+var emptyMethodSet MethodSet
+
+// NewMethodSet returns the method set for the given type T. It
+// always returns a non-nil method set, even if it is empty.
+//
+// A MethodSetCache handles repeat queries more efficiently.
+//
+func NewMethodSet(T Type) *MethodSet {
+ // WARNING: The code in this function is extremely subtle - do not modify casually!
+ // This function and lookupFieldOrMethod should be kept in sync.
+
+ // method set up to the current depth, allocated lazily
+ var base methodSet
+
+ typ, isPtr := deref(T)
+ named, _ := typ.(*Named)
+
+ // *typ where typ is an interface has no methods.
+ if isPtr {
+ utyp := typ
+ if named != nil {
+ utyp = named.underlying
+ }
+ if _, ok := utyp.(*Interface); ok {
+ return &emptyMethodSet
+ }
+ }
+
+ // Start with typ as single entry at shallowest depth.
+ // If typ is not a named type, insert a nil type instead.
+ current := []embeddedType{{named, nil, isPtr, false}}
+
+ // named types that we have seen already, allocated lazily
+ var seen map[*Named]bool
+
+ // collect methods at current depth
+ for len(current) > 0 {
+ var next []embeddedType // embedded types found at current depth
+
+ // field and method sets at current depth, allocated lazily
+ var fset fieldSet
+ var mset methodSet
+
+ for _, e := range current {
+ // The very first time only, e.typ may be nil.
+ // In this case, we don't have a named type and
+ // we simply continue with the underlying type.
+ if e.typ != nil {
+ if seen[e.typ] {
+ // We have seen this type before, at a more shallow depth
+ // (note that multiples of this type at the current depth
+ // were consolidated before). The type at that depth shadows
+ // this same type at the current depth, so we can ignore
+ // this one.
+ continue
+ }
+ if seen == nil {
+ seen = make(map[*Named]bool)
+ }
+ seen[e.typ] = true
+
+ mset = mset.add(e.typ.methods, e.index, e.indirect, e.multiples)
+
+ // continue with underlying type
+ typ = e.typ.underlying
+ }
+
+ switch t := typ.(type) {
+ case *Struct:
+ for i, f := range t.fields {
+ fset = fset.add(f, e.multiples)
+
+ // Embedded fields are always of the form T or *T where
+ // T is a named type. If typ appeared multiple times at
+ // this depth, f.Type appears multiple times at the next
+ // depth.
+ if f.anonymous {
+ // Ignore embedded basic types - only user-defined
+ // named types can have methods or struct fields.
+ typ, isPtr := deref(f.typ)
+ if t, _ := typ.(*Named); t != nil {
+ next = append(next, embeddedType{t, concat(e.index, i), e.indirect || isPtr, e.multiples})
+ }
+ }
+ }
+
+ case *Interface:
+ mset = mset.add(t.allMethods, e.index, true, e.multiples)
+ }
+ }
+
+ // Add methods and collisions at this depth to base if no entries with matching
+ // names exist already.
+ for k, m := range mset {
+ if _, found := base[k]; !found {
+ // Fields collide with methods of the same name at this depth.
+ if _, found := fset[k]; found {
+ m = nil // collision
+ }
+ if base == nil {
+ base = make(methodSet)
+ }
+ base[k] = m
+ }
+ }
+
+ // Multiple fields with matching names collide at this depth and shadow all
+ // entries further down; add them as collisions to base if no entries with
+ // matching names exist already.
+ for k, f := range fset {
+ if f == nil {
+ if _, found := base[k]; !found {
+ if base == nil {
+ base = make(methodSet)
+ }
+ base[k] = nil // collision
+ }
+ }
+ }
+
+ current = consolidateMultiples(next)
+ }
+
+ if len(base) == 0 {
+ return &emptyMethodSet
+ }
+
+ // collect methods
+ var list []*Selection
+ for _, m := range base {
+ if m != nil {
+ m.recv = T
+ list = append(list, m)
+ }
+ }
+ sort.Sort(byUniqueName(list))
+ return &MethodSet{list}
+}
+
+// A fieldSet is a set of fields and name collisions.
+// A collision indicates that multiple fields with the
+// same unique id appeared.
+type fieldSet map[string]*Var // a nil entry indicates a name collision
+
+// Add adds field f to the field set s.
+// If multiples is set, f appears multiple times
+// and is treated as a collision.
+func (s fieldSet) add(f *Var, multiples bool) fieldSet {
+ if s == nil {
+ s = make(fieldSet)
+ }
+ key := f.Id()
+ // if f is not in the set, add it
+ if !multiples {
+ if _, found := s[key]; !found {
+ s[key] = f
+ return s
+ }
+ }
+ s[key] = nil // collision
+ return s
+}
+
+// A methodSet is a set of methods and name collisions.
+// A collision indicates that multiple methods with the
+// same unique id appeared.
+type methodSet map[string]*Selection // a nil entry indicates a name collision
+
+// Add adds all functions in list to the method set s.
+// If multiples is set, every function in list appears multiple times
+// and is treated as a collision.
+func (s methodSet) add(list []*Func, index []int, indirect bool, multiples bool) methodSet {
+ if len(list) == 0 {
+ return s
+ }
+ if s == nil {
+ s = make(methodSet)
+ }
+ for i, f := range list {
+ key := f.Id()
+ // if f is not in the set, add it
+ if !multiples {
+ // TODO(gri) A found method may not be added because it's not in the method set
+ // (!indirect && ptrRecv(f)). A 2nd method on the same level may be in the method
+ // set and may not collide with the first one, thus leading to a false positive.
+ // Is that possible? Investigate.
+ if _, found := s[key]; !found && (indirect || !ptrRecv(f)) {
+ s[key] = &Selection{MethodVal, nil, f, concat(index, i), indirect}
+ continue
+ }
+ }
+ s[key] = nil // collision
+ }
+ return s
+}
+
+// ptrRecv reports whether the receiver is of the form *T.
+// The receiver must exist.
+func ptrRecv(f *Func) bool {
+ _, isPtr := deref(f.typ.(*Signature).recv.typ)
+ return isPtr
+}
+
+// byUniqueName function lists can be sorted by their unique names.
+type byUniqueName []*Selection
+
+func (a byUniqueName) Len() int { return len(a) }
+func (a byUniqueName) Less(i, j int) bool { return a[i].obj.Id() < a[j].obj.Id() }
+func (a byUniqueName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/object.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/object.go
new file mode 100644
index 0000000000..a9b6c43f5a
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/object.go
@@ -0,0 +1,361 @@
+// 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.
+
+package types
+
+import (
+ "bytes"
+ "fmt"
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/go/exact"
+)
+
+// TODO(gri) Document factory, accessor methods, and fields. General clean-up.
+
+// An Object describes a named language entity such as a package,
+// constant, type, variable, function (incl. methods), or label.
+// All objects implement the Object interface.
+//
+type Object interface {
+ Parent() *Scope // scope in which this object is declared
+ Pos() token.Pos // position of object identifier in declaration
+ Pkg() *Package // nil for objects in the Universe scope and labels
+ Name() string // package local object name
+ Type() Type // object type
+ Exported() bool // reports whether the name starts with a capital letter
+ Id() string // object id (see Id below)
+
+ // String returns a human-readable string of the object.
+ String() string
+
+ // order reflects a package-level object's source order: if object
+ // a is before object b in the source, then a.order() < b.order().
+ // order returns a value > 0 for package-level objects; it returns
+ // 0 for all other objects (including objects in file scopes).
+ order() uint32
+
+ // setOrder sets the order number of the object. It must be > 0.
+ setOrder(uint32)
+
+ // setParent sets the parent scope of the object.
+ setParent(*Scope)
+
+ // sameId reports whether obj.Id() and Id(pkg, name) are the same.
+ sameId(pkg *Package, name string) bool
+
+ // scopePos returns the start position of the scope of this Object
+ scopePos() token.Pos
+
+ // setScopePos sets the start position of the scope for this Object.
+ setScopePos(pos token.Pos)
+}
+
+// Id returns name if it is exported, otherwise it
+// returns the name qualified with the package path.
+func Id(pkg *Package, name string) string {
+ if ast.IsExported(name) {
+ return name
+ }
+ // unexported names need the package path for differentiation
+ // (if there's no package, make sure we don't start with '.'
+ // as that may change the order of methods between a setup
+ // inside a package and outside a package - which breaks some
+ // tests)
+ path := "_"
+ // TODO(gri): shouldn't !ast.IsExported(name) => pkg != nil be an precondition?
+ // if pkg == nil {
+ // panic("nil package in lookup of unexported name")
+ // }
+ if pkg != nil {
+ path = pkg.path
+ if path == "" {
+ path = "_"
+ }
+ }
+ return path + "." + name
+}
+
+// An object implements the common parts of an Object.
+type object struct {
+ parent *Scope
+ pos token.Pos
+ pkg *Package
+ name string
+ typ Type
+ order_ uint32
+ scopePos_ token.Pos
+}
+
+func (obj *object) Parent() *Scope { return obj.parent }
+func (obj *object) Pos() token.Pos { return obj.pos }
+func (obj *object) Pkg() *Package { return obj.pkg }
+func (obj *object) Name() string { return obj.name }
+func (obj *object) Type() Type { return obj.typ }
+func (obj *object) Exported() bool { return ast.IsExported(obj.name) }
+func (obj *object) Id() string { return Id(obj.pkg, obj.name) }
+func (obj *object) String() string { panic("abstract") }
+func (obj *object) order() uint32 { return obj.order_ }
+func (obj *object) scopePos() token.Pos { return obj.scopePos_ }
+
+func (obj *object) setParent(parent *Scope) { obj.parent = parent }
+func (obj *object) setOrder(order uint32) { assert(order > 0); obj.order_ = order }
+func (obj *object) setScopePos(pos token.Pos) { obj.scopePos_ = pos }
+
+func (obj *object) sameId(pkg *Package, name string) bool {
+ // spec:
+ // "Two identifiers are different if they are spelled differently,
+ // or if they appear in different packages and are not exported.
+ // Otherwise, they are the same."
+ if name != obj.name {
+ return false
+ }
+ // obj.Name == name
+ if obj.Exported() {
+ return true
+ }
+ // not exported, so packages must be the same (pkg == nil for
+ // fields in Universe scope; this can only happen for types
+ // introduced via Eval)
+ if pkg == nil || obj.pkg == nil {
+ return pkg == obj.pkg
+ }
+ // pkg != nil && obj.pkg != nil
+ return pkg.path == obj.pkg.path
+}
+
+// A PkgName represents an imported Go package.
+type PkgName struct {
+ object
+ imported *Package
+ used bool // set if the package was used
+}
+
+func NewPkgName(pos token.Pos, pkg *Package, name string, imported *Package) *PkgName {
+ return &PkgName{object{nil, pos, pkg, name, Typ[Invalid], 0, token.NoPos}, imported, false}
+}
+
+// Imported returns the package that was imported.
+// It is distinct from Pkg(), which is the package containing the import statement.
+func (obj *PkgName) Imported() *Package { return obj.imported }
+
+// A Const represents a declared constant.
+type Const struct {
+ object
+ val exact.Value
+ visited bool // for initialization cycle detection
+}
+
+func NewConst(pos token.Pos, pkg *Package, name string, typ Type, val exact.Value) *Const {
+ return &Const{object{nil, pos, pkg, name, typ, 0, token.NoPos}, val, false}
+}
+
+func (obj *Const) Val() exact.Value { return obj.val }
+
+// A TypeName represents a declared type.
+type TypeName struct {
+ object
+}
+
+func NewTypeName(pos token.Pos, pkg *Package, name string, typ Type) *TypeName {
+ return &TypeName{object{nil, pos, pkg, name, typ, 0, token.NoPos}}
+}
+
+// A Variable represents a declared variable (including function parameters and results, and struct fields).
+type Var struct {
+ object
+ anonymous bool // if set, the variable is an anonymous struct field, and name is the type name
+ visited bool // for initialization cycle detection
+ isField bool // var is struct field
+ used bool // set if the variable was used
+}
+
+func NewVar(pos token.Pos, pkg *Package, name string, typ Type) *Var {
+ return &Var{object: object{nil, pos, pkg, name, typ, 0, token.NoPos}}
+}
+
+func NewParam(pos token.Pos, pkg *Package, name string, typ Type) *Var {
+ return &Var{object: object{nil, pos, pkg, name, typ, 0, token.NoPos}, used: true} // parameters are always 'used'
+}
+
+func NewField(pos token.Pos, pkg *Package, name string, typ Type, anonymous bool) *Var {
+ return &Var{object: object{nil, pos, pkg, name, typ, 0, token.NoPos}, anonymous: anonymous, isField: true}
+}
+
+func (obj *Var) Anonymous() bool { return obj.anonymous }
+
+func (obj *Var) IsField() bool { return obj.isField }
+
+// A Func represents a declared function, concrete method, or abstract
+// (interface) method. Its Type() is always a *Signature.
+// An abstract method may belong to many interfaces due to embedding.
+type Func struct {
+ object
+}
+
+func NewFunc(pos token.Pos, pkg *Package, name string, sig *Signature) *Func {
+ // don't store a nil signature
+ var typ Type
+ if sig != nil {
+ typ = sig
+ }
+ return &Func{object{nil, pos, pkg, name, typ, 0, token.NoPos}}
+}
+
+// FullName returns the package- or receiver-type-qualified name of
+// function or method obj.
+func (obj *Func) FullName() string {
+ var buf bytes.Buffer
+ writeFuncName(&buf, obj, nil)
+ return buf.String()
+}
+
+func (obj *Func) Scope() *Scope {
+ return obj.typ.(*Signature).scope
+}
+
+// A Label represents a declared label.
+type Label struct {
+ object
+ used bool // set if the label was used
+}
+
+func NewLabel(pos token.Pos, pkg *Package, name string) *Label {
+ return &Label{object{pos: pos, pkg: pkg, name: name, typ: Typ[Invalid]}, false}
+}
+
+// A Builtin represents a built-in function.
+// Builtins don't have a valid type.
+type Builtin struct {
+ object
+ id builtinId
+}
+
+func newBuiltin(id builtinId) *Builtin {
+ return &Builtin{object{name: predeclaredFuncs[id].name, typ: Typ[Invalid]}, id}
+}
+
+// Nil represents the predeclared value nil.
+type Nil struct {
+ object
+}
+
+func writeObject(buf *bytes.Buffer, obj Object, qf Qualifier) {
+ typ := obj.Type()
+ switch obj := obj.(type) {
+ case *PkgName:
+ fmt.Fprintf(buf, "package %s", obj.Name())
+ if path := obj.imported.path; path != "" && path != obj.name {
+ fmt.Fprintf(buf, " (%q)", path)
+ }
+ return
+
+ case *Const:
+ buf.WriteString("const")
+
+ case *TypeName:
+ buf.WriteString("type")
+ typ = typ.Underlying()
+
+ case *Var:
+ if obj.isField {
+ buf.WriteString("field")
+ } else {
+ buf.WriteString("var")
+ }
+
+ case *Func:
+ buf.WriteString("func ")
+ writeFuncName(buf, obj, qf)
+ if typ != nil {
+ WriteSignature(buf, typ.(*Signature), qf)
+ }
+ return
+
+ case *Label:
+ buf.WriteString("label")
+ typ = nil
+
+ case *Builtin:
+ buf.WriteString("builtin")
+ typ = nil
+
+ case *Nil:
+ buf.WriteString("nil")
+ return
+
+ default:
+ panic(fmt.Sprintf("writeObject(%T)", obj))
+ }
+
+ buf.WriteByte(' ')
+
+ // For package-level objects, qualify the name.
+ if obj.Pkg() != nil && obj.Pkg().scope.Lookup(obj.Name()) == obj {
+ writePackage(buf, obj.Pkg(), qf)
+ }
+ buf.WriteString(obj.Name())
+ if typ != nil {
+ buf.WriteByte(' ')
+ WriteType(buf, typ, qf)
+ }
+}
+
+func writePackage(buf *bytes.Buffer, pkg *Package, qf Qualifier) {
+ if pkg == nil {
+ return
+ }
+ var s string
+ if qf != nil {
+ s = qf(pkg)
+ } else {
+ s = pkg.Path()
+ }
+ if s != "" {
+ buf.WriteString(s)
+ buf.WriteByte('.')
+ }
+}
+
+// ObjectString returns the string form of obj.
+// The Qualifier controls the printing of
+// package-level objects, and may be nil.
+func ObjectString(obj Object, qf Qualifier) string {
+ var buf bytes.Buffer
+ writeObject(&buf, obj, qf)
+ return buf.String()
+}
+
+func (obj *PkgName) String() string { return ObjectString(obj, nil) }
+func (obj *Const) String() string { return ObjectString(obj, nil) }
+func (obj *TypeName) String() string { return ObjectString(obj, nil) }
+func (obj *Var) String() string { return ObjectString(obj, nil) }
+func (obj *Func) String() string { return ObjectString(obj, nil) }
+func (obj *Label) String() string { return ObjectString(obj, nil) }
+func (obj *Builtin) String() string { return ObjectString(obj, nil) }
+func (obj *Nil) String() string { return ObjectString(obj, nil) }
+
+func writeFuncName(buf *bytes.Buffer, f *Func, qf Qualifier) {
+ if f.typ != nil {
+ sig := f.typ.(*Signature)
+ if recv := sig.Recv(); recv != nil {
+ buf.WriteByte('(')
+ if _, ok := recv.Type().(*Interface); ok {
+ // gcimporter creates abstract methods of
+ // named interfaces using the interface type
+ // (not the named type) as the receiver.
+ // Don't print it in full.
+ buf.WriteString("interface")
+ } else {
+ WriteType(buf, recv.Type(), qf)
+ }
+ buf.WriteByte(')')
+ buf.WriteByte('.')
+ } else if f.pkg != nil {
+ writePackage(buf, f.pkg, qf)
+ }
+ }
+ buf.WriteString(f.name)
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/objset.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/objset.go
new file mode 100644
index 0000000000..55eb74addb
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/objset.go
@@ -0,0 +1,31 @@
+// 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.
+
+// This file implements objsets.
+//
+// An objset is similar to a Scope but objset elements
+// are identified by their unique id, instead of their
+// object name.
+
+package types
+
+// An objset is a set of objects identified by their unique id.
+// The zero value for objset is a ready-to-use empty objset.
+type objset map[string]Object // initialized lazily
+
+// insert attempts to insert an object obj into objset s.
+// If s already contains an alternative object alt with
+// the same name, insert leaves s unchanged and returns alt.
+// Otherwise it inserts obj and returns nil.
+func (s *objset) insert(obj Object) Object {
+ id := obj.Id()
+ if alt := (*s)[id]; alt != nil {
+ return alt
+ }
+ if *s == nil {
+ *s = make(map[string]Object)
+ }
+ (*s)[id] = obj
+ return nil
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/operand.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/operand.go
new file mode 100644
index 0000000000..d52b30e161
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/operand.go
@@ -0,0 +1,288 @@
+// Copyright 2012 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.
+
+// This file defines operands and associated operations.
+
+package types
+
+import (
+ "bytes"
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/go/exact"
+)
+
+// An operandMode specifies the (addressing) mode of an operand.
+type operandMode byte
+
+const (
+ invalid operandMode = iota // operand is invalid
+ novalue // operand represents no value (result of a function call w/o result)
+ builtin // operand is a built-in function
+ typexpr // operand is a type
+ constant // operand is a constant; the operand's typ is a Basic type
+ variable // operand is an addressable variable
+ mapindex // operand is a map index expression (acts like a variable on lhs, commaok on rhs of an assignment)
+ value // operand is a computed value
+ commaok // like value, but operand may be used in a comma,ok expression
+)
+
+var operandModeString = [...]string{
+ invalid: "invalid operand",
+ novalue: "no value",
+ builtin: "built-in",
+ typexpr: "type",
+ constant: "constant",
+ variable: "variable",
+ mapindex: "map index expression",
+ value: "value",
+ commaok: "comma, ok expression",
+}
+
+// An operand represents an intermediate value during type checking.
+// Operands have an (addressing) mode, the expression evaluating to
+// the operand, the operand's type, a value for constants, and an id
+// for built-in functions.
+// The zero value of operand is a ready to use invalid operand.
+//
+type operand struct {
+ mode operandMode
+ expr ast.Expr
+ typ Type
+ val exact.Value
+ id builtinId
+}
+
+// pos returns the position of the expression corresponding to x.
+// If x is invalid the position is token.NoPos.
+//
+func (x *operand) pos() token.Pos {
+ // x.expr may not be set if x is invalid
+ if x.expr == nil {
+ return token.NoPos
+ }
+ return x.expr.Pos()
+}
+
+// Operand string formats
+// (not all "untyped" cases can appear due to the type system,
+// but they fall out naturally here)
+//
+// mode format
+//
+// invalid ( )
+// novalue ( )
+// builtin ( )
+// typexpr ( )
+//
+// constant ( )
+// constant ( of type )
+// constant ( )
+// constant ( of type )
+//
+// variable ( )
+// variable ( of type )
+//
+// mapindex ( )
+// mapindex ( of type )
+//
+// value ( )
+// value ( of type )
+//
+// commaok ( )
+// commaok ( of type )
+//
+func operandString(x *operand, qf Qualifier) string {
+ var buf bytes.Buffer
+
+ var expr string
+ if x.expr != nil {
+ expr = ExprString(x.expr)
+ } else {
+ switch x.mode {
+ case builtin:
+ expr = predeclaredFuncs[x.id].name
+ case typexpr:
+ expr = TypeString(x.typ, qf)
+ case constant:
+ expr = x.val.String()
+ }
+ }
+
+ // (
+ if expr != "" {
+ buf.WriteString(expr)
+ buf.WriteString(" (")
+ }
+
+ //
+ hasType := false
+ switch x.mode {
+ case invalid, novalue, builtin, typexpr:
+ // no type
+ default:
+ // has type
+ if isUntyped(x.typ) {
+ buf.WriteString(x.typ.(*Basic).name)
+ buf.WriteByte(' ')
+ break
+ }
+ hasType = true
+ }
+
+ //
+ buf.WriteString(operandModeString[x.mode])
+
+ //
+ if x.mode == constant {
+ if s := x.val.String(); s != expr {
+ buf.WriteByte(' ')
+ buf.WriteString(s)
+ }
+ }
+
+ //
+ if hasType {
+ if x.typ != Typ[Invalid] {
+ buf.WriteString(" of type ")
+ WriteType(&buf, x.typ, qf)
+ } else {
+ buf.WriteString(" with invalid type")
+ }
+ }
+
+ // )
+ if expr != "" {
+ buf.WriteByte(')')
+ }
+
+ return buf.String()
+}
+
+func (x *operand) String() string {
+ return operandString(x, nil)
+}
+
+// setConst sets x to the untyped constant for literal lit.
+func (x *operand) setConst(tok token.Token, lit string) {
+ val := exact.MakeFromLiteral(lit, tok)
+ if val == nil {
+ // TODO(gri) Should we make it an unknown constant instead?
+ x.mode = invalid
+ return
+ }
+
+ var kind BasicKind
+ switch tok {
+ case token.INT:
+ kind = UntypedInt
+ case token.FLOAT:
+ kind = UntypedFloat
+ case token.IMAG:
+ kind = UntypedComplex
+ case token.CHAR:
+ kind = UntypedRune
+ case token.STRING:
+ kind = UntypedString
+ }
+
+ x.mode = constant
+ x.typ = Typ[kind]
+ x.val = val
+}
+
+// isNil reports whether x is the nil value.
+func (x *operand) isNil() bool {
+ return x.mode == value && x.typ == Typ[UntypedNil]
+}
+
+// TODO(gri) The functions operand.assignableTo, checker.convertUntyped,
+// checker.representable, and checker.assignment are
+// overlapping in functionality. Need to simplify and clean up.
+
+// assignableTo reports whether x is assignable to a variable of type T.
+func (x *operand) assignableTo(conf *Config, T Type) bool {
+ if x.mode == invalid || T == Typ[Invalid] {
+ return true // avoid spurious errors
+ }
+
+ V := x.typ
+
+ // x's type is identical to T
+ if Identical(V, T) {
+ return true
+ }
+
+ Vu := V.Underlying()
+ Tu := T.Underlying()
+
+ // T is an interface type and x implements T
+ // (Do this check first as it might succeed early.)
+ if Ti, ok := Tu.(*Interface); ok {
+ if Implements(x.typ, Ti) {
+ return true
+ }
+ }
+
+ // x's type V and T have identical underlying types
+ // and at least one of V or T is not a named type
+ if Identical(Vu, Tu) && (!isNamed(V) || !isNamed(T)) {
+ return true
+ }
+
+ // x is a bidirectional channel value, T is a channel
+ // type, x's type V and T have identical element types,
+ // and at least one of V or T is not a named type
+ if Vc, ok := Vu.(*Chan); ok && Vc.dir == SendRecv {
+ if Tc, ok := Tu.(*Chan); ok && Identical(Vc.elem, Tc.elem) {
+ return !isNamed(V) || !isNamed(T)
+ }
+ }
+
+ // x is the predeclared identifier nil and T is a pointer,
+ // function, slice, map, channel, or interface type
+ if x.isNil() {
+ switch t := Tu.(type) {
+ case *Basic:
+ if t.kind == UnsafePointer {
+ return true
+ }
+ case *Pointer, *Signature, *Slice, *Map, *Chan, *Interface:
+ return true
+ }
+ return false
+ }
+
+ // x is an untyped constant representable by a value of type T
+ // TODO(gri) This is borrowing from checker.convertUntyped and
+ // checker.representable. Need to clean up.
+ if isUntyped(Vu) {
+ switch t := Tu.(type) {
+ case *Basic:
+ if x.mode == constant {
+ return representableConst(x.val, conf, t.kind, nil)
+ }
+ // The result of a comparison is an untyped boolean,
+ // but may not be a constant.
+ if Vb, _ := Vu.(*Basic); Vb != nil {
+ return Vb.kind == UntypedBool && isBoolean(Tu)
+ }
+ case *Interface:
+ return x.isNil() || t.Empty()
+ case *Pointer, *Signature, *Slice, *Map, *Chan:
+ return x.isNil()
+ }
+ }
+
+ return false
+}
+
+// isInteger reports whether x is a value of integer type
+// or an untyped constant representable as an integer.
+func (x *operand) isInteger() bool {
+ return x.mode == invalid ||
+ isInteger(x.typ) ||
+ isUntyped(x.typ) && x.mode == constant && representableConst(x.val, nil, UntypedInt, nil) // no *Config required for UntypedInt
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/ordering.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/ordering.go
new file mode 100644
index 0000000000..6bb98f2dc1
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/ordering.go
@@ -0,0 +1,127 @@
+// Copyright 2014 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.
+
+// This file implements resolveOrder.
+
+package types
+
+import (
+ "go/ast"
+ "sort"
+)
+
+// resolveOrder computes the order in which package-level objects
+// must be type-checked.
+//
+// Interface types appear first in the list, sorted topologically
+// by dependencies on embedded interfaces that are also declared
+// in this package, followed by all other objects sorted in source
+// order.
+//
+// TODO(gri) Consider sorting all types by dependencies here, and
+// in the process check _and_ report type cycles. This may simplify
+// the full type-checking phase.
+//
+func (check *Checker) resolveOrder() []Object {
+ var ifaces, others []Object
+
+ // collect interface types with their dependencies, and all other objects
+ for obj := range check.objMap {
+ if ityp := check.interfaceFor(obj); ityp != nil {
+ ifaces = append(ifaces, obj)
+ // determine dependencies on embedded interfaces
+ for _, f := range ityp.Methods.List {
+ if len(f.Names) == 0 {
+ // Embedded interface: The type must be a (possibly
+ // qualified) identifier denoting another interface.
+ // Imported interfaces are already fully resolved,
+ // so we can ignore qualified identifiers.
+ if ident, _ := f.Type.(*ast.Ident); ident != nil {
+ embedded := check.pkg.scope.Lookup(ident.Name)
+ if check.interfaceFor(embedded) != nil {
+ check.objMap[obj].addDep(embedded)
+ }
+ }
+ }
+ }
+ } else {
+ others = append(others, obj)
+ }
+ }
+
+ // final object order
+ var order []Object
+
+ // sort interface types topologically by dependencies,
+ // and in source order if there are no dependencies
+ sort.Sort(inSourceOrder(ifaces))
+ if debug {
+ for _, obj := range ifaces {
+ assert(check.objMap[obj].mark == 0)
+ }
+ }
+ for _, obj := range ifaces {
+ check.appendInPostOrder(&order, obj)
+ }
+
+ // sort everything else in source order
+ sort.Sort(inSourceOrder(others))
+
+ return append(order, others...)
+}
+
+// interfaceFor returns the AST interface denoted by obj, or nil.
+func (check *Checker) interfaceFor(obj Object) *ast.InterfaceType {
+ tname, _ := obj.(*TypeName)
+ if tname == nil {
+ return nil // not a type
+ }
+ d := check.objMap[obj]
+ if d == nil {
+ check.dump("%s: %s should have been declared", obj.Pos(), obj.Name())
+ unreachable()
+ }
+ if d.typ == nil {
+ return nil // invalid AST - ignore (will be handled later)
+ }
+ ityp, _ := d.typ.(*ast.InterfaceType)
+ return ityp
+}
+
+func (check *Checker) appendInPostOrder(order *[]Object, obj Object) {
+ d := check.objMap[obj]
+ if d.mark != 0 {
+ // We've already seen this object; either because it's
+ // already added to order, or because we have a cycle.
+ // In both cases we stop. Cycle errors are reported
+ // when type-checking types.
+ return
+ }
+ d.mark = 1
+
+ for _, obj := range orderedSetObjects(d.deps) {
+ check.appendInPostOrder(order, obj)
+ }
+
+ *order = append(*order, obj)
+}
+
+func orderedSetObjects(set map[Object]bool) []Object {
+ list := make([]Object, len(set))
+ i := 0
+ for obj := range set {
+ // we don't care about the map element value
+ list[i] = obj
+ i++
+ }
+ sort.Sort(inSourceOrder(list))
+ return list
+}
+
+// inSourceOrder implements the sort.Sort interface.
+type inSourceOrder []Object
+
+func (a inSourceOrder) Len() int { return len(a) }
+func (a inSourceOrder) Less(i, j int) bool { return a[i].order() < a[j].order() }
+func (a inSourceOrder) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/package.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/package.go
new file mode 100644
index 0000000000..48fe8398fe
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/package.go
@@ -0,0 +1,65 @@
+// 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.
+
+package types
+
+import (
+ "fmt"
+ "go/token"
+)
+
+// A Package describes a Go package.
+type Package struct {
+ path string
+ name string
+ scope *Scope
+ complete bool
+ imports []*Package
+ fake bool // scope lookup errors are silently dropped if package is fake (internal use only)
+}
+
+// NewPackage returns a new Package for the given package path and name;
+// the name must not be the blank identifier.
+// The package is not complete and contains no explicit imports.
+func NewPackage(path, name string) *Package {
+ if name == "_" {
+ panic("invalid package name _")
+ }
+ scope := NewScope(Universe, token.NoPos, token.NoPos, fmt.Sprintf("package %q", path))
+ return &Package{path: path, name: name, scope: scope}
+}
+
+// Path returns the package path.
+func (pkg *Package) Path() string { return pkg.path }
+
+// Name returns the package name.
+func (pkg *Package) Name() string { return pkg.name }
+
+// Scope returns the (complete or incomplete) package scope
+// holding the objects declared at package level (TypeNames,
+// Consts, Vars, and Funcs).
+func (pkg *Package) Scope() *Scope { return pkg.scope }
+
+// A package is complete if its scope contains (at least) all
+// exported objects; otherwise it is incomplete.
+func (pkg *Package) Complete() bool { return pkg.complete }
+
+// MarkComplete marks a package as complete.
+func (pkg *Package) MarkComplete() { pkg.complete = true }
+
+// Imports returns the list of packages directly imported by
+// pkg; the list is in source order. Package unsafe is excluded.
+//
+// If pkg was loaded from export data, Imports includes packages that
+// provide package-level objects referenced by pkg. This may be more or
+// less than the set of packages directly imported by pkg's source code.
+func (pkg *Package) Imports() []*Package { return pkg.imports }
+
+// SetImports sets the list of explicitly imported packages to list.
+// It is the caller's responsibility to make sure list elements are unique.
+func (pkg *Package) SetImports(list []*Package) { pkg.imports = list }
+
+func (pkg *Package) String() string {
+ return fmt.Sprintf("package %s (%q)", pkg.name, pkg.path)
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/predicates.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/predicates.go
new file mode 100644
index 0000000000..993c6d290b
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/predicates.go
@@ -0,0 +1,309 @@
+// Copyright 2012 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.
+
+// This file implements commonly used type predicates.
+
+package types
+
+import "sort"
+
+func isNamed(typ Type) bool {
+ if _, ok := typ.(*Basic); ok {
+ return ok
+ }
+ _, ok := typ.(*Named)
+ return ok
+}
+
+func isBoolean(typ Type) bool {
+ t, ok := typ.Underlying().(*Basic)
+ return ok && t.info&IsBoolean != 0
+}
+
+func isInteger(typ Type) bool {
+ t, ok := typ.Underlying().(*Basic)
+ return ok && t.info&IsInteger != 0
+}
+
+func isUnsigned(typ Type) bool {
+ t, ok := typ.Underlying().(*Basic)
+ return ok && t.info&IsUnsigned != 0
+}
+
+func isFloat(typ Type) bool {
+ t, ok := typ.Underlying().(*Basic)
+ return ok && t.info&IsFloat != 0
+}
+
+func isComplex(typ Type) bool {
+ t, ok := typ.Underlying().(*Basic)
+ return ok && t.info&IsComplex != 0
+}
+
+func isNumeric(typ Type) bool {
+ t, ok := typ.Underlying().(*Basic)
+ return ok && t.info&IsNumeric != 0
+}
+
+func isString(typ Type) bool {
+ t, ok := typ.Underlying().(*Basic)
+ return ok && t.info&IsString != 0
+}
+
+func isTyped(typ Type) bool {
+ t, ok := typ.Underlying().(*Basic)
+ return !ok || t.info&IsUntyped == 0
+}
+
+func isUntyped(typ Type) bool {
+ t, ok := typ.Underlying().(*Basic)
+ return ok && t.info&IsUntyped != 0
+}
+
+func isOrdered(typ Type) bool {
+ t, ok := typ.Underlying().(*Basic)
+ return ok && t.info&IsOrdered != 0
+}
+
+func isConstType(typ Type) bool {
+ t, ok := typ.Underlying().(*Basic)
+ return ok && t.info&IsConstType != 0
+}
+
+// IsInterface reports whether typ is an interface type.
+func IsInterface(typ Type) bool {
+ _, ok := typ.Underlying().(*Interface)
+ return ok
+}
+
+// Comparable reports whether values of type T are comparable.
+func Comparable(T Type) bool {
+ switch t := T.Underlying().(type) {
+ case *Basic:
+ // assume invalid types to be comparable
+ // to avoid follow-up errors
+ return t.kind != UntypedNil
+ case *Pointer, *Interface, *Chan:
+ return true
+ case *Struct:
+ for _, f := range t.fields {
+ if !Comparable(f.typ) {
+ return false
+ }
+ }
+ return true
+ case *Array:
+ return Comparable(t.elem)
+ }
+ return false
+}
+
+// hasNil reports whether a type includes the nil value.
+func hasNil(typ Type) bool {
+ switch t := typ.Underlying().(type) {
+ case *Basic:
+ return t.kind == UnsafePointer
+ case *Slice, *Pointer, *Signature, *Interface, *Map, *Chan:
+ return true
+ }
+ return false
+}
+
+// Identical reports whether x and y are identical.
+func Identical(x, y Type) bool {
+ return identical(x, y, nil)
+}
+
+// An ifacePair is a node in a stack of interface type pairs compared for identity.
+type ifacePair struct {
+ x, y *Interface
+ prev *ifacePair
+}
+
+func (p *ifacePair) identical(q *ifacePair) bool {
+ return p.x == q.x && p.y == q.y || p.x == q.y && p.y == q.x
+}
+
+func identical(x, y Type, p *ifacePair) bool {
+ if x == y {
+ return true
+ }
+
+ switch x := x.(type) {
+ case *Basic:
+ // Basic types are singletons except for the rune and byte
+ // aliases, thus we cannot solely rely on the x == y check
+ // above.
+ if y, ok := y.(*Basic); ok {
+ return x.kind == y.kind
+ }
+
+ case *Array:
+ // Two array types are identical if they have identical element types
+ // and the same array length.
+ if y, ok := y.(*Array); ok {
+ return x.len == y.len && identical(x.elem, y.elem, p)
+ }
+
+ case *Slice:
+ // Two slice types are identical if they have identical element types.
+ if y, ok := y.(*Slice); ok {
+ return identical(x.elem, y.elem, p)
+ }
+
+ case *Struct:
+ // Two struct types are identical if they have the same sequence of fields,
+ // and if corresponding fields have the same names, and identical types,
+ // and identical tags. Two anonymous fields are considered to have the same
+ // name. Lower-case field names from different packages are always different.
+ if y, ok := y.(*Struct); ok {
+ if x.NumFields() == y.NumFields() {
+ for i, f := range x.fields {
+ g := y.fields[i]
+ if f.anonymous != g.anonymous ||
+ x.Tag(i) != y.Tag(i) ||
+ !f.sameId(g.pkg, g.name) ||
+ !identical(f.typ, g.typ, p) {
+ return false
+ }
+ }
+ return true
+ }
+ }
+
+ case *Pointer:
+ // Two pointer types are identical if they have identical base types.
+ if y, ok := y.(*Pointer); ok {
+ return identical(x.base, y.base, p)
+ }
+
+ case *Tuple:
+ // Two tuples types are identical if they have the same number of elements
+ // and corresponding elements have identical types.
+ if y, ok := y.(*Tuple); ok {
+ if x.Len() == y.Len() {
+ if x != nil {
+ for i, v := range x.vars {
+ w := y.vars[i]
+ if !identical(v.typ, w.typ, p) {
+ return false
+ }
+ }
+ }
+ return true
+ }
+ }
+
+ case *Signature:
+ // Two function types are identical if they have the same number of parameters
+ // and result values, corresponding parameter and result types are identical,
+ // and either both functions are variadic or neither is. Parameter and result
+ // names are not required to match.
+ if y, ok := y.(*Signature); ok {
+ return x.variadic == y.variadic &&
+ identical(x.params, y.params, p) &&
+ identical(x.results, y.results, p)
+ }
+
+ case *Interface:
+ // Two interface types are identical if they have the same set of methods with
+ // the same names and identical function types. Lower-case method names from
+ // different packages are always different. The order of the methods is irrelevant.
+ if y, ok := y.(*Interface); ok {
+ a := x.allMethods
+ b := y.allMethods
+ if len(a) == len(b) {
+ // Interface types are the only types where cycles can occur
+ // that are not "terminated" via named types; and such cycles
+ // can only be created via method parameter types that are
+ // anonymous interfaces (directly or indirectly) embedding
+ // the current interface. Example:
+ //
+ // type T interface {
+ // m() interface{T}
+ // }
+ //
+ // If two such (differently named) interfaces are compared,
+ // endless recursion occurs if the cycle is not detected.
+ //
+ // If x and y were compared before, they must be equal
+ // (if they were not, the recursion would have stopped);
+ // search the ifacePair stack for the same pair.
+ //
+ // This is a quadratic algorithm, but in practice these stacks
+ // are extremely short (bounded by the nesting depth of interface
+ // type declarations that recur via parameter types, an extremely
+ // rare occurrence). An alternative implementation might use a
+ // "visited" map, but that is probably less efficient overall.
+ q := &ifacePair{x, y, p}
+ for p != nil {
+ if p.identical(q) {
+ return true // same pair was compared before
+ }
+ p = p.prev
+ }
+ if debug {
+ assert(sort.IsSorted(byUniqueMethodName(a)))
+ assert(sort.IsSorted(byUniqueMethodName(b)))
+ }
+ for i, f := range a {
+ g := b[i]
+ if f.Id() != g.Id() || !identical(f.typ, g.typ, q) {
+ return false
+ }
+ }
+ return true
+ }
+ }
+
+ case *Map:
+ // Two map types are identical if they have identical key and value types.
+ if y, ok := y.(*Map); ok {
+ return identical(x.key, y.key, p) && identical(x.elem, y.elem, p)
+ }
+
+ case *Chan:
+ // Two channel types are identical if they have identical value types
+ // and the same direction.
+ if y, ok := y.(*Chan); ok {
+ return x.dir == y.dir && identical(x.elem, y.elem, p)
+ }
+
+ case *Named:
+ // Two named types are identical if their type names originate
+ // in the same type declaration.
+ if y, ok := y.(*Named); ok {
+ return x.obj == y.obj
+ }
+
+ default:
+ unreachable()
+ }
+
+ return false
+}
+
+// defaultType returns the default "typed" type for an "untyped" type;
+// it returns the incoming type for all other types. The default type
+// for untyped nil is untyped nil.
+//
+func defaultType(typ Type) Type {
+ if t, ok := typ.(*Basic); ok {
+ switch t.kind {
+ case UntypedBool:
+ return Typ[Bool]
+ case UntypedInt:
+ return Typ[Int]
+ case UntypedRune:
+ return universeRune // use 'rune' name
+ case UntypedFloat:
+ return Typ[Float64]
+ case UntypedComplex:
+ return Typ[Complex128]
+ case UntypedString:
+ return Typ[String]
+ }
+ }
+ return typ
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/resolver.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/resolver.go
new file mode 100644
index 0000000000..374ffc2800
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/resolver.go
@@ -0,0 +1,453 @@
+// 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.
+
+package types
+
+import (
+ "errors"
+ "fmt"
+ "go/ast"
+ "go/token"
+ pathLib "path"
+ "strconv"
+ "strings"
+ "unicode"
+
+ "golang.org/x/tools/go/exact"
+)
+
+// A declInfo describes a package-level const, type, var, or func declaration.
+type declInfo struct {
+ file *Scope // scope of file containing this declaration
+ lhs []*Var // lhs of n:1 variable declarations, or nil
+ typ ast.Expr // type, or nil
+ init ast.Expr // init expression, or nil
+ fdecl *ast.FuncDecl // func declaration, or nil
+
+ deps map[Object]bool // type and init dependencies; lazily allocated
+ mark int // for dependency analysis
+}
+
+// hasInitializer reports whether the declared object has an initialization
+// expression or function body.
+func (d *declInfo) hasInitializer() bool {
+ return d.init != nil || d.fdecl != nil && d.fdecl.Body != nil
+}
+
+// addDep adds obj as a dependency to d.
+func (d *declInfo) addDep(obj Object) {
+ m := d.deps
+ if m == nil {
+ m = make(map[Object]bool)
+ d.deps = m
+ }
+ m[obj] = true
+}
+
+// arityMatch checks that the lhs and rhs of a const or var decl
+// have the appropriate number of names and init exprs. For const
+// decls, init is the value spec providing the init exprs; for
+// var decls, init is nil (the init exprs are in s in this case).
+func (check *Checker) arityMatch(s, init *ast.ValueSpec) {
+ l := len(s.Names)
+ r := len(s.Values)
+ if init != nil {
+ r = len(init.Values)
+ }
+
+ switch {
+ case init == nil && r == 0:
+ // var decl w/o init expr
+ if s.Type == nil {
+ check.errorf(s.Pos(), "missing type or init expr")
+ }
+ case l < r:
+ if l < len(s.Values) {
+ // init exprs from s
+ n := s.Values[l]
+ check.errorf(n.Pos(), "extra init expr %s", n)
+ // TODO(gri) avoid declared but not used error here
+ } else {
+ // init exprs "inherited"
+ check.errorf(s.Pos(), "extra init expr at %s", init.Pos())
+ // TODO(gri) avoid declared but not used error here
+ }
+ case l > r && (init != nil || r != 1):
+ n := s.Names[r]
+ check.errorf(n.Pos(), "missing init expr for %s", n)
+ }
+}
+
+func validatedImportPath(path string) (string, error) {
+ s, err := strconv.Unquote(path)
+ if err != nil {
+ return "", err
+ }
+ if s == "" {
+ return "", fmt.Errorf("empty string")
+ }
+ const illegalChars = `!"#$%&'()*,:;<=>?[\]^{|}` + "`\uFFFD"
+ for _, r := range s {
+ if !unicode.IsGraphic(r) || unicode.IsSpace(r) || strings.ContainsRune(illegalChars, r) {
+ return s, fmt.Errorf("invalid character %#U", r)
+ }
+ }
+ return s, nil
+}
+
+// declarePkgObj declares obj in the package scope, records its ident -> obj mapping,
+// and updates check.objMap. The object must not be a function or method.
+func (check *Checker) declarePkgObj(ident *ast.Ident, obj Object, d *declInfo) {
+ assert(ident.Name == obj.Name())
+
+ // spec: "A package-scope or file-scope identifier with name init
+ // may only be declared to be a function with this (func()) signature."
+ if ident.Name == "init" {
+ check.errorf(ident.Pos(), "cannot declare init - must be func")
+ return
+ }
+
+ check.declare(check.pkg.scope, ident, obj, token.NoPos)
+ check.objMap[obj] = d
+ obj.setOrder(uint32(len(check.objMap)))
+}
+
+// filename returns a filename suitable for debugging output.
+func (check *Checker) filename(fileNo int) string {
+ file := check.files[fileNo]
+ if pos := file.Pos(); pos.IsValid() {
+ return check.fset.File(pos).Name()
+ }
+ return fmt.Sprintf("file[%d]", fileNo)
+}
+
+// collectObjects collects all file and package objects and inserts them
+// into their respective scopes. It also performs imports and associates
+// methods with receiver base type names.
+func (check *Checker) collectObjects() {
+ pkg := check.pkg
+
+ importer := check.conf.Import
+ if importer == nil {
+ if DefaultImport != nil {
+ importer = DefaultImport
+ } else {
+ // Panic if we encounter an import.
+ importer = func(map[string]*Package, string) (*Package, error) {
+ panic(`no Config.Import or DefaultImport (missing import _ "golang.org/x/tools/go/gcimporter"?)`)
+ }
+ }
+ }
+
+ // pkgImports is the set of packages already imported by any package file seen
+ // so far. Used to avoid duplicate entries in pkg.imports. Allocate and populate
+ // it (pkg.imports may not be empty if we are checking test files incrementally).
+ var pkgImports = make(map[*Package]bool)
+ for _, imp := range pkg.imports {
+ pkgImports[imp] = true
+ }
+
+ for fileNo, file := range check.files {
+ // The package identifier denotes the current package,
+ // but there is no corresponding package object.
+ check.recordDef(file.Name, nil)
+
+ // Use the actual source file extent rather than *ast.File extent since the
+ // latter doesn't include comments which appear at the start or end of the file.
+ // Be conservative and use the *ast.File extent if we don't have a *token.File.
+ pos, end := file.Pos(), file.End()
+ if f := check.fset.File(file.Pos()); f != nil {
+ pos, end = token.Pos(f.Base()), token.Pos(f.Base()+f.Size())
+ }
+ fileScope := NewScope(check.pkg.scope, pos, end, check.filename(fileNo))
+ check.recordScope(file, fileScope)
+
+ for _, decl := range file.Decls {
+ switch d := decl.(type) {
+ case *ast.BadDecl:
+ // ignore
+
+ case *ast.GenDecl:
+ var last *ast.ValueSpec // last ValueSpec with type or init exprs seen
+ for iota, spec := range d.Specs {
+ switch s := spec.(type) {
+ case *ast.ImportSpec:
+ // import package
+ var imp *Package
+ path, err := validatedImportPath(s.Path.Value)
+ if err != nil {
+ check.errorf(s.Path.Pos(), "invalid import path (%s)", err)
+ continue
+ }
+ if path == "C" && check.conf.FakeImportC {
+ // TODO(gri) shouldn't create a new one each time
+ imp = NewPackage("C", "C")
+ imp.fake = true
+ } else {
+ var err error
+ imp, err = importer(check.conf.Packages, path)
+ if imp == nil && err == nil {
+ err = errors.New("Config.Import returned nil but no error")
+ }
+ if err != nil {
+ check.errorf(s.Path.Pos(), "could not import %s (%s)", path, err)
+ continue
+ }
+ }
+
+ // add package to list of explicit imports
+ // (this functionality is provided as a convenience
+ // for clients; it is not needed for type-checking)
+ if !pkgImports[imp] {
+ pkgImports[imp] = true
+ if imp != Unsafe {
+ pkg.imports = append(pkg.imports, imp)
+ }
+ }
+
+ // local name overrides imported package name
+ name := imp.name
+ if s.Name != nil {
+ name = s.Name.Name
+ if name == "init" {
+ check.errorf(s.Name.Pos(), "cannot declare init - must be func")
+ continue
+ }
+ }
+
+ obj := NewPkgName(s.Pos(), pkg, name, imp)
+ if s.Name != nil {
+ // in a dot-import, the dot represents the package
+ check.recordDef(s.Name, obj)
+ } else {
+ check.recordImplicit(s, obj)
+ }
+
+ // add import to file scope
+ if name == "." {
+ // merge imported scope with file scope
+ for _, obj := range imp.scope.elems {
+ // A package scope may contain non-exported objects,
+ // do not import them!
+ if obj.Exported() {
+ // TODO(gri) When we import a package, we create
+ // a new local package object. We should do the
+ // same for each dot-imported object. That way
+ // they can have correct position information.
+ // (We must not modify their existing position
+ // information because the same package - found
+ // via Config.Packages - may be dot-imported in
+ // another package!)
+ check.declare(fileScope, nil, obj, token.NoPos)
+ check.recordImplicit(s, obj)
+ }
+ }
+ // add position to set of dot-import positions for this file
+ // (this is only needed for "imported but not used" errors)
+ check.addUnusedDotImport(fileScope, imp, s.Pos())
+ } else {
+ // declare imported package object in file scope
+ check.declare(fileScope, nil, obj, token.NoPos)
+ }
+
+ case *ast.ValueSpec:
+ switch d.Tok {
+ case token.CONST:
+ // determine which initialization expressions to use
+ switch {
+ case s.Type != nil || len(s.Values) > 0:
+ last = s
+ case last == nil:
+ last = new(ast.ValueSpec) // make sure last exists
+ }
+
+ // declare all constants
+ for i, name := range s.Names {
+ obj := NewConst(name.Pos(), pkg, name.Name, nil, exact.MakeInt64(int64(iota)))
+
+ var init ast.Expr
+ if i < len(last.Values) {
+ init = last.Values[i]
+ }
+
+ d := &declInfo{file: fileScope, typ: last.Type, init: init}
+ check.declarePkgObj(name, obj, d)
+ }
+
+ check.arityMatch(s, last)
+
+ case token.VAR:
+ lhs := make([]*Var, len(s.Names))
+ // If there's exactly one rhs initializer, use
+ // the same declInfo d1 for all lhs variables
+ // so that each lhs variable depends on the same
+ // rhs initializer (n:1 var declaration).
+ var d1 *declInfo
+ if len(s.Values) == 1 {
+ // The lhs elements are only set up after the for loop below,
+ // but that's ok because declareVar only collects the declInfo
+ // for a later phase.
+ d1 = &declInfo{file: fileScope, lhs: lhs, typ: s.Type, init: s.Values[0]}
+ }
+
+ // declare all variables
+ for i, name := range s.Names {
+ obj := NewVar(name.Pos(), pkg, name.Name, nil)
+ lhs[i] = obj
+
+ d := d1
+ if d == nil {
+ // individual assignments
+ var init ast.Expr
+ if i < len(s.Values) {
+ init = s.Values[i]
+ }
+ d = &declInfo{file: fileScope, typ: s.Type, init: init}
+ }
+
+ check.declarePkgObj(name, obj, d)
+ }
+
+ check.arityMatch(s, nil)
+
+ default:
+ check.invalidAST(s.Pos(), "invalid token %s", d.Tok)
+ }
+
+ case *ast.TypeSpec:
+ obj := NewTypeName(s.Name.Pos(), pkg, s.Name.Name, nil)
+ check.declarePkgObj(s.Name, obj, &declInfo{file: fileScope, typ: s.Type})
+
+ default:
+ check.invalidAST(s.Pos(), "unknown ast.Spec node %T", s)
+ }
+ }
+
+ case *ast.FuncDecl:
+ name := d.Name.Name
+ obj := NewFunc(d.Name.Pos(), pkg, name, nil)
+ if d.Recv == nil {
+ // regular function
+ if name == "init" {
+ // don't declare init functions in the package scope - they are invisible
+ obj.parent = pkg.scope
+ check.recordDef(d.Name, obj)
+ // init functions must have a body
+ if d.Body == nil {
+ check.softErrorf(obj.pos, "missing function body")
+ }
+ } else {
+ check.declare(pkg.scope, d.Name, obj, token.NoPos)
+ }
+ } else {
+ // method
+ check.recordDef(d.Name, obj)
+ // Associate method with receiver base type name, if possible.
+ // Ignore methods that have an invalid receiver, or a blank _
+ // receiver name. They will be type-checked later, with regular
+ // functions.
+ if list := d.Recv.List; len(list) > 0 {
+ typ := list[0].Type
+ if ptr, _ := typ.(*ast.StarExpr); ptr != nil {
+ typ = ptr.X
+ }
+ if base, _ := typ.(*ast.Ident); base != nil && base.Name != "_" {
+ check.assocMethod(base.Name, obj)
+ }
+ }
+ }
+ info := &declInfo{file: fileScope, fdecl: d}
+ check.objMap[obj] = info
+ obj.setOrder(uint32(len(check.objMap)))
+
+ default:
+ check.invalidAST(d.Pos(), "unknown ast.Decl node %T", d)
+ }
+ }
+ }
+
+ // verify that objects in package and file scopes have different names
+ for _, scope := range check.pkg.scope.children /* file scopes */ {
+ for _, obj := range scope.elems {
+ if alt := pkg.scope.Lookup(obj.Name()); alt != nil {
+ if pkg, ok := obj.(*PkgName); ok {
+ check.errorf(alt.Pos(), "%s already declared through import of %s", alt.Name(), pkg.Imported())
+ check.reportAltDecl(pkg)
+ } else {
+ check.errorf(alt.Pos(), "%s already declared through dot-import of %s", alt.Name(), obj.Pkg())
+ // TODO(gri) dot-imported objects don't have a position; reportAltDecl won't print anything
+ check.reportAltDecl(obj)
+ }
+ }
+ }
+ }
+}
+
+// packageObjects typechecks all package objects in objList, but not function bodies.
+func (check *Checker) packageObjects(objList []Object) {
+ // add new methods to already type-checked types (from a prior Checker.Files call)
+ for _, obj := range objList {
+ if obj, _ := obj.(*TypeName); obj != nil && obj.typ != nil {
+ check.addMethodDecls(obj)
+ }
+ }
+
+ // pre-allocate space for type declaration paths so that the underlying array is reused
+ typePath := make([]*TypeName, 0, 8)
+
+ for _, obj := range objList {
+ check.objDecl(obj, nil, typePath)
+ }
+
+ // At this point we may have a non-empty check.methods map; this means that not all
+ // entries were deleted at the end of typeDecl because the respective receiver base
+ // types were not found. In that case, an error was reported when declaring those
+ // methods. We can now safely discard this map.
+ check.methods = nil
+}
+
+// functionBodies typechecks all function bodies.
+func (check *Checker) functionBodies() {
+ for _, f := range check.funcs {
+ check.funcBody(f.decl, f.name, f.sig, f.body)
+ }
+}
+
+// unusedImports checks for unused imports.
+func (check *Checker) unusedImports() {
+ // if function bodies are not checked, packages' uses are likely missing - don't check
+ if check.conf.IgnoreFuncBodies {
+ return
+ }
+
+ // spec: "It is illegal (...) to directly import a package without referring to
+ // any of its exported identifiers. To import a package solely for its side-effects
+ // (initialization), use the blank identifier as explicit package name."
+
+ // check use of regular imported packages
+ for _, scope := range check.pkg.scope.children /* file scopes */ {
+ for _, obj := range scope.elems {
+ if obj, ok := obj.(*PkgName); ok {
+ // Unused "blank imports" are automatically ignored
+ // since _ identifiers are not entered into scopes.
+ if !obj.used {
+ path := obj.imported.path
+ base := pathLib.Base(path)
+ if obj.name == base {
+ check.softErrorf(obj.pos, "%q imported but not used", path)
+ } else {
+ check.softErrorf(obj.pos, "%q imported but not used as %s", path, obj.name)
+ }
+ }
+ }
+ }
+ }
+
+ // check use of dot-imported packages
+ for _, unusedDotImports := range check.unusedDotImports {
+ for pkg, pos := range unusedDotImports {
+ check.softErrorf(pos, "%q imported but not used", pkg.path)
+ }
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/resolver_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/resolver_test.go
new file mode 100644
index 0000000000..2ef1f18648
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/resolver_test.go
@@ -0,0 +1,189 @@
+// Copyright 2011 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.
+
+package types_test
+
+import (
+ "fmt"
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "sort"
+ "testing"
+
+ _ "golang.org/x/tools/go/gcimporter"
+ . "golang.org/x/tools/go/types"
+)
+
+func TestResolveIdents(t *testing.T) {
+ skipSpecialPlatforms(t)
+
+ sources := []string{
+ `
+ package p
+ import "fmt"
+ import "math"
+ const pi = math.Pi
+ func sin(x float64) float64 {
+ return math.Sin(x)
+ }
+ var Println = fmt.Println
+ `,
+ `
+ package p
+ import "fmt"
+ type errorStringer struct { fmt.Stringer; error }
+ func f() string {
+ _ = "foo"
+ return fmt.Sprintf("%d", g())
+ }
+ func g() (x int) { return }
+ `,
+ `
+ package p
+ import . "go/parser"
+ import "sync"
+ func h() Mode { return ImportsOnly }
+ var _, x int = 1, 2
+ func init() {}
+ type T struct{ *sync.Mutex; a, b, c int}
+ type I interface{ m() }
+ var _ = T{a: 1, b: 2, c: 3}
+ func (_ T) m() {}
+ func (T) _() {}
+ var i I
+ var _ = i.m
+ func _(s []int) { for i, x := range s { _, _ = i, x } }
+ func _(x interface{}) {
+ switch x := x.(type) {
+ case int:
+ _ = x
+ }
+ switch {} // implicit 'true' tag
+ }
+ `,
+ `
+ package p
+ type S struct{}
+ func (T) _() {}
+ func (T) _() {}
+ `,
+ `
+ package p
+ func _() {
+ L0:
+ L1:
+ goto L0
+ for {
+ goto L1
+ }
+ if true {
+ goto L2
+ }
+ L2:
+ }
+ `,
+ }
+
+ pkgnames := []string{
+ "fmt",
+ "math",
+ }
+
+ // parse package files
+ fset := token.NewFileSet()
+ var files []*ast.File
+ for i, src := range sources {
+ f, err := parser.ParseFile(fset, fmt.Sprintf("sources[%d]", i), src, parser.DeclarationErrors)
+ if err != nil {
+ t.Fatal(err)
+ }
+ files = append(files, f)
+ }
+
+ // resolve and type-check package AST
+ var conf Config
+ uses := make(map[*ast.Ident]Object)
+ defs := make(map[*ast.Ident]Object)
+ _, err := conf.Check("testResolveIdents", fset, files, &Info{Defs: defs, Uses: uses})
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // check that all packages were imported
+ for _, name := range pkgnames {
+ if conf.Packages[name] == nil {
+ t.Errorf("package %s not imported", name)
+ }
+ }
+
+ // check that qualified identifiers are resolved
+ for _, f := range files {
+ ast.Inspect(f, func(n ast.Node) bool {
+ if s, ok := n.(*ast.SelectorExpr); ok {
+ if x, ok := s.X.(*ast.Ident); ok {
+ obj := uses[x]
+ if obj == nil {
+ t.Errorf("%s: unresolved qualified identifier %s", fset.Position(x.Pos()), x.Name)
+ return false
+ }
+ if _, ok := obj.(*PkgName); ok && uses[s.Sel] == nil {
+ t.Errorf("%s: unresolved selector %s", fset.Position(s.Sel.Pos()), s.Sel.Name)
+ return false
+ }
+ return false
+ }
+ return false
+ }
+ return true
+ })
+ }
+
+ for id, obj := range uses {
+ if obj == nil {
+ t.Errorf("%s: Uses[%s] == nil", fset.Position(id.Pos()), id.Name)
+ }
+ }
+
+ // check that each identifier in the source is found in uses or defs or both
+ var both []string
+ for _, f := range files {
+ ast.Inspect(f, func(n ast.Node) bool {
+ if x, ok := n.(*ast.Ident); ok {
+ var objects int
+ if _, found := uses[x]; found {
+ objects |= 1
+ delete(uses, x)
+ }
+ if _, found := defs[x]; found {
+ objects |= 2
+ delete(defs, x)
+ }
+ if objects == 0 {
+ t.Errorf("%s: unresolved identifier %s", fset.Position(x.Pos()), x.Name)
+ } else if objects == 3 {
+ both = append(both, x.Name)
+ }
+ return false
+ }
+ return true
+ })
+ }
+
+ // check the expected set of idents that are simultaneously uses and defs
+ sort.Strings(both)
+ if got, want := fmt.Sprint(both), "[Mutex Stringer error]"; got != want {
+ t.Errorf("simultaneous uses/defs = %s, want %s", got, want)
+ }
+
+ // any left-over identifiers didn't exist in the source
+ for x := range uses {
+ t.Errorf("%s: identifier %s not present in source", fset.Position(x.Pos()), x.Name)
+ }
+ for x := range defs {
+ t.Errorf("%s: identifier %s not present in source", fset.Position(x.Pos()), x.Name)
+ }
+
+ // TODO(gri) add tests to check ImplicitObj callbacks
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/return.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/return.go
new file mode 100644
index 0000000000..6628985214
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/return.go
@@ -0,0 +1,185 @@
+// 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.
+
+// This file implements isTerminating.
+
+package types
+
+import (
+ "go/ast"
+ "go/token"
+)
+
+// isTerminating reports if s is a terminating statement.
+// If s is labeled, label is the label name; otherwise s
+// is "".
+func (check *Checker) isTerminating(s ast.Stmt, label string) bool {
+ switch s := s.(type) {
+ default:
+ unreachable()
+
+ case *ast.BadStmt, *ast.DeclStmt, *ast.EmptyStmt, *ast.SendStmt,
+ *ast.IncDecStmt, *ast.AssignStmt, *ast.GoStmt, *ast.DeferStmt,
+ *ast.RangeStmt:
+ // no chance
+
+ case *ast.LabeledStmt:
+ return check.isTerminating(s.Stmt, s.Label.Name)
+
+ case *ast.ExprStmt:
+ // the predeclared (possibly parenthesized) panic() function is terminating
+ if call, _ := unparen(s.X).(*ast.CallExpr); call != nil {
+ if id, _ := call.Fun.(*ast.Ident); id != nil {
+ if _, obj := check.scope.LookupParent(id.Name, token.NoPos); obj != nil {
+ if b, _ := obj.(*Builtin); b != nil && b.id == _Panic {
+ return true
+ }
+ }
+ }
+ }
+
+ case *ast.ReturnStmt:
+ return true
+
+ case *ast.BranchStmt:
+ if s.Tok == token.GOTO || s.Tok == token.FALLTHROUGH {
+ return true
+ }
+
+ case *ast.BlockStmt:
+ return check.isTerminatingList(s.List, "")
+
+ case *ast.IfStmt:
+ if s.Else != nil &&
+ check.isTerminating(s.Body, "") &&
+ check.isTerminating(s.Else, "") {
+ return true
+ }
+
+ case *ast.SwitchStmt:
+ return check.isTerminatingSwitch(s.Body, label)
+
+ case *ast.TypeSwitchStmt:
+ return check.isTerminatingSwitch(s.Body, label)
+
+ case *ast.SelectStmt:
+ for _, s := range s.Body.List {
+ cc := s.(*ast.CommClause)
+ if !check.isTerminatingList(cc.Body, "") || hasBreakList(cc.Body, label, true) {
+ return false
+ }
+
+ }
+ return true
+
+ case *ast.ForStmt:
+ if s.Cond == nil && !hasBreak(s.Body, label, true) {
+ return true
+ }
+ }
+
+ return false
+}
+
+func (check *Checker) isTerminatingList(list []ast.Stmt, label string) bool {
+ n := len(list)
+ return n > 0 && check.isTerminating(list[n-1], label)
+}
+
+func (check *Checker) isTerminatingSwitch(body *ast.BlockStmt, label string) bool {
+ hasDefault := false
+ for _, s := range body.List {
+ cc := s.(*ast.CaseClause)
+ if cc.List == nil {
+ hasDefault = true
+ }
+ if !check.isTerminatingList(cc.Body, "") || hasBreakList(cc.Body, label, true) {
+ return false
+ }
+ }
+ return hasDefault
+}
+
+// TODO(gri) For nested breakable statements, the current implementation of hasBreak
+// will traverse the same subtree repeatedly, once for each label. Replace
+// with a single-pass label/break matching phase.
+
+// hasBreak reports if s is or contains a break statement
+// referring to the label-ed statement or implicit-ly the
+// closest outer breakable statement.
+func hasBreak(s ast.Stmt, label string, implicit bool) bool {
+ switch s := s.(type) {
+ default:
+ unreachable()
+
+ case *ast.BadStmt, *ast.DeclStmt, *ast.EmptyStmt, *ast.ExprStmt,
+ *ast.SendStmt, *ast.IncDecStmt, *ast.AssignStmt, *ast.GoStmt,
+ *ast.DeferStmt, *ast.ReturnStmt:
+ // no chance
+
+ case *ast.LabeledStmt:
+ return hasBreak(s.Stmt, label, implicit)
+
+ case *ast.BranchStmt:
+ if s.Tok == token.BREAK {
+ if s.Label == nil {
+ return implicit
+ }
+ if s.Label.Name == label {
+ return true
+ }
+ }
+
+ case *ast.BlockStmt:
+ return hasBreakList(s.List, label, implicit)
+
+ case *ast.IfStmt:
+ if hasBreak(s.Body, label, implicit) ||
+ s.Else != nil && hasBreak(s.Else, label, implicit) {
+ return true
+ }
+
+ case *ast.CaseClause:
+ return hasBreakList(s.Body, label, implicit)
+
+ case *ast.SwitchStmt:
+ if label != "" && hasBreak(s.Body, label, false) {
+ return true
+ }
+
+ case *ast.TypeSwitchStmt:
+ if label != "" && hasBreak(s.Body, label, false) {
+ return true
+ }
+
+ case *ast.CommClause:
+ return hasBreakList(s.Body, label, implicit)
+
+ case *ast.SelectStmt:
+ if label != "" && hasBreak(s.Body, label, false) {
+ return true
+ }
+
+ case *ast.ForStmt:
+ if label != "" && hasBreak(s.Body, label, false) {
+ return true
+ }
+
+ case *ast.RangeStmt:
+ if label != "" && hasBreak(s.Body, label, false) {
+ return true
+ }
+ }
+
+ return false
+}
+
+func hasBreakList(list []ast.Stmt, label string, implicit bool) bool {
+ for _, s := range list {
+ if hasBreak(s, label, implicit) {
+ return true
+ }
+ }
+ return false
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/scope.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/scope.go
new file mode 100644
index 0000000000..3502840225
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/scope.go
@@ -0,0 +1,190 @@
+// 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.
+
+// This file implements Scopes.
+
+package types
+
+import (
+ "bytes"
+ "fmt"
+ "go/token"
+ "io"
+ "sort"
+ "strings"
+)
+
+// TODO(gri) Provide scopes with a name or other mechanism so that
+// objects can use that information for better printing.
+
+// A Scope maintains a set of objects and links to its containing
+// (parent) and contained (children) scopes. Objects may be inserted
+// and looked up by name. The zero value for Scope is a ready-to-use
+// empty scope.
+type Scope struct {
+ parent *Scope
+ children []*Scope
+ elems map[string]Object // lazily allocated
+ pos, end token.Pos // scope extent; may be invalid
+ comment string // for debugging only
+}
+
+// NewScope returns a new, empty scope contained in the given parent
+// scope, if any. The comment is for debugging only.
+func NewScope(parent *Scope, pos, end token.Pos, comment string) *Scope {
+ s := &Scope{parent, nil, nil, pos, end, comment}
+ // don't add children to Universe scope!
+ if parent != nil && parent != Universe {
+ parent.children = append(parent.children, s)
+ }
+ return s
+}
+
+// Parent returns the scope's containing (parent) scope.
+func (s *Scope) Parent() *Scope { return s.parent }
+
+// Len() returns the number of scope elements.
+func (s *Scope) Len() int { return len(s.elems) }
+
+// Names returns the scope's element names in sorted order.
+func (s *Scope) Names() []string {
+ names := make([]string, len(s.elems))
+ i := 0
+ for name := range s.elems {
+ names[i] = name
+ i++
+ }
+ sort.Strings(names)
+ return names
+}
+
+// NumChildren() returns the number of scopes nested in s.
+func (s *Scope) NumChildren() int { return len(s.children) }
+
+// Child returns the i'th child scope for 0 <= i < NumChildren().
+func (s *Scope) Child(i int) *Scope { return s.children[i] }
+
+// Lookup returns the object in scope s with the given name if such an
+// object exists; otherwise the result is nil.
+func (s *Scope) Lookup(name string) Object {
+ return s.elems[name]
+}
+
+// LookupParent follows the parent chain of scopes starting with s until
+// it finds a scope where Lookup(name) returns a non-nil object, and then
+// returns that scope and object. If a valid position pos is provided,
+// only objects that were declared at or before pos are considered.
+// If no such scope and object exists, the result is (nil, nil).
+//
+// Note that obj.Parent() may be different from the returned scope if the
+// object was inserted into the scope and already had a parent at that
+// time (see Insert, below). This can only happen for dot-imported objects
+// whose scope is the scope of the package that exported them.
+func (s *Scope) LookupParent(name string, pos token.Pos) (*Scope, Object) {
+ for ; s != nil; s = s.parent {
+ if obj := s.elems[name]; obj != nil && (!pos.IsValid() || obj.scopePos() <= pos) {
+ return s, obj
+ }
+ }
+ return nil, nil
+}
+
+// Insert attempts to insert an object obj into scope s.
+// If s already contains an alternative object alt with
+// the same name, Insert leaves s unchanged and returns alt.
+// Otherwise it inserts obj, sets the object's parent scope
+// if not already set, and returns nil.
+func (s *Scope) Insert(obj Object) Object {
+ name := obj.Name()
+ if alt := s.elems[name]; alt != nil {
+ return alt
+ }
+ if s.elems == nil {
+ s.elems = make(map[string]Object)
+ }
+ s.elems[name] = obj
+ if obj.Parent() == nil {
+ obj.setParent(s)
+ }
+ return nil
+}
+
+// Pos and End describe the scope's source code extent [pos, end).
+// The results are guaranteed to be valid only if the type-checked
+// AST has complete position information. The extent is undefined
+// for Universe and package scopes.
+func (s *Scope) Pos() token.Pos { return s.pos }
+func (s *Scope) End() token.Pos { return s.end }
+
+// Contains returns true if pos is within the scope's extent.
+// The result is guaranteed to be valid only if the type-checked
+// AST has complete position information.
+func (s *Scope) Contains(pos token.Pos) bool {
+ return s.pos <= pos && pos < s.end
+}
+
+// Innermost returns the innermost (child) scope containing
+// pos. If pos is not within any scope, the result is nil.
+// The result is also nil for the Universe scope.
+// The result is guaranteed to be valid only if the type-checked
+// AST has complete position information.
+func (s *Scope) Innermost(pos token.Pos) *Scope {
+ // Package scopes do not have extents since they may be
+ // discontiguous, so iterate over the package's files.
+ if s.parent == Universe {
+ for _, s := range s.children {
+ if inner := s.Innermost(pos); inner != nil {
+ return inner
+ }
+ }
+ }
+
+ if s.Contains(pos) {
+ for _, s := range s.children {
+ if s.Contains(pos) {
+ return s.Innermost(pos)
+ }
+ }
+ return s
+ }
+ return nil
+}
+
+// WriteTo writes a string representation of the scope to w,
+// with the scope elements sorted by name.
+// The level of indentation is controlled by n >= 0, with
+// n == 0 for no indentation.
+// If recurse is set, it also writes nested (children) scopes.
+func (s *Scope) WriteTo(w io.Writer, n int, recurse bool) {
+ const ind = ". "
+ indn := strings.Repeat(ind, n)
+
+ fmt.Fprintf(w, "%s%s scope %p {", indn, s.comment, s)
+ if len(s.elems) == 0 {
+ fmt.Fprintf(w, "}\n")
+ return
+ }
+
+ fmt.Fprintln(w)
+ indn1 := indn + ind
+ for _, name := range s.Names() {
+ fmt.Fprintf(w, "%s%s\n", indn1, s.elems[name])
+ }
+
+ if recurse {
+ for _, s := range s.children {
+ fmt.Fprintln(w)
+ s.WriteTo(w, n+1, recurse)
+ }
+ }
+
+ fmt.Fprintf(w, "%s}", indn)
+}
+
+// String returns a string representation of the scope, for debugging.
+func (s *Scope) String() string {
+ var buf bytes.Buffer
+ s.WriteTo(&buf, 0, false)
+ return buf.String()
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/selection.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/selection.go
new file mode 100644
index 0000000000..124e0d39f0
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/selection.go
@@ -0,0 +1,143 @@
+// 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.
+
+// This file implements Selections.
+
+package types
+
+import (
+ "bytes"
+ "fmt"
+)
+
+// SelectionKind describes the kind of a selector expression x.f
+// (excluding qualified identifiers).
+type SelectionKind int
+
+const (
+ FieldVal SelectionKind = iota // x.f is a struct field selector
+ MethodVal // x.f is a method selector
+ MethodExpr // x.f is a method expression
+)
+
+// A Selection describes a selector expression x.f.
+// For the declarations:
+//
+// type T struct{ x int; E }
+// type E struct{}
+// func (e E) m() {}
+// var p *T
+//
+// the following relations exist:
+//
+// Selector Kind Recv Obj Type Index Indirect
+//
+// p.x FieldVal T x int {0} true
+// p.m MethodVal *T m func (e *T) m() {1, 0} true
+// T.m MethodExpr T m func m(_ T) {1, 0} false
+//
+type Selection struct {
+ kind SelectionKind
+ recv Type // type of x
+ obj Object // object denoted by x.f
+ index []int // path from x to x.f
+ indirect bool // set if there was any pointer indirection on the path
+}
+
+// Kind returns the selection kind.
+func (s *Selection) Kind() SelectionKind { return s.kind }
+
+// Recv returns the type of x in x.f.
+func (s *Selection) Recv() Type { return s.recv }
+
+// Obj returns the object denoted by x.f; a *Var for
+// a field selection, and a *Func in all other cases.
+func (s *Selection) Obj() Object { return s.obj }
+
+// Type returns the type of x.f, which may be different from the type of f.
+// See Selection for more information.
+func (s *Selection) Type() Type {
+ switch s.kind {
+ case MethodVal:
+ // The type of x.f is a method with its receiver type set
+ // to the type of x.
+ sig := *s.obj.(*Func).typ.(*Signature)
+ recv := *sig.recv
+ recv.typ = s.recv
+ sig.recv = &recv
+ return &sig
+
+ case MethodExpr:
+ // The type of x.f is a function (without receiver)
+ // and an additional first argument with the same type as x.
+ // TODO(gri) Similar code is already in call.go - factor!
+ // TODO(gri) Compute this eagerly to avoid allocations.
+ sig := *s.obj.(*Func).typ.(*Signature)
+ arg0 := *sig.recv
+ sig.recv = nil
+ arg0.typ = s.recv
+ var params []*Var
+ if sig.params != nil {
+ params = sig.params.vars
+ }
+ sig.params = NewTuple(append([]*Var{&arg0}, params...)...)
+ return &sig
+ }
+
+ // In all other cases, the type of x.f is the type of x.
+ return s.obj.Type()
+}
+
+// Index describes the path from x to f in x.f.
+// The last index entry is the field or method index of the type declaring f;
+// either:
+//
+// 1) the list of declared methods of a named type; or
+// 2) the list of methods of an interface type; or
+// 3) the list of fields of a struct type.
+//
+// The earlier index entries are the indices of the embedded fields implicitly
+// traversed to get from (the type of) x to f, starting at embedding depth 0.
+func (s *Selection) Index() []int { return s.index }
+
+// Indirect reports whether any pointer indirection was required to get from
+// x to f in x.f.
+func (s *Selection) Indirect() bool { return s.indirect }
+
+func (s *Selection) String() string { return SelectionString(s, nil) }
+
+// SelectionString returns the string form of s.
+// The Qualifier controls the printing of
+// package-level objects, and may be nil.
+//
+// Examples:
+// "field (T) f int"
+// "method (T) f(X) Y"
+// "method expr (T) f(X) Y"
+//
+func SelectionString(s *Selection, qf Qualifier) string {
+ var k string
+ switch s.kind {
+ case FieldVal:
+ k = "field "
+ case MethodVal:
+ k = "method "
+ case MethodExpr:
+ k = "method expr "
+ default:
+ unreachable()
+ }
+ var buf bytes.Buffer
+ buf.WriteString(k)
+ buf.WriteByte('(')
+ WriteType(&buf, s.Recv(), qf)
+ fmt.Fprintf(&buf, ") %s", s.obj.Name())
+ if T := s.Type(); s.kind == FieldVal {
+ buf.WriteByte(' ')
+ WriteType(&buf, T, qf)
+ } else {
+ WriteSignature(&buf, T.(*Signature), qf)
+ }
+ return buf.String()
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/self_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/self_test.go
new file mode 100644
index 0000000000..01d12c71a0
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/self_test.go
@@ -0,0 +1,101 @@
+// 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.
+
+package types_test
+
+import (
+ "flag"
+ "fmt"
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "path/filepath"
+ "testing"
+ "time"
+
+ _ "golang.org/x/tools/go/gcimporter"
+ . "golang.org/x/tools/go/types"
+)
+
+var benchmark = flag.Bool("b", false, "run benchmarks")
+
+func TestSelf(t *testing.T) {
+ fset := token.NewFileSet()
+ files, err := pkgFiles(fset, ".")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ _, err = Check("go/types", fset, files)
+ if err != nil {
+ // Importing go.tools/go/exact doensn't work in the
+ // build dashboard environment. Don't report an error
+ // for now so that the build remains green.
+ // TODO(gri) fix this
+ t.Log(err) // replace w/ t.Fatal eventually
+ return
+ }
+}
+
+func TestBenchmark(t *testing.T) {
+ if !*benchmark {
+ return
+ }
+
+ // We're not using testing's benchmarking mechanism directly
+ // because we want custom output.
+
+ for _, p := range []string{"types", "exact", "gcimporter"} {
+ path := filepath.Join("..", p)
+ runbench(t, path, false)
+ runbench(t, path, true)
+ fmt.Println()
+ }
+}
+
+func runbench(t *testing.T, path string, ignoreFuncBodies bool) {
+ fset := token.NewFileSet()
+ files, err := pkgFiles(fset, path)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ b := testing.Benchmark(func(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ conf := Config{IgnoreFuncBodies: ignoreFuncBodies}
+ conf.Check(path, fset, files, nil)
+ }
+ })
+
+ // determine line count
+ lines := 0
+ fset.Iterate(func(f *token.File) bool {
+ lines += f.LineCount()
+ return true
+ })
+
+ d := time.Duration(b.NsPerOp())
+ fmt.Printf(
+ "%s: %s for %d lines (%d lines/s), ignoreFuncBodies = %v\n",
+ filepath.Base(path), d, lines, int64(float64(lines)/d.Seconds()), ignoreFuncBodies,
+ )
+}
+
+func pkgFiles(fset *token.FileSet, path string) ([]*ast.File, error) {
+ filenames, err := pkgFilenames(path) // from stdlib_test.go
+ if err != nil {
+ return nil, err
+ }
+
+ var files []*ast.File
+ for _, filename := range filenames {
+ file, err := parser.ParseFile(fset, filename, nil, 0)
+ if err != nil {
+ return nil, err
+ }
+ files = append(files, file)
+ }
+
+ return files, nil
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/sizes.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/sizes.go
new file mode 100644
index 0000000000..56fb310c29
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/sizes.go
@@ -0,0 +1,211 @@
+// 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.
+
+// This file implements Sizes.
+
+package types
+
+// Sizes defines the sizing functions for package unsafe.
+type Sizes interface {
+ // Alignof returns the alignment of a variable of type T.
+ // Alignof must implement the alignment guarantees required by the spec.
+ Alignof(T Type) int64
+
+ // Offsetsof returns the offsets of the given struct fields, in bytes.
+ // Offsetsof must implement the offset guarantees required by the spec.
+ Offsetsof(fields []*Var) []int64
+
+ // Sizeof returns the size of a variable of type T.
+ // Sizeof must implement the size guarantees required by the spec.
+ Sizeof(T Type) int64
+}
+
+// StdSizes is a convenience type for creating commonly used Sizes.
+// It makes the following simplifying assumptions:
+//
+// - The size of explicitly sized basic types (int16, etc.) is the
+// specified size.
+// - The size of strings and interfaces is 2*WordSize.
+// - The size of slices is 3*WordSize.
+// - The size of an array of n elements corresponds to the size of
+// a struct of n consecutive fields of the array's element type.
+// - The size of a struct is the offset of the last field plus that
+// field's size. As with all element types, if the struct is used
+// in an array its size must first be aligned to a multiple of the
+// struct's alignment.
+// - All other types have size WordSize.
+// - Arrays and structs are aligned per spec definition; all other
+// types are naturally aligned with a maximum alignment MaxAlign.
+//
+// *StdSizes implements Sizes.
+//
+type StdSizes struct {
+ WordSize int64 // word size in bytes - must be >= 4 (32bits)
+ MaxAlign int64 // maximum alignment in bytes - must be >= 1
+}
+
+func (s *StdSizes) Alignof(T Type) int64 {
+ // For arrays and structs, alignment is defined in terms
+ // of alignment of the elements and fields, respectively.
+ switch t := T.Underlying().(type) {
+ case *Array:
+ // spec: "For a variable x of array type: unsafe.Alignof(x)
+ // is the same as unsafe.Alignof(x[0]), but at least 1."
+ return s.Alignof(t.elem)
+ case *Struct:
+ // spec: "For a variable x of struct type: unsafe.Alignof(x)
+ // is the largest of the values unsafe.Alignof(x.f) for each
+ // field f of x, but at least 1."
+ max := int64(1)
+ for _, f := range t.fields {
+ if a := s.Alignof(f.typ); a > max {
+ max = a
+ }
+ }
+ return max
+ }
+ a := s.Sizeof(T) // may be 0
+ // spec: "For a variable x of any type: unsafe.Alignof(x) is at least 1."
+ if a < 1 {
+ return 1
+ }
+ if a > s.MaxAlign {
+ return s.MaxAlign
+ }
+ return a
+}
+
+func (s *StdSizes) Offsetsof(fields []*Var) []int64 {
+ offsets := make([]int64, len(fields))
+ var o int64
+ for i, f := range fields {
+ a := s.Alignof(f.typ)
+ o = align(o, a)
+ offsets[i] = o
+ o += s.Sizeof(f.typ)
+ }
+ return offsets
+}
+
+var basicSizes = [...]byte{
+ Bool: 1,
+ Int8: 1,
+ Int16: 2,
+ Int32: 4,
+ Int64: 8,
+ Uint8: 1,
+ Uint16: 2,
+ Uint32: 4,
+ Uint64: 8,
+ Float32: 4,
+ Float64: 8,
+ Complex64: 8,
+ Complex128: 16,
+}
+
+func (s *StdSizes) Sizeof(T Type) int64 {
+ switch t := T.Underlying().(type) {
+ case *Basic:
+ assert(isTyped(T))
+ k := t.kind
+ if int(k) < len(basicSizes) {
+ if s := basicSizes[k]; s > 0 {
+ return int64(s)
+ }
+ }
+ if k == String {
+ return s.WordSize * 2
+ }
+ case *Array:
+ n := t.len
+ if n == 0 {
+ return 0
+ }
+ a := s.Alignof(t.elem)
+ z := s.Sizeof(t.elem)
+ return align(z, a)*(n-1) + z
+ case *Slice:
+ return s.WordSize * 3
+ case *Struct:
+ n := t.NumFields()
+ if n == 0 {
+ return 0
+ }
+ offsets := t.offsets
+ if t.offsets == nil {
+ // compute offsets on demand
+ offsets = s.Offsetsof(t.fields)
+ t.offsets = offsets
+ }
+ return offsets[n-1] + s.Sizeof(t.fields[n-1].typ)
+ case *Interface:
+ return s.WordSize * 2
+ }
+ return s.WordSize // catch-all
+}
+
+// stdSizes is used if Config.Sizes == nil.
+var stdSizes = StdSizes{8, 8}
+
+func (conf *Config) alignof(T Type) int64 {
+ if s := conf.Sizes; s != nil {
+ if a := s.Alignof(T); a >= 1 {
+ return a
+ }
+ panic("Config.Sizes.Alignof returned an alignment < 1")
+ }
+ return stdSizes.Alignof(T)
+}
+
+func (conf *Config) offsetsof(T *Struct) []int64 {
+ offsets := T.offsets
+ if offsets == nil && T.NumFields() > 0 {
+ // compute offsets on demand
+ if s := conf.Sizes; s != nil {
+ offsets = s.Offsetsof(T.fields)
+ // sanity checks
+ if len(offsets) != T.NumFields() {
+ panic("Config.Sizes.Offsetsof returned the wrong number of offsets")
+ }
+ for _, o := range offsets {
+ if o < 0 {
+ panic("Config.Sizes.Offsetsof returned an offset < 0")
+ }
+ }
+ } else {
+ offsets = stdSizes.Offsetsof(T.fields)
+ }
+ T.offsets = offsets
+ }
+ return offsets
+}
+
+// offsetof returns the offset of the field specified via
+// the index sequence relative to typ. All embedded fields
+// must be structs (rather than pointer to structs).
+func (conf *Config) offsetof(typ Type, index []int) int64 {
+ var o int64
+ for _, i := range index {
+ s := typ.Underlying().(*Struct)
+ o += conf.offsetsof(s)[i]
+ typ = s.fields[i].typ
+ }
+ return o
+}
+
+func (conf *Config) sizeof(T Type) int64 {
+ if s := conf.Sizes; s != nil {
+ if z := s.Sizeof(T); z >= 0 {
+ return z
+ }
+ panic("Config.Sizes.Sizeof returned a size < 0")
+ }
+ return stdSizes.Sizeof(T)
+}
+
+// align returns the smallest y >= x such that y % a == 0.
+func align(x, a int64) int64 {
+ y := x + a - 1
+ return y - y%a
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/stdlib_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/stdlib_test.go
new file mode 100644
index 0000000000..d6aa82ac53
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/stdlib_test.go
@@ -0,0 +1,270 @@
+// 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.
+
+// This file tests types.Check by using it to
+// typecheck the standard library and tests.
+
+package types_test
+
+import (
+ "fmt"
+ "go/ast"
+ "go/build"
+ "go/parser"
+ "go/scanner"
+ "go/token"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "runtime"
+ "strings"
+ "testing"
+ "time"
+
+ _ "golang.org/x/tools/go/gcimporter"
+ . "golang.org/x/tools/go/types"
+)
+
+var (
+ pkgCount int // number of packages processed
+ start = time.Now()
+)
+
+func TestStdlib(t *testing.T) {
+ skipSpecialPlatforms(t)
+
+ walkDirs(t, filepath.Join(runtime.GOROOT(), "src"))
+ if testing.Verbose() {
+ fmt.Println(pkgCount, "packages typechecked in", time.Since(start))
+ }
+}
+
+// firstComment returns the contents of the first comment in
+// the given file, assuming there's one within the first KB.
+func firstComment(filename string) string {
+ f, err := os.Open(filename)
+ if err != nil {
+ return ""
+ }
+ defer f.Close()
+
+ var src [1 << 10]byte // read at most 1KB
+ n, _ := f.Read(src[:])
+
+ var s scanner.Scanner
+ s.Init(fset.AddFile("", fset.Base(), n), src[:n], nil, scanner.ScanComments)
+ for {
+ _, tok, lit := s.Scan()
+ switch tok {
+ case token.COMMENT:
+ // remove trailing */ of multi-line comment
+ if lit[1] == '*' {
+ lit = lit[:len(lit)-2]
+ }
+ return strings.TrimSpace(lit[2:])
+ case token.EOF:
+ return ""
+ }
+ }
+}
+
+func testTestDir(t *testing.T, path string, ignore ...string) {
+ files, err := ioutil.ReadDir(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ excluded := make(map[string]bool)
+ for _, filename := range ignore {
+ excluded[filename] = true
+ }
+
+ fset := token.NewFileSet()
+ for _, f := range files {
+ // filter directory contents
+ if f.IsDir() || !strings.HasSuffix(f.Name(), ".go") || excluded[f.Name()] {
+ continue
+ }
+
+ // get per-file instructions
+ expectErrors := false
+ filename := filepath.Join(path, f.Name())
+ if cmd := firstComment(filename); cmd != "" {
+ switch cmd {
+ case "skip", "compiledir":
+ continue // ignore this file
+ case "errorcheck":
+ expectErrors = true
+ }
+ }
+
+ // parse and type-check file
+ file, err := parser.ParseFile(fset, filename, nil, 0)
+ if err == nil {
+ _, err = Check(filename, fset, []*ast.File{file})
+ }
+
+ if expectErrors {
+ if err == nil {
+ t.Errorf("expected errors but found none in %s", filename)
+ }
+ } else {
+ if err != nil {
+ t.Error(err)
+ }
+ }
+ }
+}
+
+func TestStdTest(t *testing.T) {
+ skipSpecialPlatforms(t)
+
+ // test/recover4.go is only built for Linux and Darwin.
+ // TODO(gri) Remove once tests consider +build tags (issue 10370).
+ if runtime.GOOS != "linux" && runtime.GOOS != "darwin" {
+ return
+ }
+
+ testTestDir(t, filepath.Join(runtime.GOROOT(), "test"),
+ "cmplxdivide.go", // also needs file cmplxdivide1.go - ignore
+ "sigchld.go", // don't work on Windows; testTestDir should consult build tags
+ )
+}
+
+func TestStdFixed(t *testing.T) {
+ skipSpecialPlatforms(t)
+
+ testTestDir(t, filepath.Join(runtime.GOROOT(), "test", "fixedbugs"),
+ "bug248.go", "bug302.go", "bug369.go", // complex test instructions - ignore
+ "bug459.go", // possibly incorrect test - see issue 6703 (pending spec clarification)
+ "issue3924.go", // possibly incorrect test - see issue 6671 (pending spec clarification)
+ "issue6889.go", // gc-specific test
+ "issue7746.go", // large constants - consumes too much memory
+ "issue11326.go", // large constants
+ "issue11326b.go", // large constants
+ )
+}
+
+func TestStdKen(t *testing.T) {
+ skipSpecialPlatforms(t)
+
+ testTestDir(t, filepath.Join(runtime.GOROOT(), "test", "ken"))
+}
+
+// Package paths of excluded packages.
+var excluded = map[string]bool{
+ "builtin": true,
+}
+
+// typecheck typechecks the given package files.
+func typecheck(t *testing.T, path string, filenames []string) {
+ fset := token.NewFileSet()
+
+ // parse package files
+ var files []*ast.File
+ for _, filename := range filenames {
+ file, err := parser.ParseFile(fset, filename, nil, parser.AllErrors)
+ if err != nil {
+ // the parser error may be a list of individual errors; report them all
+ if list, ok := err.(scanner.ErrorList); ok {
+ for _, err := range list {
+ t.Error(err)
+ }
+ return
+ }
+ t.Error(err)
+ return
+ }
+
+ if testing.Verbose() {
+ if len(files) == 0 {
+ fmt.Println("package", file.Name.Name)
+ }
+ fmt.Println("\t", filename)
+ }
+
+ files = append(files, file)
+ }
+
+ // typecheck package files
+ var conf Config
+ conf.Error = func(err error) { t.Error(err) }
+ info := Info{Uses: make(map[*ast.Ident]Object)}
+ conf.Check(path, fset, files, &info)
+ pkgCount++
+
+ // Perform checks of API invariants.
+
+ // All Objects have a package, except predeclared ones.
+ errorError := Universe.Lookup("error").Type().Underlying().(*Interface).ExplicitMethod(0) // (error).Error
+ for id, obj := range info.Uses {
+ predeclared := obj == Universe.Lookup(obj.Name()) || obj == errorError
+ if predeclared == (obj.Pkg() != nil) {
+ posn := fset.Position(id.Pos())
+ if predeclared {
+ t.Errorf("%s: predeclared object with package: %s", posn, obj)
+ } else {
+ t.Errorf("%s: user-defined object without package: %s", posn, obj)
+ }
+ }
+ }
+}
+
+// pkgFilenames returns the list of package filenames for the given directory.
+func pkgFilenames(dir string) ([]string, error) {
+ ctxt := build.Default
+ ctxt.CgoEnabled = false
+ pkg, err := ctxt.ImportDir(dir, 0)
+ if err != nil {
+ if _, nogo := err.(*build.NoGoError); nogo {
+ return nil, nil // no *.go files, not an error
+ }
+ return nil, err
+ }
+ if excluded[pkg.ImportPath] {
+ return nil, nil
+ }
+ var filenames []string
+ for _, name := range pkg.GoFiles {
+ filenames = append(filenames, filepath.Join(pkg.Dir, name))
+ }
+ for _, name := range pkg.TestGoFiles {
+ filenames = append(filenames, filepath.Join(pkg.Dir, name))
+ }
+ return filenames, nil
+}
+
+// Note: Could use filepath.Walk instead of walkDirs but that wouldn't
+// necessarily be shorter or clearer after adding the code to
+// terminate early for -short tests.
+
+func walkDirs(t *testing.T, dir string) {
+ // limit run time for short tests
+ if testing.Short() && time.Since(start) >= 750*time.Millisecond {
+ return
+ }
+
+ fis, err := ioutil.ReadDir(dir)
+ if err != nil {
+ t.Error(err)
+ return
+ }
+
+ // typecheck package in directory
+ files, err := pkgFilenames(dir)
+ if err != nil {
+ t.Error(err)
+ return
+ }
+ if files != nil {
+ typecheck(t, dir, files)
+ }
+
+ // traverse subdirectories, but don't walk into testdata
+ for _, fi := range fis {
+ if fi.IsDir() && fi.Name() != "testdata" {
+ walkDirs(t, filepath.Join(dir, fi.Name()))
+ }
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/stmt.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/stmt.go
new file mode 100644
index 0000000000..eeb2c31730
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/stmt.go
@@ -0,0 +1,745 @@
+// Copyright 2012 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.
+
+// This file implements typechecking of statements.
+
+package types
+
+import (
+ "fmt"
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/go/exact"
+)
+
+func (check *Checker) funcBody(decl *declInfo, name string, sig *Signature, body *ast.BlockStmt) {
+ if trace {
+ if name == "" {
+ name = ""
+ }
+ fmt.Printf("--- %s: %s {\n", name, sig)
+ defer fmt.Println("--- ")
+ }
+
+ // set function scope extent
+ sig.scope.pos = body.Pos()
+ sig.scope.end = body.End()
+
+ // save/restore current context and setup function context
+ // (and use 0 indentation at function start)
+ defer func(ctxt context, indent int) {
+ check.context = ctxt
+ check.indent = indent
+ }(check.context, check.indent)
+ check.context = context{
+ decl: decl,
+ scope: sig.scope,
+ sig: sig,
+ }
+ check.indent = 0
+
+ check.stmtList(0, body.List)
+
+ if check.hasLabel {
+ check.labels(body)
+ }
+
+ if sig.results.Len() > 0 && !check.isTerminating(body, "") {
+ check.error(body.Rbrace, "missing return")
+ }
+
+ // spec: "Implementation restriction: A compiler may make it illegal to
+ // declare a variable inside a function body if the variable is never used."
+ // (One could check each scope after use, but that distributes this check
+ // over several places because CloseScope is not always called explicitly.)
+ check.usage(sig.scope)
+}
+
+func (check *Checker) usage(scope *Scope) {
+ for _, obj := range scope.elems {
+ if v, _ := obj.(*Var); v != nil && !v.used {
+ check.softErrorf(v.pos, "%s declared but not used", v.name)
+ }
+ }
+ for _, scope := range scope.children {
+ check.usage(scope)
+ }
+}
+
+// stmtContext is a bitset describing which
+// control-flow statements are permissible.
+type stmtContext uint
+
+const (
+ breakOk stmtContext = 1 << iota
+ continueOk
+ fallthroughOk
+)
+
+func (check *Checker) simpleStmt(s ast.Stmt) {
+ if s != nil {
+ check.stmt(0, s)
+ }
+}
+
+func (check *Checker) stmtList(ctxt stmtContext, list []ast.Stmt) {
+ ok := ctxt&fallthroughOk != 0
+ inner := ctxt &^ fallthroughOk
+ for i, s := range list {
+ inner := inner
+ if ok && i+1 == len(list) {
+ inner |= fallthroughOk
+ }
+ check.stmt(inner, s)
+ }
+}
+
+func (check *Checker) multipleDefaults(list []ast.Stmt) {
+ var first ast.Stmt
+ for _, s := range list {
+ var d ast.Stmt
+ switch c := s.(type) {
+ case *ast.CaseClause:
+ if len(c.List) == 0 {
+ d = s
+ }
+ case *ast.CommClause:
+ if c.Comm == nil {
+ d = s
+ }
+ default:
+ check.invalidAST(s.Pos(), "case/communication clause expected")
+ }
+ if d != nil {
+ if first != nil {
+ check.errorf(d.Pos(), "multiple defaults (first at %s)", first.Pos())
+ } else {
+ first = d
+ }
+ }
+ }
+}
+
+func (check *Checker) openScope(s ast.Stmt, comment string) {
+ scope := NewScope(check.scope, s.Pos(), s.End(), comment)
+ check.recordScope(s, scope)
+ check.scope = scope
+}
+
+func (check *Checker) closeScope() {
+ check.scope = check.scope.Parent()
+}
+
+func assignOp(op token.Token) token.Token {
+ // token_test.go verifies the token ordering this function relies on
+ if token.ADD_ASSIGN <= op && op <= token.AND_NOT_ASSIGN {
+ return op + (token.ADD - token.ADD_ASSIGN)
+ }
+ return token.ILLEGAL
+}
+
+func (check *Checker) suspendedCall(keyword string, call *ast.CallExpr) {
+ var x operand
+ var msg string
+ switch check.rawExpr(&x, call, nil) {
+ case conversion:
+ msg = "requires function call, not conversion"
+ case expression:
+ msg = "discards result of"
+ case statement:
+ return
+ default:
+ unreachable()
+ }
+ check.errorf(x.pos(), "%s %s %s", keyword, msg, &x)
+}
+
+func (check *Checker) caseValues(x operand /* copy argument (not *operand!) */, values []ast.Expr) {
+ // No duplicate checking for now. See issue 4524.
+ for _, e := range values {
+ var y operand
+ check.expr(&y, e)
+ if y.mode == invalid {
+ return
+ }
+ // TODO(gri) The convertUntyped call pair below appears in other places. Factor!
+ // Order matters: By comparing y against x, error positions are at the case values.
+ check.convertUntyped(&y, x.typ)
+ if y.mode == invalid {
+ return
+ }
+ check.convertUntyped(&x, y.typ)
+ if x.mode == invalid {
+ return
+ }
+ check.comparison(&y, &x, token.EQL)
+ }
+}
+
+func (check *Checker) caseTypes(x *operand, xtyp *Interface, types []ast.Expr, seen map[Type]token.Pos) (T Type) {
+L:
+ for _, e := range types {
+ T = check.typOrNil(e)
+ if T == Typ[Invalid] {
+ continue
+ }
+ // complain about duplicate types
+ // TODO(gri) use a type hash to avoid quadratic algorithm
+ for t, pos := range seen {
+ if T == nil && t == nil || T != nil && t != nil && Identical(T, t) {
+ // talk about "case" rather than "type" because of nil case
+ check.error(e.Pos(), "duplicate case in type switch")
+ check.errorf(pos, "\tprevious case %s", T) // secondary error, \t indented
+ continue L
+ }
+ }
+ seen[T] = e.Pos()
+ if T != nil {
+ check.typeAssertion(e.Pos(), x, xtyp, T)
+ }
+ }
+ return
+}
+
+// stmt typechecks statement s.
+func (check *Checker) stmt(ctxt stmtContext, s ast.Stmt) {
+ // statements cannot use iota in general
+ // (constant declarations set it explicitly)
+ assert(check.iota == nil)
+
+ // statements must end with the same top scope as they started with
+ if debug {
+ defer func(scope *Scope) {
+ // don't check if code is panicking
+ if p := recover(); p != nil {
+ panic(p)
+ }
+ assert(scope == check.scope)
+ }(check.scope)
+ }
+
+ inner := ctxt &^ fallthroughOk
+ switch s := s.(type) {
+ case *ast.BadStmt, *ast.EmptyStmt:
+ // ignore
+
+ case *ast.DeclStmt:
+ check.declStmt(s.Decl)
+
+ case *ast.LabeledStmt:
+ check.hasLabel = true
+ check.stmt(ctxt, s.Stmt)
+
+ case *ast.ExprStmt:
+ // spec: "With the exception of specific built-in functions,
+ // function and method calls and receive operations can appear
+ // in statement context. Such statements may be parenthesized."
+ var x operand
+ kind := check.rawExpr(&x, s.X, nil)
+ var msg string
+ switch x.mode {
+ default:
+ if kind == statement {
+ return
+ }
+ msg = "is not used"
+ case builtin:
+ msg = "must be called"
+ case typexpr:
+ msg = "is not an expression"
+ }
+ check.errorf(x.pos(), "%s %s", &x, msg)
+
+ case *ast.SendStmt:
+ var ch, x operand
+ check.expr(&ch, s.Chan)
+ check.expr(&x, s.Value)
+ if ch.mode == invalid || x.mode == invalid {
+ return
+ }
+ if tch, ok := ch.typ.Underlying().(*Chan); !ok || tch.dir == RecvOnly || !check.assignment(&x, tch.elem) {
+ if x.mode != invalid {
+ check.invalidOp(ch.pos(), "cannot send %s to channel %s", &x, &ch)
+ }
+ }
+
+ case *ast.IncDecStmt:
+ var op token.Token
+ switch s.Tok {
+ case token.INC:
+ op = token.ADD
+ case token.DEC:
+ op = token.SUB
+ default:
+ check.invalidAST(s.TokPos, "unknown inc/dec operation %s", s.Tok)
+ return
+ }
+ var x operand
+ Y := &ast.BasicLit{ValuePos: s.X.Pos(), Kind: token.INT, Value: "1"} // use x's position
+ check.binary(&x, nil, s.X, Y, op)
+ if x.mode == invalid {
+ return
+ }
+ check.assignVar(s.X, &x)
+
+ case *ast.AssignStmt:
+ switch s.Tok {
+ case token.ASSIGN, token.DEFINE:
+ if len(s.Lhs) == 0 {
+ check.invalidAST(s.Pos(), "missing lhs in assignment")
+ return
+ }
+ if s.Tok == token.DEFINE {
+ check.shortVarDecl(s.TokPos, s.Lhs, s.Rhs)
+ } else {
+ // regular assignment
+ check.assignVars(s.Lhs, s.Rhs)
+ }
+
+ default:
+ // assignment operations
+ if len(s.Lhs) != 1 || len(s.Rhs) != 1 {
+ check.errorf(s.TokPos, "assignment operation %s requires single-valued expressions", s.Tok)
+ return
+ }
+ op := assignOp(s.Tok)
+ if op == token.ILLEGAL {
+ check.invalidAST(s.TokPos, "unknown assignment operation %s", s.Tok)
+ return
+ }
+ var x operand
+ check.binary(&x, nil, s.Lhs[0], s.Rhs[0], op)
+ if x.mode == invalid {
+ return
+ }
+ check.assignVar(s.Lhs[0], &x)
+ }
+
+ case *ast.GoStmt:
+ check.suspendedCall("go", s.Call)
+
+ case *ast.DeferStmt:
+ check.suspendedCall("defer", s.Call)
+
+ case *ast.ReturnStmt:
+ res := check.sig.results
+ if res.Len() > 0 {
+ // function returns results
+ // (if one, say the first, result parameter is named, all of them are named)
+ if len(s.Results) == 0 && res.vars[0].name != "" {
+ // spec: "Implementation restriction: A compiler may disallow an empty expression
+ // list in a "return" statement if a different entity (constant, type, or variable)
+ // with the same name as a result parameter is in scope at the place of the return."
+ for _, obj := range res.vars {
+ if _, alt := check.scope.LookupParent(obj.name, check.pos); alt != nil && alt != obj {
+ check.errorf(s.Pos(), "result parameter %s not in scope at return", obj.name)
+ check.errorf(alt.Pos(), "\tinner declaration of %s", obj)
+ // ok to continue
+ }
+ }
+ } else {
+ // return has results or result parameters are unnamed
+ check.initVars(res.vars, s.Results, s.Return)
+ }
+ } else if len(s.Results) > 0 {
+ check.error(s.Results[0].Pos(), "no result values expected")
+ check.use(s.Results...)
+ }
+
+ case *ast.BranchStmt:
+ if s.Label != nil {
+ check.hasLabel = true
+ return // checked in 2nd pass (check.labels)
+ }
+ switch s.Tok {
+ case token.BREAK:
+ if ctxt&breakOk == 0 {
+ check.error(s.Pos(), "break not in for, switch, or select statement")
+ }
+ case token.CONTINUE:
+ if ctxt&continueOk == 0 {
+ check.error(s.Pos(), "continue not in for statement")
+ }
+ case token.FALLTHROUGH:
+ if ctxt&fallthroughOk == 0 {
+ check.error(s.Pos(), "fallthrough statement out of place")
+ }
+ default:
+ check.invalidAST(s.Pos(), "branch statement: %s", s.Tok)
+ }
+
+ case *ast.BlockStmt:
+ check.openScope(s, "block")
+ defer check.closeScope()
+
+ check.stmtList(inner, s.List)
+
+ case *ast.IfStmt:
+ check.openScope(s, "if")
+ defer check.closeScope()
+
+ check.simpleStmt(s.Init)
+ var x operand
+ check.expr(&x, s.Cond)
+ if x.mode != invalid && !isBoolean(x.typ) {
+ check.error(s.Cond.Pos(), "non-boolean condition in if statement")
+ }
+ check.stmt(inner, s.Body)
+ if s.Else != nil {
+ check.stmt(inner, s.Else)
+ }
+
+ case *ast.SwitchStmt:
+ inner |= breakOk
+ check.openScope(s, "switch")
+ defer check.closeScope()
+
+ check.simpleStmt(s.Init)
+ var x operand
+ if s.Tag != nil {
+ check.expr(&x, s.Tag)
+ } else {
+ // spec: "A missing switch expression is
+ // equivalent to the boolean value true."
+ x.mode = constant
+ x.typ = Typ[Bool]
+ x.val = exact.MakeBool(true)
+ x.expr = &ast.Ident{NamePos: s.Body.Lbrace, Name: "true"}
+ }
+
+ check.multipleDefaults(s.Body.List)
+
+ for i, c := range s.Body.List {
+ clause, _ := c.(*ast.CaseClause)
+ if clause == nil {
+ check.invalidAST(c.Pos(), "incorrect expression switch case")
+ continue
+ }
+ if x.mode != invalid {
+ check.caseValues(x, clause.List)
+ }
+ check.openScope(clause, "case")
+ inner := inner
+ if i+1 < len(s.Body.List) {
+ inner |= fallthroughOk
+ }
+ check.stmtList(inner, clause.Body)
+ check.closeScope()
+ }
+
+ case *ast.TypeSwitchStmt:
+ inner |= breakOk
+ check.openScope(s, "type switch")
+ defer check.closeScope()
+
+ check.simpleStmt(s.Init)
+
+ // A type switch guard must be of the form:
+ //
+ // TypeSwitchGuard = [ identifier ":=" ] PrimaryExpr "." "(" "type" ")" .
+ //
+ // The parser is checking syntactic correctness;
+ // remaining syntactic errors are considered AST errors here.
+ // TODO(gri) better factoring of error handling (invalid ASTs)
+ //
+ var lhs *ast.Ident // lhs identifier or nil
+ var rhs ast.Expr
+ switch guard := s.Assign.(type) {
+ case *ast.ExprStmt:
+ rhs = guard.X
+ case *ast.AssignStmt:
+ if len(guard.Lhs) != 1 || guard.Tok != token.DEFINE || len(guard.Rhs) != 1 {
+ check.invalidAST(s.Pos(), "incorrect form of type switch guard")
+ return
+ }
+
+ lhs, _ = guard.Lhs[0].(*ast.Ident)
+ if lhs == nil {
+ check.invalidAST(s.Pos(), "incorrect form of type switch guard")
+ return
+ }
+
+ if lhs.Name == "_" {
+ // _ := x.(type) is an invalid short variable declaration
+ check.softErrorf(lhs.Pos(), "no new variable on left side of :=")
+ lhs = nil // avoid declared but not used error below
+ } else {
+ check.recordDef(lhs, nil) // lhs variable is implicitly declared in each cause clause
+ }
+
+ rhs = guard.Rhs[0]
+
+ default:
+ check.invalidAST(s.Pos(), "incorrect form of type switch guard")
+ return
+ }
+
+ // rhs must be of the form: expr.(type) and expr must be an interface
+ expr, _ := rhs.(*ast.TypeAssertExpr)
+ if expr == nil || expr.Type != nil {
+ check.invalidAST(s.Pos(), "incorrect form of type switch guard")
+ return
+ }
+ var x operand
+ check.expr(&x, expr.X)
+ if x.mode == invalid {
+ return
+ }
+ xtyp, _ := x.typ.Underlying().(*Interface)
+ if xtyp == nil {
+ check.errorf(x.pos(), "%s is not an interface", &x)
+ return
+ }
+
+ check.multipleDefaults(s.Body.List)
+
+ var lhsVars []*Var // list of implicitly declared lhs variables
+ seen := make(map[Type]token.Pos) // map of seen types to positions
+ for _, s := range s.Body.List {
+ clause, _ := s.(*ast.CaseClause)
+ if clause == nil {
+ check.invalidAST(s.Pos(), "incorrect type switch case")
+ continue
+ }
+ // Check each type in this type switch case.
+ T := check.caseTypes(&x, xtyp, clause.List, seen)
+ check.openScope(clause, "case")
+ // If lhs exists, declare a corresponding variable in the case-local scope.
+ if lhs != nil {
+ // spec: "The TypeSwitchGuard may include a short variable declaration.
+ // When that form is used, the variable is declared at the beginning of
+ // the implicit block in each clause. In clauses with a case listing
+ // exactly one type, the variable has that type; otherwise, the variable
+ // has the type of the expression in the TypeSwitchGuard."
+ if len(clause.List) != 1 || T == nil {
+ T = x.typ
+ }
+ obj := NewVar(lhs.Pos(), check.pkg, lhs.Name, T)
+ scopePos := clause.End()
+ if len(clause.Body) > 0 {
+ scopePos = clause.Body[0].Pos()
+ }
+ check.declare(check.scope, nil, obj, scopePos)
+ check.recordImplicit(clause, obj)
+ // For the "declared but not used" error, all lhs variables act as
+ // one; i.e., if any one of them is 'used', all of them are 'used'.
+ // Collect them for later analysis.
+ lhsVars = append(lhsVars, obj)
+ }
+ check.stmtList(inner, clause.Body)
+ check.closeScope()
+ }
+
+ // If lhs exists, we must have at least one lhs variable that was used.
+ if lhs != nil {
+ var used bool
+ for _, v := range lhsVars {
+ if v.used {
+ used = true
+ }
+ v.used = true // avoid usage error when checking entire function
+ }
+ if !used {
+ check.softErrorf(lhs.Pos(), "%s declared but not used", lhs.Name)
+ }
+ }
+
+ case *ast.SelectStmt:
+ inner |= breakOk
+
+ check.multipleDefaults(s.Body.List)
+
+ for _, s := range s.Body.List {
+ clause, _ := s.(*ast.CommClause)
+ if clause == nil {
+ continue // error reported before
+ }
+
+ // clause.Comm must be a SendStmt, RecvStmt, or default case
+ valid := false
+ var rhs ast.Expr // rhs of RecvStmt, or nil
+ switch s := clause.Comm.(type) {
+ case nil, *ast.SendStmt:
+ valid = true
+ case *ast.AssignStmt:
+ if len(s.Rhs) == 1 {
+ rhs = s.Rhs[0]
+ }
+ case *ast.ExprStmt:
+ rhs = s.X
+ }
+
+ // if present, rhs must be a receive operation
+ if rhs != nil {
+ if x, _ := unparen(rhs).(*ast.UnaryExpr); x != nil && x.Op == token.ARROW {
+ valid = true
+ }
+ }
+
+ if !valid {
+ check.error(clause.Comm.Pos(), "select case must be send or receive (possibly with assignment)")
+ continue
+ }
+
+ check.openScope(s, "case")
+ if clause.Comm != nil {
+ check.stmt(inner, clause.Comm)
+ }
+ check.stmtList(inner, clause.Body)
+ check.closeScope()
+ }
+
+ case *ast.ForStmt:
+ inner |= breakOk | continueOk
+ check.openScope(s, "for")
+ defer check.closeScope()
+
+ check.simpleStmt(s.Init)
+ if s.Cond != nil {
+ var x operand
+ check.expr(&x, s.Cond)
+ if x.mode != invalid && !isBoolean(x.typ) {
+ check.error(s.Cond.Pos(), "non-boolean condition in for statement")
+ }
+ }
+ check.simpleStmt(s.Post)
+ // spec: "The init statement may be a short variable
+ // declaration, but the post statement must not."
+ if s, _ := s.Post.(*ast.AssignStmt); s != nil && s.Tok == token.DEFINE {
+ check.softErrorf(s.Pos(), "cannot declare in post statement")
+ check.use(s.Lhs...) // avoid follow-up errors
+ }
+ check.stmt(inner, s.Body)
+
+ case *ast.RangeStmt:
+ inner |= breakOk | continueOk
+ check.openScope(s, "for")
+ defer check.closeScope()
+
+ // check expression to iterate over
+ var x operand
+ check.expr(&x, s.X)
+
+ // determine key/value types
+ var key, val Type
+ if x.mode != invalid {
+ switch typ := x.typ.Underlying().(type) {
+ case *Basic:
+ if isString(typ) {
+ key = Typ[Int]
+ val = universeRune // use 'rune' name
+ }
+ case *Array:
+ key = Typ[Int]
+ val = typ.elem
+ case *Slice:
+ key = Typ[Int]
+ val = typ.elem
+ case *Pointer:
+ if typ, _ := typ.base.Underlying().(*Array); typ != nil {
+ key = Typ[Int]
+ val = typ.elem
+ }
+ case *Map:
+ key = typ.key
+ val = typ.elem
+ case *Chan:
+ key = typ.elem
+ val = Typ[Invalid]
+ if typ.dir == SendOnly {
+ check.errorf(x.pos(), "cannot range over send-only channel %s", &x)
+ // ok to continue
+ }
+ if s.Value != nil {
+ check.errorf(s.Value.Pos(), "iteration over %s permits only one iteration variable", &x)
+ // ok to continue
+ }
+ }
+ }
+
+ if key == nil {
+ check.errorf(x.pos(), "cannot range over %s", &x)
+ // ok to continue
+ }
+
+ // check assignment to/declaration of iteration variables
+ // (irregular assignment, cannot easily map to existing assignment checks)
+
+ // lhs expressions and initialization value (rhs) types
+ lhs := [2]ast.Expr{s.Key, s.Value}
+ rhs := [2]Type{key, val} // key, val may be nil
+
+ if s.Tok == token.DEFINE {
+ // short variable declaration; variable scope starts after the range clause
+ // (the for loop opens a new scope, so variables on the lhs never redeclare
+ // previously declared variables)
+ var vars []*Var
+ for i, lhs := range lhs {
+ if lhs == nil {
+ continue
+ }
+
+ // determine lhs variable
+ var obj *Var
+ if ident, _ := lhs.(*ast.Ident); ident != nil {
+ // declare new variable
+ name := ident.Name
+ obj = NewVar(ident.Pos(), check.pkg, name, nil)
+ check.recordDef(ident, obj)
+ // _ variables don't count as new variables
+ if name != "_" {
+ vars = append(vars, obj)
+ }
+ } else {
+ check.errorf(lhs.Pos(), "cannot declare %s", lhs)
+ obj = NewVar(lhs.Pos(), check.pkg, "_", nil) // dummy variable
+ }
+
+ // initialize lhs variable
+ if typ := rhs[i]; typ != nil {
+ x.mode = value
+ x.expr = lhs // we don't have a better rhs expression to use here
+ x.typ = typ
+ check.initVar(obj, &x, false)
+ } else {
+ obj.typ = Typ[Invalid]
+ obj.used = true // don't complain about unused variable
+ }
+ }
+
+ // declare variables
+ if len(vars) > 0 {
+ for _, obj := range vars {
+ // spec: "The scope of a constant or variable identifier declared inside
+ // a function begins at the end of the ConstSpec or VarSpec (ShortVarDecl
+ // for short variable declarations) and ends at the end of the innermost
+ // containing block."
+ scopePos := s.End()
+ check.declare(check.scope, nil /* recordDef already called */, obj, scopePos)
+ }
+ } else {
+ check.error(s.TokPos, "no new variables on left side of :=")
+ }
+ } else {
+ // ordinary assignment
+ for i, lhs := range lhs {
+ if lhs == nil {
+ continue
+ }
+ if typ := rhs[i]; typ != nil {
+ x.mode = value
+ x.expr = lhs // we don't have a better rhs expression to use here
+ x.typ = typ
+ check.assignVar(lhs, &x)
+ }
+ }
+ }
+
+ check.stmt(inner, s.Body)
+
+ default:
+ check.error(s.Pos(), "invalid statement")
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/token_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/token_test.go
new file mode 100644
index 0000000000..705bb295a1
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/token_test.go
@@ -0,0 +1,47 @@
+// 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.
+
+// This file checks invariants of token.Token ordering that we rely on
+// since package go/token doesn't provide any guarantees at the moment.
+
+package types
+
+import (
+ "go/token"
+ "testing"
+)
+
+var assignOps = map[token.Token]token.Token{
+ token.ADD_ASSIGN: token.ADD,
+ token.SUB_ASSIGN: token.SUB,
+ token.MUL_ASSIGN: token.MUL,
+ token.QUO_ASSIGN: token.QUO,
+ token.REM_ASSIGN: token.REM,
+ token.AND_ASSIGN: token.AND,
+ token.OR_ASSIGN: token.OR,
+ token.XOR_ASSIGN: token.XOR,
+ token.SHL_ASSIGN: token.SHL,
+ token.SHR_ASSIGN: token.SHR,
+ token.AND_NOT_ASSIGN: token.AND_NOT,
+}
+
+func TestZeroTok(t *testing.T) {
+ // zero value for token.Token must be token.ILLEGAL
+ var zero token.Token
+ if token.ILLEGAL != zero {
+ t.Errorf("%s == %d; want 0", token.ILLEGAL, zero)
+ }
+}
+
+func TestAssignOp(t *testing.T) {
+ // there are fewer than 256 tokens
+ for i := 0; i < 256; i++ {
+ tok := token.Token(i)
+ got := assignOp(tok)
+ want := assignOps[tok]
+ if got != want {
+ t.Errorf("for assignOp(%s): got %s; want %s", tok, got, want)
+ }
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/type.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/type.go
new file mode 100644
index 0000000000..1df8b45b28
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/type.go
@@ -0,0 +1,454 @@
+// Copyright 2011 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.
+
+package types
+
+import "sort"
+
+// TODO(gri) Revisit factory functions - make sure they have all relevant parameters.
+
+// A Type represents a type of Go.
+// All types implement the Type interface.
+type Type interface {
+ // Underlying returns the underlying type of a type.
+ Underlying() Type
+
+ // String returns a string representation of a type.
+ String() string
+}
+
+// BasicKind describes the kind of basic type.
+type BasicKind int
+
+const (
+ Invalid BasicKind = iota // type is invalid
+
+ // predeclared types
+ Bool
+ Int
+ Int8
+ Int16
+ Int32
+ Int64
+ Uint
+ Uint8
+ Uint16
+ Uint32
+ Uint64
+ Uintptr
+ Float32
+ Float64
+ Complex64
+ Complex128
+ String
+ UnsafePointer
+
+ // types for untyped values
+ UntypedBool
+ UntypedInt
+ UntypedRune
+ UntypedFloat
+ UntypedComplex
+ UntypedString
+ UntypedNil
+
+ // aliases
+ Byte = Uint8
+ Rune = Int32
+)
+
+// BasicInfo is a set of flags describing properties of a basic type.
+type BasicInfo int
+
+// Properties of basic types.
+const (
+ IsBoolean BasicInfo = 1 << iota
+ IsInteger
+ IsUnsigned
+ IsFloat
+ IsComplex
+ IsString
+ IsUntyped
+
+ IsOrdered = IsInteger | IsFloat | IsString
+ IsNumeric = IsInteger | IsFloat | IsComplex
+ IsConstType = IsBoolean | IsNumeric | IsString
+)
+
+// A Basic represents a basic type.
+type Basic struct {
+ kind BasicKind
+ info BasicInfo
+ name string
+}
+
+// Kind returns the kind of basic type b.
+func (b *Basic) Kind() BasicKind { return b.kind }
+
+// Info returns information about properties of basic type b.
+func (b *Basic) Info() BasicInfo { return b.info }
+
+// Name returns the name of basic type b.
+func (b *Basic) Name() string { return b.name }
+
+// An Array represents an array type.
+type Array struct {
+ len int64
+ elem Type
+}
+
+// NewArray returns a new array type for the given element type and length.
+func NewArray(elem Type, len int64) *Array { return &Array{len, elem} }
+
+// Len returns the length of array a.
+func (a *Array) Len() int64 { return a.len }
+
+// Elem returns element type of array a.
+func (a *Array) Elem() Type { return a.elem }
+
+// A Slice represents a slice type.
+type Slice struct {
+ elem Type
+}
+
+// NewSlice returns a new slice type for the given element type.
+func NewSlice(elem Type) *Slice { return &Slice{elem} }
+
+// Elem returns the element type of slice s.
+func (s *Slice) Elem() Type { return s.elem }
+
+// A Struct represents a struct type.
+type Struct struct {
+ fields []*Var
+ tags []string // field tags; nil if there are no tags
+ // TODO(gri) access to offsets is not threadsafe - fix this
+ offsets []int64 // field offsets in bytes, lazily initialized
+}
+
+// NewStruct returns a new struct with the given fields and corresponding field tags.
+// If a field with index i has a tag, tags[i] must be that tag, but len(tags) may be
+// only as long as required to hold the tag with the largest index i. Consequently,
+// if no field has a tag, tags may be nil.
+func NewStruct(fields []*Var, tags []string) *Struct {
+ var fset objset
+ for _, f := range fields {
+ if f.name != "_" && fset.insert(f) != nil {
+ panic("multiple fields with the same name")
+ }
+ }
+ if len(tags) > len(fields) {
+ panic("more tags than fields")
+ }
+ return &Struct{fields: fields, tags: tags}
+}
+
+// NumFields returns the number of fields in the struct (including blank and anonymous fields).
+func (s *Struct) NumFields() int { return len(s.fields) }
+
+// Field returns the i'th field for 0 <= i < NumFields().
+func (s *Struct) Field(i int) *Var { return s.fields[i] }
+
+// Tag returns the i'th field tag for 0 <= i < NumFields().
+func (s *Struct) Tag(i int) string {
+ if i < len(s.tags) {
+ return s.tags[i]
+ }
+ return ""
+}
+
+// A Pointer represents a pointer type.
+type Pointer struct {
+ base Type // element type
+}
+
+// NewPointer returns a new pointer type for the given element (base) type.
+func NewPointer(elem Type) *Pointer { return &Pointer{base: elem} }
+
+// Elem returns the element type for the given pointer p.
+func (p *Pointer) Elem() Type { return p.base }
+
+// A Tuple represents an ordered list of variables; a nil *Tuple is a valid (empty) tuple.
+// Tuples are used as components of signatures and to represent the type of multiple
+// assignments; they are not first class types of Go.
+type Tuple struct {
+ vars []*Var
+}
+
+// NewTuple returns a new tuple for the given variables.
+func NewTuple(x ...*Var) *Tuple {
+ if len(x) > 0 {
+ return &Tuple{x}
+ }
+ return nil
+}
+
+// Len returns the number variables of tuple t.
+func (t *Tuple) Len() int {
+ if t != nil {
+ return len(t.vars)
+ }
+ return 0
+}
+
+// At returns the i'th variable of tuple t.
+func (t *Tuple) At(i int) *Var { return t.vars[i] }
+
+// A Signature represents a (non-builtin) function or method type.
+type Signature struct {
+ // We need to keep the scope in Signature (rather than passing it around
+ // and store it in the Func Object) because when type-checking a function
+ // literal we call the general type checker which returns a general Type.
+ // We then unpack the *Signature and use the scope for the literal body.
+ scope *Scope // function scope, present for package-local signatures
+ recv *Var // nil if not a method
+ params *Tuple // (incoming) parameters from left to right; or nil
+ results *Tuple // (outgoing) results from left to right; or nil
+ variadic bool // true if the last parameter's type is of the form ...T (or string, for append built-in only)
+}
+
+// NewSignature returns a new function type for the given receiver, parameters,
+// and results, either of which may be nil. If variadic is set, the function
+// is variadic, it must have at least one parameter, and the last parameter
+// must be of unnamed slice type.
+func NewSignature(recv *Var, params, results *Tuple, variadic bool) *Signature {
+ if variadic {
+ n := params.Len()
+ if n == 0 {
+ panic("types.NewSignature: variadic function must have at least one parameter")
+ }
+ if _, ok := params.At(n - 1).typ.(*Slice); !ok {
+ panic("types.NewSignature: variadic parameter must be of unnamed slice type")
+ }
+ }
+ return &Signature{nil, recv, params, results, variadic}
+}
+
+// Recv returns the receiver of signature s (if a method), or nil if a
+// function.
+//
+// For an abstract method, Recv returns the enclosing interface either
+// as a *Named or an *Interface. Due to embedding, an interface may
+// contain methods whose receiver type is a different interface.
+func (s *Signature) Recv() *Var { return s.recv }
+
+// Params returns the parameters of signature s, or nil.
+func (s *Signature) Params() *Tuple { return s.params }
+
+// Results returns the results of signature s, or nil.
+func (s *Signature) Results() *Tuple { return s.results }
+
+// Variadic reports whether the signature s is variadic.
+func (s *Signature) Variadic() bool { return s.variadic }
+
+// An Interface represents an interface type.
+type Interface struct {
+ methods []*Func // ordered list of explicitly declared methods
+ embeddeds []*Named // ordered list of explicitly embedded types
+
+ allMethods []*Func // ordered list of methods declared with or embedded in this interface (TODO(gri): replace with mset)
+}
+
+// NewInterface returns a new interface for the given methods and embedded types.
+func NewInterface(methods []*Func, embeddeds []*Named) *Interface {
+ typ := new(Interface)
+
+ var mset objset
+ for _, m := range methods {
+ if mset.insert(m) != nil {
+ panic("multiple methods with the same name")
+ }
+ // set receiver
+ // TODO(gri) Ideally, we should use a named type here instead of
+ // typ, for less verbose printing of interface method signatures.
+ m.typ.(*Signature).recv = NewVar(m.pos, m.pkg, "", typ)
+ }
+ sort.Sort(byUniqueMethodName(methods))
+
+ if embeddeds == nil {
+ sort.Sort(byUniqueTypeName(embeddeds))
+ }
+
+ typ.methods = methods
+ typ.embeddeds = embeddeds
+ return typ
+}
+
+// NumExplicitMethods returns the number of explicitly declared methods of interface t.
+func (t *Interface) NumExplicitMethods() int { return len(t.methods) }
+
+// ExplicitMethod returns the i'th explicitly declared method of interface t for 0 <= i < t.NumExplicitMethods().
+// The methods are ordered by their unique Id.
+func (t *Interface) ExplicitMethod(i int) *Func { return t.methods[i] }
+
+// NumEmbeddeds returns the number of embedded types in interface t.
+func (t *Interface) NumEmbeddeds() int { return len(t.embeddeds) }
+
+// Embedded returns the i'th embedded type of interface t for 0 <= i < t.NumEmbeddeds().
+// The types are ordered by the corresponding TypeName's unique Id.
+func (t *Interface) Embedded(i int) *Named { return t.embeddeds[i] }
+
+// NumMethods returns the total number of methods of interface t.
+func (t *Interface) NumMethods() int { return len(t.allMethods) }
+
+// Method returns the i'th method of interface t for 0 <= i < t.NumMethods().
+// The methods are ordered by their unique Id.
+func (t *Interface) Method(i int) *Func { return t.allMethods[i] }
+
+// Empty returns true if t is the empty interface.
+func (t *Interface) Empty() bool { return len(t.allMethods) == 0 }
+
+// Complete computes the interface's method set. It must be called by users of
+// NewInterface after the interface's embedded types are fully defined and
+// before using the interface type in any way other than to form other types.
+// Complete returns the receiver.
+func (t *Interface) Complete() *Interface {
+ if t.allMethods != nil {
+ return t
+ }
+
+ var allMethods []*Func
+ if t.embeddeds == nil {
+ if t.methods == nil {
+ allMethods = make([]*Func, 0, 1)
+ } else {
+ allMethods = t.methods
+ }
+ } else {
+ allMethods = append(allMethods, t.methods...)
+ for _, et := range t.embeddeds {
+ it := et.Underlying().(*Interface)
+ it.Complete()
+ for _, tm := range it.allMethods {
+ // Make a copy of the method and adjust its receiver type.
+ newm := *tm
+ newmtyp := *tm.typ.(*Signature)
+ newm.typ = &newmtyp
+ newmtyp.recv = NewVar(newm.pos, newm.pkg, "", t)
+ allMethods = append(allMethods, &newm)
+ }
+ }
+ sort.Sort(byUniqueMethodName(allMethods))
+ }
+ t.allMethods = allMethods
+
+ return t
+}
+
+// A Map represents a map type.
+type Map struct {
+ key, elem Type
+}
+
+// NewMap returns a new map for the given key and element types.
+func NewMap(key, elem Type) *Map {
+ return &Map{key, elem}
+}
+
+// Key returns the key type of map m.
+func (m *Map) Key() Type { return m.key }
+
+// Elem returns the element type of map m.
+func (m *Map) Elem() Type { return m.elem }
+
+// A Chan represents a channel type.
+type Chan struct {
+ dir ChanDir
+ elem Type
+}
+
+// A ChanDir value indicates a channel direction.
+type ChanDir int
+
+// The direction of a channel is indicated by one of the following constants.
+const (
+ SendRecv ChanDir = iota
+ SendOnly
+ RecvOnly
+)
+
+// NewChan returns a new channel type for the given direction and element type.
+func NewChan(dir ChanDir, elem Type) *Chan {
+ return &Chan{dir, elem}
+}
+
+// Dir returns the direction of channel c.
+func (c *Chan) Dir() ChanDir { return c.dir }
+
+// Elem returns the element type of channel c.
+func (c *Chan) Elem() Type { return c.elem }
+
+// A Named represents a named type.
+type Named struct {
+ obj *TypeName // corresponding declared object
+ underlying Type // possibly a *Named during setup; never a *Named once set up completely
+ methods []*Func // methods declared for this type (not the method set of this type)
+}
+
+// NewNamed returns a new named type for the given type name, underlying type, and associated methods.
+// The underlying type must not be a *Named.
+func NewNamed(obj *TypeName, underlying Type, methods []*Func) *Named {
+ if _, ok := underlying.(*Named); ok {
+ panic("types.NewNamed: underlying type must not be *Named")
+ }
+ typ := &Named{obj: obj, underlying: underlying, methods: methods}
+ if obj.typ == nil {
+ obj.typ = typ
+ }
+ return typ
+}
+
+// TypeName returns the type name for the named type t.
+func (t *Named) Obj() *TypeName { return t.obj }
+
+// NumMethods returns the number of explicit methods whose receiver is named type t.
+func (t *Named) NumMethods() int { return len(t.methods) }
+
+// Method returns the i'th method of named type t for 0 <= i < t.NumMethods().
+func (t *Named) Method(i int) *Func { return t.methods[i] }
+
+// SetUnderlying sets the underlying type and marks t as complete.
+// TODO(gri) determine if there's a better solution rather than providing this function
+func (t *Named) SetUnderlying(underlying Type) {
+ if underlying == nil {
+ panic("types.Named.SetUnderlying: underlying type must not be nil")
+ }
+ if _, ok := underlying.(*Named); ok {
+ panic("types.Named.SetUnderlying: underlying type must not be *Named")
+ }
+ t.underlying = underlying
+}
+
+// AddMethod adds method m unless it is already in the method list.
+// TODO(gri) find a better solution instead of providing this function
+func (t *Named) AddMethod(m *Func) {
+ if i, _ := lookupMethod(t.methods, m.pkg, m.name); i < 0 {
+ t.methods = append(t.methods, m)
+ }
+}
+
+// Implementations for Type methods.
+
+func (t *Basic) Underlying() Type { return t }
+func (t *Array) Underlying() Type { return t }
+func (t *Slice) Underlying() Type { return t }
+func (t *Struct) Underlying() Type { return t }
+func (t *Pointer) Underlying() Type { return t }
+func (t *Tuple) Underlying() Type { return t }
+func (t *Signature) Underlying() Type { return t }
+func (t *Interface) Underlying() Type { return t }
+func (t *Map) Underlying() Type { return t }
+func (t *Chan) Underlying() Type { return t }
+func (t *Named) Underlying() Type { return t.underlying }
+
+func (t *Basic) String() string { return TypeString(t, nil) }
+func (t *Array) String() string { return TypeString(t, nil) }
+func (t *Slice) String() string { return TypeString(t, nil) }
+func (t *Struct) String() string { return TypeString(t, nil) }
+func (t *Pointer) String() string { return TypeString(t, nil) }
+func (t *Tuple) String() string { return TypeString(t, nil) }
+func (t *Signature) String() string { return TypeString(t, nil) }
+func (t *Interface) String() string { return TypeString(t, nil) }
+func (t *Map) String() string { return TypeString(t, nil) }
+func (t *Chan) String() string { return TypeString(t, nil) }
+func (t *Named) String() string { return TypeString(t, nil) }
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/typestring.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/typestring.go
new file mode 100644
index 0000000000..abee8abb56
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/typestring.go
@@ -0,0 +1,292 @@
+// 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.
+
+// This file implements printing of types.
+
+package types
+
+import (
+ "bytes"
+ "fmt"
+)
+
+// A Qualifier controls how named package-level objects are printed in
+// calls to TypeString, ObjectString, and SelectionString.
+//
+// These three formatting routines call the Qualifier for each
+// package-level object O, and if the Qualifier returns a non-empty
+// string p, the object is printed in the form p.O.
+// If it returns an empty string, only the object name O is printed.
+//
+// Using a nil Qualifier is equivalent to using (*Package).Path: the
+// object is qualified by the import path, e.g., "encoding/json.Marshal".
+//
+type Qualifier func(*Package) string
+
+// RelativeTo(pkg) returns a Qualifier that fully qualifies members of
+// all packages other than pkg.
+func RelativeTo(pkg *Package) Qualifier {
+ if pkg == nil {
+ return nil
+ }
+ return func(other *Package) string {
+ if pkg == other {
+ return "" // same package; unqualified
+ }
+ return other.Path()
+ }
+}
+
+// If GcCompatibilityMode is set, printing of types is modified
+// to match the representation of some types in the gc compiler:
+//
+// - byte and rune lose their alias name and simply stand for
+// uint8 and int32 respectively
+// - embedded interfaces get flattened (the embedding info is lost,
+// and certain recursive interface types cannot be printed anymore)
+//
+// This makes it easier to compare packages computed with the type-
+// checker vs packages imported from gc export data.
+//
+// Caution: This flag affects all uses of WriteType, globally.
+// It is only provided for testing in conjunction with
+// gc-generated data. It may be removed at any time.
+var GcCompatibilityMode bool
+
+// TypeString returns the string representation of typ.
+// The Qualifier controls the printing of
+// package-level objects, and may be nil.
+func TypeString(typ Type, qf Qualifier) string {
+ var buf bytes.Buffer
+ WriteType(&buf, typ, qf)
+ return buf.String()
+}
+
+// WriteType writes the string representation of typ to buf.
+// The Qualifier controls the printing of
+// package-level objects, and may be nil.
+func WriteType(buf *bytes.Buffer, typ Type, qf Qualifier) {
+ writeType(buf, typ, qf, make([]Type, 8))
+}
+
+func writeType(buf *bytes.Buffer, typ Type, qf Qualifier, visited []Type) {
+ // Theoretically, this is a quadratic lookup algorithm, but in
+ // practice deeply nested composite types with unnamed component
+ // types are uncommon. This code is likely more efficient than
+ // using a map.
+ for _, t := range visited {
+ if t == typ {
+ fmt.Fprintf(buf, "â—‹%T", typ) // cycle to typ
+ return
+ }
+ }
+ visited = append(visited, typ)
+
+ switch t := typ.(type) {
+ case nil:
+ buf.WriteString("")
+
+ case *Basic:
+ if t.kind == UnsafePointer {
+ buf.WriteString("unsafe.")
+ }
+ if GcCompatibilityMode {
+ // forget the alias names
+ switch t.kind {
+ case Byte:
+ t = Typ[Uint8]
+ case Rune:
+ t = Typ[Int32]
+ }
+ }
+ buf.WriteString(t.name)
+
+ case *Array:
+ fmt.Fprintf(buf, "[%d]", t.len)
+ writeType(buf, t.elem, qf, visited)
+
+ case *Slice:
+ buf.WriteString("[]")
+ writeType(buf, t.elem, qf, visited)
+
+ case *Struct:
+ buf.WriteString("struct{")
+ for i, f := range t.fields {
+ if i > 0 {
+ buf.WriteString("; ")
+ }
+ if !f.anonymous {
+ buf.WriteString(f.name)
+ buf.WriteByte(' ')
+ }
+ writeType(buf, f.typ, qf, visited)
+ if tag := t.Tag(i); tag != "" {
+ fmt.Fprintf(buf, " %q", tag)
+ }
+ }
+ buf.WriteByte('}')
+
+ case *Pointer:
+ buf.WriteByte('*')
+ writeType(buf, t.base, qf, visited)
+
+ case *Tuple:
+ writeTuple(buf, t, false, qf, visited)
+
+ case *Signature:
+ buf.WriteString("func")
+ writeSignature(buf, t, qf, visited)
+
+ case *Interface:
+ // We write the source-level methods and embedded types rather
+ // than the actual method set since resolved method signatures
+ // may have non-printable cycles if parameters have anonymous
+ // interface types that (directly or indirectly) embed the
+ // current interface. For instance, consider the result type
+ // of m:
+ //
+ // type T interface{
+ // m() interface{ T }
+ // }
+ //
+ buf.WriteString("interface{")
+ if GcCompatibilityMode {
+ // print flattened interface
+ // (useful to compare against gc-generated interfaces)
+ for i, m := range t.allMethods {
+ if i > 0 {
+ buf.WriteString("; ")
+ }
+ buf.WriteString(m.name)
+ writeSignature(buf, m.typ.(*Signature), qf, visited)
+ }
+ } else {
+ // print explicit interface methods and embedded types
+ for i, m := range t.methods {
+ if i > 0 {
+ buf.WriteString("; ")
+ }
+ buf.WriteString(m.name)
+ writeSignature(buf, m.typ.(*Signature), qf, visited)
+ }
+ for i, typ := range t.embeddeds {
+ if i > 0 || len(t.methods) > 0 {
+ buf.WriteString("; ")
+ }
+ writeType(buf, typ, qf, visited)
+ }
+ }
+ buf.WriteByte('}')
+
+ case *Map:
+ buf.WriteString("map[")
+ writeType(buf, t.key, qf, visited)
+ buf.WriteByte(']')
+ writeType(buf, t.elem, qf, visited)
+
+ case *Chan:
+ var s string
+ var parens bool
+ switch t.dir {
+ case SendRecv:
+ s = "chan "
+ // chan (<-chan T) requires parentheses
+ if c, _ := t.elem.(*Chan); c != nil && c.dir == RecvOnly {
+ parens = true
+ }
+ case SendOnly:
+ s = "chan<- "
+ case RecvOnly:
+ s = "<-chan "
+ default:
+ panic("unreachable")
+ }
+ buf.WriteString(s)
+ if parens {
+ buf.WriteByte('(')
+ }
+ writeType(buf, t.elem, qf, visited)
+ if parens {
+ buf.WriteByte(')')
+ }
+
+ case *Named:
+ s := ""
+ if obj := t.obj; obj != nil {
+ if obj.pkg != nil {
+ writePackage(buf, obj.pkg, qf)
+ }
+ // TODO(gri): function-local named types should be displayed
+ // differently from named types at package level to avoid
+ // ambiguity.
+ s = obj.name
+ }
+ buf.WriteString(s)
+
+ default:
+ // For externally defined implementations of Type.
+ buf.WriteString(t.String())
+ }
+}
+
+func writeTuple(buf *bytes.Buffer, tup *Tuple, variadic bool, qf Qualifier, visited []Type) {
+ buf.WriteByte('(')
+ if tup != nil {
+ for i, v := range tup.vars {
+ if i > 0 {
+ buf.WriteString(", ")
+ }
+ if v.name != "" {
+ buf.WriteString(v.name)
+ buf.WriteByte(' ')
+ }
+ typ := v.typ
+ if variadic && i == len(tup.vars)-1 {
+ if s, ok := typ.(*Slice); ok {
+ buf.WriteString("...")
+ typ = s.elem
+ } else {
+ // special case:
+ // append(s, "foo"...) leads to signature func([]byte, string...)
+ if t, ok := typ.Underlying().(*Basic); !ok || t.kind != String {
+ panic("internal error: string type expected")
+ }
+ writeType(buf, typ, qf, visited)
+ buf.WriteString("...")
+ continue
+ }
+ }
+ writeType(buf, typ, qf, visited)
+ }
+ }
+ buf.WriteByte(')')
+}
+
+// WriteSignature writes the representation of the signature sig to buf,
+// without a leading "func" keyword.
+// The Qualifier controls the printing of
+// package-level objects, and may be nil.
+func WriteSignature(buf *bytes.Buffer, sig *Signature, qf Qualifier) {
+ writeSignature(buf, sig, qf, make([]Type, 8))
+}
+
+func writeSignature(buf *bytes.Buffer, sig *Signature, qf Qualifier, visited []Type) {
+ writeTuple(buf, sig.params, sig.variadic, qf, visited)
+
+ n := sig.results.Len()
+ if n == 0 {
+ // no result
+ return
+ }
+
+ buf.WriteByte(' ')
+ if n == 1 && sig.results.vars[0].name == "" {
+ // single unnamed result
+ writeType(buf, sig.results.vars[0].typ, qf, visited)
+ return
+ }
+
+ // multiple or named result(s)
+ writeTuple(buf, sig.results, false, qf, visited)
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/typestring_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/typestring_test.go
new file mode 100644
index 0000000000..975b62389c
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/typestring_test.go
@@ -0,0 +1,166 @@
+// Copyright 2012 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.
+
+package types_test
+
+import (
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "testing"
+
+ _ "golang.org/x/tools/go/gcimporter"
+ . "golang.org/x/tools/go/types"
+)
+
+const filename = ""
+
+func makePkg(t *testing.T, src string) (*Package, error) {
+ fset := token.NewFileSet()
+ file, err := parser.ParseFile(fset, filename, src, parser.DeclarationErrors)
+ if err != nil {
+ return nil, err
+ }
+ // use the package name as package path
+ return Check(file.Name.Name, fset, []*ast.File{file})
+}
+
+type testEntry struct {
+ src, str string
+}
+
+// dup returns a testEntry where both src and str are the same.
+func dup(s string) testEntry {
+ return testEntry{s, s}
+}
+
+// types that don't depend on any other type declarations
+var independentTestTypes = []testEntry{
+ // basic types
+ dup("int"),
+ dup("float32"),
+ dup("string"),
+
+ // arrays
+ dup("[10]int"),
+
+ // slices
+ dup("[]int"),
+ dup("[][]int"),
+
+ // structs
+ dup("struct{}"),
+ dup("struct{x int}"),
+ {`struct {
+ x, y int
+ z float32 "foo"
+ }`, `struct{x int; y int; z float32 "foo"}`},
+ {`struct {
+ string
+ elems []complex128
+ }`, `struct{string; elems []complex128}`},
+
+ // pointers
+ dup("*int"),
+ dup("***struct{}"),
+ dup("*struct{a int; b float32}"),
+
+ // functions
+ dup("func()"),
+ dup("func(x int)"),
+ {"func(x, y int)", "func(x int, y int)"},
+ {"func(x, y int, z string)", "func(x int, y int, z string)"},
+ dup("func(int)"),
+ {"func(int, string, byte)", "func(int, string, byte)"},
+
+ dup("func() int"),
+ {"func() (string)", "func() string"},
+ dup("func() (u int)"),
+ {"func() (u, v int, w string)", "func() (u int, v int, w string)"},
+
+ dup("func(int) string"),
+ dup("func(x int) string"),
+ dup("func(x int) (u string)"),
+ {"func(x, y int) (u string)", "func(x int, y int) (u string)"},
+
+ dup("func(...int) string"),
+ dup("func(x ...int) string"),
+ dup("func(x ...int) (u string)"),
+ {"func(x, y ...int) (u string)", "func(x int, y ...int) (u string)"},
+
+ // interfaces
+ dup("interface{}"),
+ dup("interface{m()}"),
+ dup(`interface{String() string; m(int) float32}`),
+
+ // maps
+ dup("map[string]int"),
+ {"map[struct{x, y int}][]byte", "map[struct{x int; y int}][]byte"},
+
+ // channels
+ dup("chan<- chan int"),
+ dup("chan<- <-chan int"),
+ dup("<-chan <-chan int"),
+ dup("chan (<-chan int)"),
+ dup("chan<- func()"),
+ dup("<-chan []func() int"),
+}
+
+// types that depend on other type declarations (src in TestTypes)
+var dependentTestTypes = []testEntry{
+ // interfaces
+ dup(`interface{io.Reader; io.Writer}`),
+ dup(`interface{m() int; io.Writer}`),
+ {`interface{m() interface{T}}`, `interface{m() interface{p.T}}`},
+}
+
+func TestTypeString(t *testing.T) {
+ skipSpecialPlatforms(t)
+
+ var tests []testEntry
+ tests = append(tests, independentTestTypes...)
+ tests = append(tests, dependentTestTypes...)
+
+ for _, test := range tests {
+ src := `package p; import "io"; type _ io.Writer; type T ` + test.src
+ pkg, err := makePkg(t, src)
+ if err != nil {
+ t.Errorf("%s: %s", src, err)
+ continue
+ }
+ typ := pkg.Scope().Lookup("T").Type().Underlying()
+ if got := typ.String(); got != test.str {
+ t.Errorf("%s: got %s, want %s", test.src, got, test.str)
+ }
+ }
+}
+
+func TestQualifiedTypeString(t *testing.T) {
+ p, _ := pkgFor("p.go", "package p; type T int", nil)
+ q, _ := pkgFor("q.go", "package q", nil)
+
+ pT := p.Scope().Lookup("T").Type()
+ for _, test := range []struct {
+ typ Type
+ this *Package
+ want string
+ }{
+ {pT, nil, "p.T"},
+ {pT, p, "T"},
+ {pT, q, "p.T"},
+ {NewPointer(pT), p, "*T"},
+ {NewPointer(pT), q, "*p.T"},
+ } {
+ qualifier := func(pkg *Package) string {
+ if pkg != test.this {
+ return pkg.Name()
+ }
+ return ""
+ }
+ if got := TypeString(test.typ, qualifier); got != test.want {
+ t.Errorf("TypeString(%s, %s) = %s, want %s",
+ test.this, test.typ, got, test.want)
+ }
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/example_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/example_test.go
new file mode 100644
index 0000000000..9e3ada7b19
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/example_test.go
@@ -0,0 +1,68 @@
+// Copyright 2014 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.
+
+package typeutil_test
+
+import (
+ "fmt"
+ "sort"
+
+ "go/ast"
+ "go/parser"
+ "go/token"
+
+ "golang.org/x/tools/go/types"
+ "golang.org/x/tools/go/types/typeutil"
+)
+
+func ExampleMap() {
+ const source = `package P
+
+var X []string
+var Y []string
+
+const p, q = 1.0, 2.0
+
+func f(offset int32) (value byte, ok bool)
+func g(rune) (uint8, bool)
+`
+
+ // Parse and type-check the package.
+ fset := token.NewFileSet()
+ f, err := parser.ParseFile(fset, "P.go", source, 0)
+ if err != nil {
+ panic(err)
+ }
+ pkg, err := new(types.Config).Check("P", fset, []*ast.File{f}, nil)
+ if err != nil {
+ panic(err)
+ }
+
+ scope := pkg.Scope()
+
+ // Group names of package-level objects by their type.
+ var namesByType typeutil.Map // value is []string
+ for _, name := range scope.Names() {
+ T := scope.Lookup(name).Type()
+
+ names, _ := namesByType.At(T).([]string)
+ names = append(names, name)
+ namesByType.Set(T, names)
+ }
+
+ // Format, sort, and print the map entries.
+ var lines []string
+ namesByType.Iterate(func(T types.Type, names interface{}) {
+ lines = append(lines, fmt.Sprintf("%s %s", names, T))
+ })
+ sort.Strings(lines)
+ for _, line := range lines {
+ fmt.Println(line)
+ }
+
+ // Output:
+ // [X Y] []string
+ // [f g] func(offset int32) (value byte, ok bool)
+ // [p q] untyped float
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/imports.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/imports.go
new file mode 100644
index 0000000000..967fe1e934
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/imports.go
@@ -0,0 +1,31 @@
+// Copyright 2014 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.
+
+package typeutil
+
+import "golang.org/x/tools/go/types"
+
+// Dependencies returns all dependencies of the specified packages.
+//
+// Dependent packages appear in topological order: if package P imports
+// package Q, Q appears earlier than P in the result.
+// The algorithm follows import statements in the order they
+// appear in the source code, so the result is a total order.
+//
+func Dependencies(pkgs ...*types.Package) []*types.Package {
+ var result []*types.Package
+ seen := make(map[*types.Package]bool)
+ var visit func(pkgs []*types.Package)
+ visit = func(pkgs []*types.Package) {
+ for _, p := range pkgs {
+ if !seen[p] {
+ seen[p] = true
+ visit(p.Imports())
+ result = append(result, p)
+ }
+ }
+ }
+ visit(pkgs)
+ return result
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/imports_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/imports_test.go
new file mode 100644
index 0000000000..8071ae1b11
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/imports_test.go
@@ -0,0 +1,79 @@
+// Copyright 2014 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.
+
+package typeutil_test
+
+import (
+ "fmt"
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "testing"
+
+ "golang.org/x/tools/go/types"
+ "golang.org/x/tools/go/types/typeutil"
+)
+
+func TestDependencies(t *testing.T) {
+ packages := make(map[string]*types.Package)
+ conf := types.Config{
+ Packages: packages,
+ Import: func(_ map[string]*types.Package, path string) (*types.Package, error) {
+ return packages[path], nil
+ },
+ }
+ fset := token.NewFileSet()
+
+ // All edges go to the right.
+ // /--D--B--A
+ // F \_C_/
+ // \__E_/
+ for i, content := range []string{
+ `package A`,
+ `package C; import (_ "A")`,
+ `package B; import (_ "A")`,
+ `package E; import (_ "C")`,
+ `package D; import (_ "B"; _ "C")`,
+ `package F; import (_ "D"; _ "E")`,
+ } {
+ f, err := parser.ParseFile(fset, fmt.Sprintf("%d.go", i), content, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ pkg, err := conf.Check(f.Name.Name, fset, []*ast.File{f}, nil)
+ if err != nil {
+ t.Fatal(err)
+ }
+ packages[pkg.Path()] = pkg
+ }
+
+ for _, test := range []struct {
+ roots, want string
+ }{
+ {"A", "A"},
+ {"B", "AB"},
+ {"C", "AC"},
+ {"D", "ABCD"},
+ {"E", "ACE"},
+ {"F", "ABCDEF"},
+
+ {"BE", "ABCE"},
+ {"EB", "ACEB"},
+ {"DE", "ABCDE"},
+ {"ED", "ACEBD"},
+ {"EF", "ACEBDF"},
+ } {
+ var pkgs []*types.Package
+ for _, r := range test.roots {
+ pkgs = append(pkgs, conf.Packages[string(r)])
+ }
+ var got string
+ for _, p := range typeutil.Dependencies(pkgs...) {
+ got += p.Path()
+ }
+ if got != test.want {
+ t.Errorf("Dependencies(%q) = %q, want %q", test.roots, got, test.want)
+ }
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/map.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/map.go
new file mode 100644
index 0000000000..bf1ed2d956
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/map.go
@@ -0,0 +1,314 @@
+// Copyright 2014 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.
+
+// Package typeutil defines various utilities for types, such as Map,
+// a mapping from types.Type to interface{} values.
+package typeutil
+
+import (
+ "bytes"
+ "fmt"
+ "reflect"
+
+ "golang.org/x/tools/go/types"
+)
+
+// Map is a hash-table-based mapping from types (types.Type) to
+// arbitrary interface{} values. The concrete types that implement
+// the Type interface are pointers. Since they are not canonicalized,
+// == cannot be used to check for equivalence, and thus we cannot
+// simply use a Go map.
+//
+// Just as with map[K]V, a nil *Map is a valid empty map.
+//
+// Not thread-safe.
+//
+type Map struct {
+ hasher Hasher // shared by many Maps
+ table map[uint32][]entry // maps hash to bucket; entry.key==nil means unused
+ length int // number of map entries
+}
+
+// entry is an entry (key/value association) in a hash bucket.
+type entry struct {
+ key types.Type
+ value interface{}
+}
+
+// SetHasher sets the hasher used by Map.
+//
+// All Hashers are functionally equivalent but contain internal state
+// used to cache the results of hashing previously seen types.
+//
+// A single Hasher created by MakeHasher() may be shared among many
+// Maps. This is recommended if the instances have many keys in
+// common, as it will amortize the cost of hash computation.
+//
+// A Hasher may grow without bound as new types are seen. Even when a
+// type is deleted from the map, the Hasher never shrinks, since other
+// types in the map may reference the deleted type indirectly.
+//
+// Hashers are not thread-safe, and read-only operations such as
+// Map.Lookup require updates to the hasher, so a full Mutex lock (not a
+// read-lock) is require around all Map operations if a shared
+// hasher is accessed from multiple threads.
+//
+// If SetHasher is not called, the Map will create a private hasher at
+// the first call to Insert.
+//
+func (m *Map) SetHasher(hasher Hasher) {
+ m.hasher = hasher
+}
+
+// Delete removes the entry with the given key, if any.
+// It returns true if the entry was found.
+//
+func (m *Map) Delete(key types.Type) bool {
+ if m != nil && m.table != nil {
+ hash := m.hasher.Hash(key)
+ bucket := m.table[hash]
+ for i, e := range bucket {
+ if e.key != nil && types.Identical(key, e.key) {
+ // We can't compact the bucket as it
+ // would disturb iterators.
+ bucket[i] = entry{}
+ m.length--
+ return true
+ }
+ }
+ }
+ return false
+}
+
+// At returns the map entry for the given key.
+// The result is nil if the entry is not present.
+//
+func (m *Map) At(key types.Type) interface{} {
+ if m != nil && m.table != nil {
+ for _, e := range m.table[m.hasher.Hash(key)] {
+ if e.key != nil && types.Identical(key, e.key) {
+ return e.value
+ }
+ }
+ }
+ return nil
+}
+
+// Set sets the map entry for key to val,
+// and returns the previous entry, if any.
+func (m *Map) Set(key types.Type, value interface{}) (prev interface{}) {
+ if m.table != nil {
+ hash := m.hasher.Hash(key)
+ bucket := m.table[hash]
+ var hole *entry
+ for i, e := range bucket {
+ if e.key == nil {
+ hole = &bucket[i]
+ } else if types.Identical(key, e.key) {
+ prev = e.value
+ bucket[i].value = value
+ return
+ }
+ }
+
+ if hole != nil {
+ *hole = entry{key, value} // overwrite deleted entry
+ } else {
+ m.table[hash] = append(bucket, entry{key, value})
+ }
+ } else {
+ if m.hasher.memo == nil {
+ m.hasher = MakeHasher()
+ }
+ hash := m.hasher.Hash(key)
+ m.table = map[uint32][]entry{hash: {entry{key, value}}}
+ }
+
+ m.length++
+ return
+}
+
+// Len returns the number of map entries.
+func (m *Map) Len() int {
+ if m != nil {
+ return m.length
+ }
+ return 0
+}
+
+// Iterate calls function f on each entry in the map in unspecified order.
+//
+// If f should mutate the map, Iterate provides the same guarantees as
+// Go maps: if f deletes a map entry that Iterate has not yet reached,
+// f will not be invoked for it, but if f inserts a map entry that
+// Iterate has not yet reached, whether or not f will be invoked for
+// it is unspecified.
+//
+func (m *Map) Iterate(f func(key types.Type, value interface{})) {
+ if m != nil {
+ for _, bucket := range m.table {
+ for _, e := range bucket {
+ if e.key != nil {
+ f(e.key, e.value)
+ }
+ }
+ }
+ }
+}
+
+// Keys returns a new slice containing the set of map keys.
+// The order is unspecified.
+func (m *Map) Keys() []types.Type {
+ keys := make([]types.Type, 0, m.Len())
+ m.Iterate(func(key types.Type, _ interface{}) {
+ keys = append(keys, key)
+ })
+ return keys
+}
+
+func (m *Map) toString(values bool) string {
+ if m == nil {
+ return "{}"
+ }
+ var buf bytes.Buffer
+ fmt.Fprint(&buf, "{")
+ sep := ""
+ m.Iterate(func(key types.Type, value interface{}) {
+ fmt.Fprint(&buf, sep)
+ sep = ", "
+ fmt.Fprint(&buf, key)
+ if values {
+ fmt.Fprintf(&buf, ": %q", value)
+ }
+ })
+ fmt.Fprint(&buf, "}")
+ return buf.String()
+}
+
+// String returns a string representation of the map's entries.
+// Values are printed using fmt.Sprintf("%v", v).
+// Order is unspecified.
+//
+func (m *Map) String() string {
+ return m.toString(true)
+}
+
+// KeysString returns a string representation of the map's key set.
+// Order is unspecified.
+//
+func (m *Map) KeysString() string {
+ return m.toString(false)
+}
+
+////////////////////////////////////////////////////////////////////////
+// Hasher
+
+// A Hasher maps each type to its hash value.
+// For efficiency, a hasher uses memoization; thus its memory
+// footprint grows monotonically over time.
+// Hashers are not thread-safe.
+// Hashers have reference semantics.
+// Call MakeHasher to create a Hasher.
+type Hasher struct {
+ memo map[types.Type]uint32
+}
+
+// MakeHasher returns a new Hasher instance.
+func MakeHasher() Hasher {
+ return Hasher{make(map[types.Type]uint32)}
+}
+
+// Hash computes a hash value for the given type t such that
+// Identical(t, t') => Hash(t) == Hash(t').
+func (h Hasher) Hash(t types.Type) uint32 {
+ hash, ok := h.memo[t]
+ if !ok {
+ hash = h.hashFor(t)
+ h.memo[t] = hash
+ }
+ return hash
+}
+
+// hashString computes the Fowler–Noll–Vo hash of s.
+func hashString(s string) uint32 {
+ var h uint32
+ for i := 0; i < len(s); i++ {
+ h ^= uint32(s[i])
+ h *= 16777619
+ }
+ return h
+}
+
+// hashFor computes the hash of t.
+func (h Hasher) hashFor(t types.Type) uint32 {
+ // See Identical for rationale.
+ switch t := t.(type) {
+ case *types.Basic:
+ return uint32(t.Kind())
+
+ case *types.Array:
+ return 9043 + 2*uint32(t.Len()) + 3*h.Hash(t.Elem())
+
+ case *types.Slice:
+ return 9049 + 2*h.Hash(t.Elem())
+
+ case *types.Struct:
+ var hash uint32 = 9059
+ for i, n := 0, t.NumFields(); i < n; i++ {
+ f := t.Field(i)
+ if f.Anonymous() {
+ hash += 8861
+ }
+ hash += hashString(t.Tag(i))
+ hash += hashString(f.Name()) // (ignore f.Pkg)
+ hash += h.Hash(f.Type())
+ }
+ return hash
+
+ case *types.Pointer:
+ return 9067 + 2*h.Hash(t.Elem())
+
+ case *types.Signature:
+ var hash uint32 = 9091
+ if t.Variadic() {
+ hash *= 8863
+ }
+ return hash + 3*h.hashTuple(t.Params()) + 5*h.hashTuple(t.Results())
+
+ case *types.Interface:
+ var hash uint32 = 9103
+ for i, n := 0, t.NumMethods(); i < n; i++ {
+ // See go/types.identicalMethods for rationale.
+ // Method order is not significant.
+ // Ignore m.Pkg().
+ m := t.Method(i)
+ hash += 3*hashString(m.Name()) + 5*h.Hash(m.Type())
+ }
+ return hash
+
+ case *types.Map:
+ return 9109 + 2*h.Hash(t.Key()) + 3*h.Hash(t.Elem())
+
+ case *types.Chan:
+ return 9127 + 2*uint32(t.Dir()) + 3*h.Hash(t.Elem())
+
+ case *types.Named:
+ // Not safe with a copying GC; objects may move.
+ return uint32(reflect.ValueOf(t.Obj()).Pointer())
+
+ case *types.Tuple:
+ return h.hashTuple(t)
+ }
+ panic(t)
+}
+
+func (h Hasher) hashTuple(tuple *types.Tuple) uint32 {
+ // See go/types.identicalTypes for rationale.
+ n := tuple.Len()
+ var hash uint32 = 9137 + 2*uint32(n)
+ for i := 0; i < n; i++ {
+ hash += 3 * h.Hash(tuple.At(i).Type())
+ }
+ return hash
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/map_test.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/map_test.go
new file mode 100644
index 0000000000..776b5e2ce4
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/map_test.go
@@ -0,0 +1,174 @@
+// Copyright 2014 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.
+
+package typeutil_test
+
+// TODO(adonovan):
+// - test use of explicit hasher across two maps.
+// - test hashcodes are consistent with equals for a range of types
+// (e.g. all types generated by type-checking some body of real code).
+
+import (
+ "testing"
+
+ "golang.org/x/tools/go/types"
+ "golang.org/x/tools/go/types/typeutil"
+)
+
+var (
+ tStr = types.Typ[types.String] // string
+ tPStr1 = types.NewPointer(tStr) // *string
+ tPStr2 = types.NewPointer(tStr) // *string, again
+ tInt = types.Typ[types.Int] // int
+ tChanInt1 = types.NewChan(types.RecvOnly, tInt) // <-chan int
+ tChanInt2 = types.NewChan(types.RecvOnly, tInt) // <-chan int, again
+)
+
+func checkEqualButNotIdentical(t *testing.T, x, y types.Type, comment string) {
+ if !types.Identical(x, y) {
+ t.Errorf("%s: not equal: %s, %s", comment, x, y)
+ }
+ if x == y {
+ t.Errorf("%s: identical: %v, %v", comment, x, y)
+ }
+}
+
+func TestAxioms(t *testing.T) {
+ checkEqualButNotIdentical(t, tPStr1, tPStr2, "tPstr{1,2}")
+ checkEqualButNotIdentical(t, tChanInt1, tChanInt2, "tChanInt{1,2}")
+}
+
+func TestMap(t *testing.T) {
+ var tmap *typeutil.Map
+
+ // All methods but Set are safe on on (*T)(nil).
+ tmap.Len()
+ tmap.At(tPStr1)
+ tmap.Delete(tPStr1)
+ tmap.KeysString()
+ tmap.String()
+
+ tmap = new(typeutil.Map)
+
+ // Length of empty map.
+ if l := tmap.Len(); l != 0 {
+ t.Errorf("Len() on empty Map: got %d, want 0", l)
+ }
+ // At of missing key.
+ if v := tmap.At(tPStr1); v != nil {
+ t.Errorf("At() on empty Map: got %v, want nil", v)
+ }
+ // Deletion of missing key.
+ if tmap.Delete(tPStr1) {
+ t.Errorf("Delete() on empty Map: got true, want false")
+ }
+ // Set of new key.
+ if prev := tmap.Set(tPStr1, "*string"); prev != nil {
+ t.Errorf("Set() on empty Map returned non-nil previous value %s", prev)
+ }
+
+ // Now: {*string: "*string"}
+
+ // Length of non-empty map.
+ if l := tmap.Len(); l != 1 {
+ t.Errorf("Len(): got %d, want 1", l)
+ }
+ // At via insertion key.
+ if v := tmap.At(tPStr1); v != "*string" {
+ t.Errorf("At(): got %q, want \"*string\"", v)
+ }
+ // At via equal key.
+ if v := tmap.At(tPStr2); v != "*string" {
+ t.Errorf("At(): got %q, want \"*string\"", v)
+ }
+ // Iteration over sole entry.
+ tmap.Iterate(func(key types.Type, value interface{}) {
+ if key != tPStr1 {
+ t.Errorf("Iterate: key: got %s, want %s", key, tPStr1)
+ }
+ if want := "*string"; value != want {
+ t.Errorf("Iterate: value: got %s, want %s", value, want)
+ }
+ })
+
+ // Setion with key equal to present one.
+ if prev := tmap.Set(tPStr2, "*string again"); prev != "*string" {
+ t.Errorf("Set() previous value: got %s, want \"*string\"", prev)
+ }
+
+ // Setion of another association.
+ if prev := tmap.Set(tChanInt1, "<-chan int"); prev != nil {
+ t.Errorf("Set() previous value: got %s, want nil", prev)
+ }
+
+ // Now: {*string: "*string again", <-chan int: "<-chan int"}
+
+ want1 := "{*string: \"*string again\", <-chan int: \"<-chan int\"}"
+ want2 := "{<-chan int: \"<-chan int\", *string: \"*string again\"}"
+ if s := tmap.String(); s != want1 && s != want2 {
+ t.Errorf("String(): got %s, want %s", s, want1)
+ }
+
+ want1 = "{*string, <-chan int}"
+ want2 = "{<-chan int, *string}"
+ if s := tmap.KeysString(); s != want1 && s != want2 {
+ t.Errorf("KeysString(): got %s, want %s", s, want1)
+ }
+
+ // Keys().
+ I := types.Identical
+ switch k := tmap.Keys(); {
+ case I(k[0], tChanInt1) && I(k[1], tPStr1): // ok
+ case I(k[1], tChanInt1) && I(k[0], tPStr1): // ok
+ default:
+ t.Errorf("Keys(): got %v, want %s", k, want2)
+ }
+
+ if l := tmap.Len(); l != 2 {
+ t.Errorf("Len(): got %d, want 1", l)
+ }
+ // At via original key.
+ if v := tmap.At(tPStr1); v != "*string again" {
+ t.Errorf("At(): got %q, want \"*string again\"", v)
+ }
+ hamming := 1
+ tmap.Iterate(func(key types.Type, value interface{}) {
+ switch {
+ case I(key, tChanInt1):
+ hamming *= 2 // ok
+ case I(key, tPStr1):
+ hamming *= 3 // ok
+ }
+ })
+ if hamming != 6 {
+ t.Errorf("Iterate: hamming: got %d, want %d", hamming, 6)
+ }
+
+ if v := tmap.At(tChanInt2); v != "<-chan int" {
+ t.Errorf("At(): got %q, want \"<-chan int\"", v)
+ }
+ // Deletion with key equal to present one.
+ if !tmap.Delete(tChanInt2) {
+ t.Errorf("Delete() of existing key: got false, want true")
+ }
+
+ // Now: {*string: "*string again"}
+
+ if l := tmap.Len(); l != 1 {
+ t.Errorf("Len(): got %d, want 1", l)
+ }
+ // Deletion again.
+ if !tmap.Delete(tPStr2) {
+ t.Errorf("Delete() of existing key: got false, want true")
+ }
+
+ // Now: {}
+
+ if l := tmap.Len(); l != 0 {
+ t.Errorf("Len(): got %d, want %d", l, 0)
+ }
+ if s := tmap.String(); s != "{}" {
+ t.Errorf("Len(): got %q, want %q", s, "")
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/methodsetcache.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/methodsetcache.go
new file mode 100644
index 0000000000..daad6445ab
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/methodsetcache.go
@@ -0,0 +1,73 @@
+// Copyright 2014 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.
+
+// This file implements a cache of method sets.
+
+package typeutil
+
+import (
+ "sync"
+
+ "golang.org/x/tools/go/types"
+)
+
+// A MethodSetCache records the method set of each type T for which
+// MethodSet(T) is called so that repeat queries are fast.
+// The zero value is a ready-to-use cache instance.
+type MethodSetCache struct {
+ mu sync.Mutex
+ named map[*types.Named]struct{ value, pointer *types.MethodSet } // method sets for named N and *N
+ others map[types.Type]*types.MethodSet // all other types
+}
+
+// MethodSet returns the method set of type T. It is thread-safe.
+//
+// If cache is nil, this function is equivalent to types.NewMethodSet(T).
+// Utility functions can thus expose an optional *MethodSetCache
+// parameter to clients that care about performance.
+//
+func (cache *MethodSetCache) MethodSet(T types.Type) *types.MethodSet {
+ if cache == nil {
+ return types.NewMethodSet(T)
+ }
+ cache.mu.Lock()
+ defer cache.mu.Unlock()
+
+ switch T := T.(type) {
+ case *types.Named:
+ return cache.lookupNamed(T).value
+
+ case *types.Pointer:
+ if N, ok := T.Elem().(*types.Named); ok {
+ return cache.lookupNamed(N).pointer
+ }
+ }
+
+ // all other types
+ // (The map uses pointer equivalence, not type identity.)
+ mset := cache.others[T]
+ if mset == nil {
+ mset = types.NewMethodSet(T)
+ if cache.others == nil {
+ cache.others = make(map[types.Type]*types.MethodSet)
+ }
+ cache.others[T] = mset
+ }
+ return mset
+}
+
+func (cache *MethodSetCache) lookupNamed(named *types.Named) struct{ value, pointer *types.MethodSet } {
+ if cache.named == nil {
+ cache.named = make(map[*types.Named]struct{ value, pointer *types.MethodSet })
+ }
+ // Avoid recomputing mset(*T) for each distinct Pointer
+ // instance whose underlying type is a named type.
+ msets, ok := cache.named[named]
+ if !ok {
+ msets.value = types.NewMethodSet(named)
+ msets.pointer = types.NewMethodSet(types.NewPointer(named))
+ cache.named[named] = msets
+ }
+ return msets
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/ui.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/ui.go
new file mode 100644
index 0000000000..20c5249a4a
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/typeutil/ui.go
@@ -0,0 +1,38 @@
+// Copyright 2014 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.
+
+package typeutil
+
+// This file defines utilities for user interfaces that display types.
+
+import "golang.org/x/tools/go/types"
+
+// IntuitiveMethodSet returns the intuitive method set of a type, T.
+//
+// The result contains MethodSet(T) and additionally, if T is a
+// concrete type, methods belonging to *T if there is no identically
+// named method on T itself. This corresponds to user intuition about
+// method sets; this function is intended only for user interfaces.
+//
+// The order of the result is as for types.MethodSet(T).
+//
+func IntuitiveMethodSet(T types.Type, msets *MethodSetCache) []*types.Selection {
+ var result []*types.Selection
+ mset := msets.MethodSet(T)
+ if _, ok := T.Underlying().(*types.Interface); ok {
+ for i, n := 0, mset.Len(); i < n; i++ {
+ result = append(result, mset.At(i))
+ }
+ } else {
+ pmset := msets.MethodSet(types.NewPointer(T))
+ for i, n := 0, pmset.Len(); i < n; i++ {
+ meth := pmset.At(i)
+ if m := mset.Lookup(meth.Obj().Pkg(), meth.Obj().Name()); m != nil {
+ meth = m
+ }
+ result = append(result, meth)
+ }
+ }
+ return result
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/typexpr.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/typexpr.go
new file mode 100644
index 0000000000..bd2d7ba272
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/typexpr.go
@@ -0,0 +1,713 @@
+// 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.
+
+// This file implements type-checking of identifiers and type expressions.
+
+package types
+
+import (
+ "go/ast"
+ "go/token"
+ "sort"
+ "strconv"
+
+ "golang.org/x/tools/go/exact"
+)
+
+// ident type-checks identifier e and initializes x with the value or type of e.
+// If an error occurred, x.mode is set to invalid.
+// For the meaning of def and path, see check.typ, below.
+//
+func (check *Checker) ident(x *operand, e *ast.Ident, def *Named, path []*TypeName) {
+ x.mode = invalid
+ x.expr = e
+
+ scope, obj := check.scope.LookupParent(e.Name, check.pos)
+ if obj == nil {
+ if e.Name == "_" {
+ check.errorf(e.Pos(), "cannot use _ as value or type")
+ } else {
+ check.errorf(e.Pos(), "undeclared name: %s", e.Name)
+ }
+ return
+ }
+ check.recordUse(e, obj)
+
+ check.objDecl(obj, def, path)
+ typ := obj.Type()
+ assert(typ != nil)
+
+ // The object may be dot-imported: If so, remove its package from
+ // the map of unused dot imports for the respective file scope.
+ // (This code is only needed for dot-imports. Without them,
+ // we only have to mark variables, see *Var case below).
+ if pkg := obj.Pkg(); pkg != check.pkg && pkg != nil {
+ delete(check.unusedDotImports[scope], pkg)
+ }
+
+ switch obj := obj.(type) {
+ case *PkgName:
+ check.errorf(e.Pos(), "use of package %s not in selector", obj.name)
+ return
+
+ case *Const:
+ check.addDeclDep(obj)
+ if typ == Typ[Invalid] {
+ return
+ }
+ if obj == universeIota {
+ if check.iota == nil {
+ check.errorf(e.Pos(), "cannot use iota outside constant declaration")
+ return
+ }
+ x.val = check.iota
+ } else {
+ x.val = obj.val
+ }
+ assert(x.val != nil)
+ x.mode = constant
+
+ case *TypeName:
+ x.mode = typexpr
+ // check for cycle
+ // (it's ok to iterate forward because each named type appears at most once in path)
+ for i, prev := range path {
+ if prev == obj {
+ check.errorf(obj.pos, "illegal cycle in declaration of %s", obj.name)
+ // print cycle
+ for _, obj := range path[i:] {
+ check.errorf(obj.Pos(), "\t%s refers to", obj.Name()) // secondary error, \t indented
+ }
+ check.errorf(obj.Pos(), "\t%s", obj.Name())
+ // maintain x.mode == typexpr despite error
+ typ = Typ[Invalid]
+ break
+ }
+ }
+
+ case *Var:
+ if obj.pkg == check.pkg {
+ obj.used = true
+ }
+ check.addDeclDep(obj)
+ if typ == Typ[Invalid] {
+ return
+ }
+ x.mode = variable
+
+ case *Func:
+ check.addDeclDep(obj)
+ x.mode = value
+
+ case *Builtin:
+ x.id = obj.id
+ x.mode = builtin
+
+ case *Nil:
+ x.mode = value
+
+ default:
+ unreachable()
+ }
+
+ x.typ = typ
+}
+
+// typExpr type-checks the type expression e and returns its type, or Typ[Invalid].
+// If def != nil, e is the type specification for the named type def, declared
+// in a type declaration, and def.underlying will be set to the type of e before
+// any components of e are type-checked. Path contains the path of named types
+// referring to this type.
+//
+func (check *Checker) typExpr(e ast.Expr, def *Named, path []*TypeName) (T Type) {
+ if trace {
+ check.trace(e.Pos(), "%s", e)
+ check.indent++
+ defer func() {
+ check.indent--
+ check.trace(e.Pos(), "=> %s", T)
+ }()
+ }
+
+ T = check.typExprInternal(e, def, path)
+ assert(isTyped(T))
+ check.recordTypeAndValue(e, typexpr, T, nil)
+
+ return
+}
+
+func (check *Checker) typ(e ast.Expr) Type {
+ return check.typExpr(e, nil, nil)
+}
+
+// funcType type-checks a function or method type.
+func (check *Checker) funcType(sig *Signature, recvPar *ast.FieldList, ftyp *ast.FuncType) {
+ scope := NewScope(check.scope, token.NoPos, token.NoPos, "function")
+ check.recordScope(ftyp, scope)
+
+ recvList, _ := check.collectParams(scope, recvPar, false)
+ params, variadic := check.collectParams(scope, ftyp.Params, true)
+ results, _ := check.collectParams(scope, ftyp.Results, false)
+
+ if recvPar != nil {
+ // recv parameter list present (may be empty)
+ // spec: "The receiver is specified via an extra parameter section preceeding the
+ // method name. That parameter section must declare a single parameter, the receiver."
+ var recv *Var
+ switch len(recvList) {
+ case 0:
+ check.error(recvPar.Pos(), "method is missing receiver")
+ recv = NewParam(0, nil, "", Typ[Invalid]) // ignore recv below
+ default:
+ // more than one receiver
+ check.error(recvList[len(recvList)-1].Pos(), "method must have exactly one receiver")
+ fallthrough // continue with first receiver
+ case 1:
+ recv = recvList[0]
+ }
+ // spec: "The receiver type must be of the form T or *T where T is a type name."
+ // (ignore invalid types - error was reported before)
+ if t, _ := deref(recv.typ); t != Typ[Invalid] {
+ var err string
+ if T, _ := t.(*Named); T != nil {
+ // spec: "The type denoted by T is called the receiver base type; it must not
+ // be a pointer or interface type and it must be declared in the same package
+ // as the method."
+ if T.obj.pkg != check.pkg {
+ err = "type not defined in this package"
+ } else {
+ // TODO(gri) This is not correct if the underlying type is unknown yet.
+ switch u := T.underlying.(type) {
+ case *Basic:
+ // unsafe.Pointer is treated like a regular pointer
+ if u.kind == UnsafePointer {
+ err = "unsafe.Pointer"
+ }
+ case *Pointer, *Interface:
+ err = "pointer or interface type"
+ }
+ }
+ } else {
+ err = "basic or unnamed type"
+ }
+ if err != "" {
+ check.errorf(recv.pos, "invalid receiver %s (%s)", recv.typ, err)
+ // ok to continue
+ }
+ }
+ sig.recv = recv
+ }
+
+ sig.scope = scope
+ sig.params = NewTuple(params...)
+ sig.results = NewTuple(results...)
+ sig.variadic = variadic
+}
+
+// typExprInternal drives type checking of types.
+// Must only be called by typExpr.
+//
+func (check *Checker) typExprInternal(e ast.Expr, def *Named, path []*TypeName) Type {
+ switch e := e.(type) {
+ case *ast.BadExpr:
+ // ignore - error reported before
+
+ case *ast.Ident:
+ var x operand
+ check.ident(&x, e, def, path)
+
+ switch x.mode {
+ case typexpr:
+ typ := x.typ
+ def.setUnderlying(typ)
+ return typ
+ case invalid:
+ // ignore - error reported before
+ case novalue:
+ check.errorf(x.pos(), "%s used as type", &x)
+ default:
+ check.errorf(x.pos(), "%s is not a type", &x)
+ }
+
+ case *ast.SelectorExpr:
+ var x operand
+ check.selector(&x, e)
+
+ switch x.mode {
+ case typexpr:
+ typ := x.typ
+ def.setUnderlying(typ)
+ return typ
+ case invalid:
+ // ignore - error reported before
+ case novalue:
+ check.errorf(x.pos(), "%s used as type", &x)
+ default:
+ check.errorf(x.pos(), "%s is not a type", &x)
+ }
+
+ case *ast.ParenExpr:
+ return check.typExpr(e.X, def, path)
+
+ case *ast.ArrayType:
+ if e.Len != nil {
+ typ := new(Array)
+ def.setUnderlying(typ)
+ typ.len = check.arrayLength(e.Len)
+ typ.elem = check.typExpr(e.Elt, nil, path)
+ return typ
+
+ } else {
+ typ := new(Slice)
+ def.setUnderlying(typ)
+ typ.elem = check.typ(e.Elt)
+ return typ
+ }
+
+ case *ast.StructType:
+ typ := new(Struct)
+ def.setUnderlying(typ)
+ check.structType(typ, e, path)
+ return typ
+
+ case *ast.StarExpr:
+ typ := new(Pointer)
+ def.setUnderlying(typ)
+ typ.base = check.typ(e.X)
+ return typ
+
+ case *ast.FuncType:
+ typ := new(Signature)
+ def.setUnderlying(typ)
+ check.funcType(typ, nil, e)
+ return typ
+
+ case *ast.InterfaceType:
+ typ := new(Interface)
+ def.setUnderlying(typ)
+ check.interfaceType(typ, e, def, path)
+ return typ
+
+ case *ast.MapType:
+ typ := new(Map)
+ def.setUnderlying(typ)
+
+ typ.key = check.typ(e.Key)
+ typ.elem = check.typ(e.Value)
+
+ // spec: "The comparison operators == and != must be fully defined
+ // for operands of the key type; thus the key type must not be a
+ // function, map, or slice."
+ //
+ // Delay this check because it requires fully setup types;
+ // it is safe to continue in any case (was issue 6667).
+ check.delay(func() {
+ if !Comparable(typ.key) {
+ check.errorf(e.Key.Pos(), "invalid map key type %s", typ.key)
+ }
+ })
+
+ return typ
+
+ case *ast.ChanType:
+ typ := new(Chan)
+ def.setUnderlying(typ)
+
+ dir := SendRecv
+ switch e.Dir {
+ case ast.SEND | ast.RECV:
+ // nothing to do
+ case ast.SEND:
+ dir = SendOnly
+ case ast.RECV:
+ dir = RecvOnly
+ default:
+ check.invalidAST(e.Pos(), "unknown channel direction %d", e.Dir)
+ // ok to continue
+ }
+
+ typ.dir = dir
+ typ.elem = check.typ(e.Value)
+ return typ
+
+ default:
+ check.errorf(e.Pos(), "%s is not a type", e)
+ }
+
+ typ := Typ[Invalid]
+ def.setUnderlying(typ)
+ return typ
+}
+
+// typeOrNil type-checks the type expression (or nil value) e
+// and returns the typ of e, or nil.
+// If e is neither a type nor nil, typOrNil returns Typ[Invalid].
+//
+func (check *Checker) typOrNil(e ast.Expr) Type {
+ var x operand
+ check.rawExpr(&x, e, nil)
+ switch x.mode {
+ case invalid:
+ // ignore - error reported before
+ case novalue:
+ check.errorf(x.pos(), "%s used as type", &x)
+ case typexpr:
+ return x.typ
+ case value:
+ if x.isNil() {
+ return nil
+ }
+ fallthrough
+ default:
+ check.errorf(x.pos(), "%s is not a type", &x)
+ }
+ return Typ[Invalid]
+}
+
+func (check *Checker) arrayLength(e ast.Expr) int64 {
+ var x operand
+ check.expr(&x, e)
+ if x.mode != constant {
+ if x.mode != invalid {
+ check.errorf(x.pos(), "array length %s must be constant", &x)
+ }
+ return 0
+ }
+ if !x.isInteger() {
+ check.errorf(x.pos(), "array length %s must be integer", &x)
+ return 0
+ }
+ n, ok := exact.Int64Val(x.val)
+ if !ok || n < 0 {
+ check.errorf(x.pos(), "invalid array length %s", &x)
+ return 0
+ }
+ return n
+}
+
+func (check *Checker) collectParams(scope *Scope, list *ast.FieldList, variadicOk bool) (params []*Var, variadic bool) {
+ if list == nil {
+ return
+ }
+
+ var named, anonymous bool
+ for i, field := range list.List {
+ ftype := field.Type
+ if t, _ := ftype.(*ast.Ellipsis); t != nil {
+ ftype = t.Elt
+ if variadicOk && i == len(list.List)-1 {
+ variadic = true
+ } else {
+ check.invalidAST(field.Pos(), "... not permitted")
+ // ignore ... and continue
+ }
+ }
+ typ := check.typ(ftype)
+ // The parser ensures that f.Tag is nil and we don't
+ // care if a constructed AST contains a non-nil tag.
+ if len(field.Names) > 0 {
+ // named parameter
+ for _, name := range field.Names {
+ if name.Name == "" {
+ check.invalidAST(name.Pos(), "anonymous parameter")
+ // ok to continue
+ }
+ par := NewParam(name.Pos(), check.pkg, name.Name, typ)
+ check.declare(scope, name, par, scope.pos)
+ params = append(params, par)
+ }
+ named = true
+ } else {
+ // anonymous parameter
+ par := NewParam(ftype.Pos(), check.pkg, "", typ)
+ check.recordImplicit(field, par)
+ params = append(params, par)
+ anonymous = true
+ }
+ }
+
+ if named && anonymous {
+ check.invalidAST(list.Pos(), "list contains both named and anonymous parameters")
+ // ok to continue
+ }
+
+ // For a variadic function, change the last parameter's type from T to []T.
+ if variadic && len(params) > 0 {
+ last := params[len(params)-1]
+ last.typ = &Slice{elem: last.typ}
+ }
+
+ return
+}
+
+func (check *Checker) declareInSet(oset *objset, pos token.Pos, obj Object) bool {
+ if alt := oset.insert(obj); alt != nil {
+ check.errorf(pos, "%s redeclared", obj.Name())
+ check.reportAltDecl(alt)
+ return false
+ }
+ return true
+}
+
+func (check *Checker) interfaceType(iface *Interface, ityp *ast.InterfaceType, def *Named, path []*TypeName) {
+ // empty interface: common case
+ if ityp.Methods == nil {
+ return
+ }
+
+ // The parser ensures that field tags are nil and we don't
+ // care if a constructed AST contains non-nil tags.
+
+ // use named receiver type if available (for better error messages)
+ var recvTyp Type = iface
+ if def != nil {
+ recvTyp = def
+ }
+
+ // Phase 1: Collect explicitly declared methods, the corresponding
+ // signature (AST) expressions, and the list of embedded
+ // type (AST) expressions. Do not resolve signatures or
+ // embedded types yet to avoid cycles referring to this
+ // interface.
+
+ var (
+ mset objset
+ signatures []ast.Expr // list of corresponding method signatures
+ embedded []ast.Expr // list of embedded types
+ )
+ for _, f := range ityp.Methods.List {
+ if len(f.Names) > 0 {
+ // The parser ensures that there's only one method
+ // and we don't care if a constructed AST has more.
+ name := f.Names[0]
+ pos := name.Pos()
+ // spec: "As with all method sets, in an interface type,
+ // each method must have a unique non-blank name."
+ if name.Name == "_" {
+ check.errorf(pos, "invalid method name _")
+ continue
+ }
+ // Don't type-check signature yet - use an
+ // empty signature now and update it later.
+ // Since we know the receiver, set it up now
+ // (required to avoid crash in ptrRecv; see
+ // e.g. test case for issue 6638).
+ // TODO(gri) Consider marking methods signatures
+ // as incomplete, for better error messages. See
+ // also the T4 and T5 tests in testdata/cycles2.src.
+ sig := new(Signature)
+ sig.recv = NewVar(pos, check.pkg, "", recvTyp)
+ m := NewFunc(pos, check.pkg, name.Name, sig)
+ if check.declareInSet(&mset, pos, m) {
+ iface.methods = append(iface.methods, m)
+ iface.allMethods = append(iface.allMethods, m)
+ signatures = append(signatures, f.Type)
+ check.recordDef(name, m)
+ }
+ } else {
+ // embedded type
+ embedded = append(embedded, f.Type)
+ }
+ }
+
+ // Phase 2: Resolve embedded interfaces. Because an interface must not
+ // embed itself (directly or indirectly), each embedded interface
+ // can be fully resolved without depending on any method of this
+ // interface (if there is a cycle or another error, the embedded
+ // type resolves to an invalid type and is ignored).
+ // In particular, the list of methods for each embedded interface
+ // must be complete (it cannot depend on this interface), and so
+ // those methods can be added to the list of all methods of this
+ // interface.
+
+ for _, e := range embedded {
+ pos := e.Pos()
+ typ := check.typExpr(e, nil, path)
+ // Determine underlying embedded (possibly incomplete) type
+ // by following its forward chain.
+ named, _ := typ.(*Named)
+ under := underlying(named)
+ embed, _ := under.(*Interface)
+ if embed == nil {
+ if typ != Typ[Invalid] {
+ check.errorf(pos, "%s is not an interface", typ)
+ }
+ continue
+ }
+ iface.embeddeds = append(iface.embeddeds, named)
+ // collect embedded methods
+ for _, m := range embed.allMethods {
+ if check.declareInSet(&mset, pos, m) {
+ iface.allMethods = append(iface.allMethods, m)
+ }
+ }
+ }
+
+ // Phase 3: At this point all methods have been collected for this interface.
+ // It is now safe to type-check the signatures of all explicitly
+ // declared methods, even if they refer to this interface via a cycle
+ // and embed the methods of this interface in a parameter of interface
+ // type.
+
+ for i, m := range iface.methods {
+ expr := signatures[i]
+ typ := check.typ(expr)
+ sig, _ := typ.(*Signature)
+ if sig == nil {
+ if typ != Typ[Invalid] {
+ check.invalidAST(expr.Pos(), "%s is not a method signature", typ)
+ }
+ continue // keep method with empty method signature
+ }
+ // update signature, but keep recv that was set up before
+ old := m.typ.(*Signature)
+ sig.recv = old.recv
+ *old = *sig // update signature (don't replace it!)
+ }
+
+ // TODO(gri) The list of explicit methods is only sorted for now to
+ // produce the same Interface as NewInterface. We may be able to
+ // claim source order in the future. Revisit.
+ sort.Sort(byUniqueMethodName(iface.methods))
+
+ // TODO(gri) The list of embedded types is only sorted for now to
+ // produce the same Interface as NewInterface. We may be able to
+ // claim source order in the future. Revisit.
+ sort.Sort(byUniqueTypeName(iface.embeddeds))
+
+ sort.Sort(byUniqueMethodName(iface.allMethods))
+}
+
+// byUniqueTypeName named type lists can be sorted by their unique type names.
+type byUniqueTypeName []*Named
+
+func (a byUniqueTypeName) Len() int { return len(a) }
+func (a byUniqueTypeName) Less(i, j int) bool { return a[i].obj.Id() < a[j].obj.Id() }
+func (a byUniqueTypeName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
+
+// byUniqueMethodName method lists can be sorted by their unique method names.
+type byUniqueMethodName []*Func
+
+func (a byUniqueMethodName) Len() int { return len(a) }
+func (a byUniqueMethodName) Less(i, j int) bool { return a[i].Id() < a[j].Id() }
+func (a byUniqueMethodName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
+
+func (check *Checker) tag(t *ast.BasicLit) string {
+ if t != nil {
+ if t.Kind == token.STRING {
+ if val, err := strconv.Unquote(t.Value); err == nil {
+ return val
+ }
+ }
+ check.invalidAST(t.Pos(), "incorrect tag syntax: %q", t.Value)
+ }
+ return ""
+}
+
+func (check *Checker) structType(styp *Struct, e *ast.StructType, path []*TypeName) {
+ list := e.Fields
+ if list == nil {
+ return
+ }
+
+ // struct fields and tags
+ var fields []*Var
+ var tags []string
+
+ // for double-declaration checks
+ var fset objset
+
+ // current field typ and tag
+ var typ Type
+ var tag string
+ // anonymous != nil indicates an anonymous field.
+ add := func(field *ast.Field, ident *ast.Ident, anonymous *TypeName, pos token.Pos) {
+ if tag != "" && tags == nil {
+ tags = make([]string, len(fields))
+ }
+ if tags != nil {
+ tags = append(tags, tag)
+ }
+
+ name := ident.Name
+ fld := NewField(pos, check.pkg, name, typ, anonymous != nil)
+ // spec: "Within a struct, non-blank field names must be unique."
+ if name == "_" || check.declareInSet(&fset, pos, fld) {
+ fields = append(fields, fld)
+ check.recordDef(ident, fld)
+ }
+ if anonymous != nil {
+ check.recordUse(ident, anonymous)
+ }
+ }
+
+ for _, f := range list.List {
+ typ = check.typExpr(f.Type, nil, path)
+ tag = check.tag(f.Tag)
+ if len(f.Names) > 0 {
+ // named fields
+ for _, name := range f.Names {
+ add(f, name, nil, name.Pos())
+ }
+ } else {
+ // anonymous field
+ name := anonymousFieldIdent(f.Type)
+ pos := f.Type.Pos()
+ t, isPtr := deref(typ)
+ switch t := t.(type) {
+ case *Basic:
+ if t == Typ[Invalid] {
+ // error was reported before
+ continue
+ }
+ // unsafe.Pointer is treated like a regular pointer
+ if t.kind == UnsafePointer {
+ check.errorf(pos, "anonymous field type cannot be unsafe.Pointer")
+ continue
+ }
+ add(f, name, Universe.Lookup(t.name).(*TypeName), pos)
+
+ case *Named:
+ // spec: "An embedded type must be specified as a type name
+ // T or as a pointer to a non-interface type name *T, and T
+ // itself may not be a pointer type."
+ switch u := t.underlying.(type) {
+ case *Basic:
+ // unsafe.Pointer is treated like a regular pointer
+ if u.kind == UnsafePointer {
+ check.errorf(pos, "anonymous field type cannot be unsafe.Pointer")
+ continue
+ }
+ case *Pointer:
+ check.errorf(pos, "anonymous field type cannot be a pointer")
+ continue
+ case *Interface:
+ if isPtr {
+ check.errorf(pos, "anonymous field type cannot be a pointer to an interface")
+ continue
+ }
+ }
+ add(f, name, t.obj, pos)
+
+ default:
+ check.invalidAST(pos, "anonymous field type %s must be named", typ)
+ }
+ }
+ }
+
+ styp.fields = fields
+ styp.tags = tags
+}
+
+func anonymousFieldIdent(e ast.Expr) *ast.Ident {
+ switch e := e.(type) {
+ case *ast.Ident:
+ return e
+ case *ast.StarExpr:
+ return anonymousFieldIdent(e.X)
+ case *ast.SelectorExpr:
+ return e.Sel
+ }
+ return nil // invalid anonymous field
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/go/types/universe.go b/Godeps/_workspace/src/golang.org/x/tools/go/types/universe.go
new file mode 100644
index 0000000000..12a34ef853
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/go/types/universe.go
@@ -0,0 +1,224 @@
+// Copyright 2011 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.
+
+// This file sets up the universe scope and the unsafe package.
+
+package types
+
+import (
+ "go/token"
+ "strings"
+
+ "golang.org/x/tools/go/exact"
+)
+
+var (
+ Universe *Scope
+ Unsafe *Package
+ universeIota *Const
+ universeByte *Basic // uint8 alias, but has name "byte"
+ universeRune *Basic // int32 alias, but has name "rune"
+)
+
+var Typ = []*Basic{
+ Invalid: {Invalid, 0, "invalid type"},
+
+ Bool: {Bool, IsBoolean, "bool"},
+ Int: {Int, IsInteger, "int"},
+ Int8: {Int8, IsInteger, "int8"},
+ Int16: {Int16, IsInteger, "int16"},
+ Int32: {Int32, IsInteger, "int32"},
+ Int64: {Int64, IsInteger, "int64"},
+ Uint: {Uint, IsInteger | IsUnsigned, "uint"},
+ Uint8: {Uint8, IsInteger | IsUnsigned, "uint8"},
+ Uint16: {Uint16, IsInteger | IsUnsigned, "uint16"},
+ Uint32: {Uint32, IsInteger | IsUnsigned, "uint32"},
+ Uint64: {Uint64, IsInteger | IsUnsigned, "uint64"},
+ Uintptr: {Uintptr, IsInteger | IsUnsigned, "uintptr"},
+ Float32: {Float32, IsFloat, "float32"},
+ Float64: {Float64, IsFloat, "float64"},
+ Complex64: {Complex64, IsComplex, "complex64"},
+ Complex128: {Complex128, IsComplex, "complex128"},
+ String: {String, IsString, "string"},
+ UnsafePointer: {UnsafePointer, 0, "Pointer"},
+
+ UntypedBool: {UntypedBool, IsBoolean | IsUntyped, "untyped bool"},
+ UntypedInt: {UntypedInt, IsInteger | IsUntyped, "untyped int"},
+ UntypedRune: {UntypedRune, IsInteger | IsUntyped, "untyped rune"},
+ UntypedFloat: {UntypedFloat, IsFloat | IsUntyped, "untyped float"},
+ UntypedComplex: {UntypedComplex, IsComplex | IsUntyped, "untyped complex"},
+ UntypedString: {UntypedString, IsString | IsUntyped, "untyped string"},
+ UntypedNil: {UntypedNil, IsUntyped, "untyped nil"},
+}
+
+var aliases = [...]*Basic{
+ {Byte, IsInteger | IsUnsigned, "byte"},
+ {Rune, IsInteger, "rune"},
+}
+
+func defPredeclaredTypes() {
+ for _, t := range Typ {
+ def(NewTypeName(token.NoPos, nil, t.name, t))
+ }
+ for _, t := range aliases {
+ def(NewTypeName(token.NoPos, nil, t.name, t))
+ }
+
+ // Error has a nil package in its qualified name since it is in no package
+ res := NewVar(token.NoPos, nil, "", Typ[String])
+ sig := &Signature{results: NewTuple(res)}
+ err := NewFunc(token.NoPos, nil, "Error", sig)
+ typ := &Named{underlying: NewInterface([]*Func{err}, nil).Complete()}
+ sig.recv = NewVar(token.NoPos, nil, "", typ)
+ def(NewTypeName(token.NoPos, nil, "error", typ))
+}
+
+var predeclaredConsts = [...]struct {
+ name string
+ kind BasicKind
+ val exact.Value
+}{
+ {"true", UntypedBool, exact.MakeBool(true)},
+ {"false", UntypedBool, exact.MakeBool(false)},
+ {"iota", UntypedInt, exact.MakeInt64(0)},
+}
+
+func defPredeclaredConsts() {
+ for _, c := range predeclaredConsts {
+ def(NewConst(token.NoPos, nil, c.name, Typ[c.kind], c.val))
+ }
+}
+
+func defPredeclaredNil() {
+ def(&Nil{object{name: "nil", typ: Typ[UntypedNil]}})
+}
+
+// A builtinId is the id of a builtin function.
+type builtinId int
+
+const (
+ // universe scope
+ _Append builtinId = iota
+ _Cap
+ _Close
+ _Complex
+ _Copy
+ _Delete
+ _Imag
+ _Len
+ _Make
+ _New
+ _Panic
+ _Print
+ _Println
+ _Real
+ _Recover
+
+ // package unsafe
+ _Alignof
+ _Offsetof
+ _Sizeof
+
+ // testing support
+ _Assert
+ _Trace
+)
+
+var predeclaredFuncs = [...]struct {
+ name string
+ nargs int
+ variadic bool
+ kind exprKind
+}{
+ _Append: {"append", 1, true, expression},
+ _Cap: {"cap", 1, false, expression},
+ _Close: {"close", 1, false, statement},
+ _Complex: {"complex", 2, false, expression},
+ _Copy: {"copy", 2, false, statement},
+ _Delete: {"delete", 2, false, statement},
+ _Imag: {"imag", 1, false, expression},
+ _Len: {"len", 1, false, expression},
+ _Make: {"make", 1, true, expression},
+ _New: {"new", 1, false, expression},
+ _Panic: {"panic", 1, false, statement},
+ _Print: {"print", 0, true, statement},
+ _Println: {"println", 0, true, statement},
+ _Real: {"real", 1, false, expression},
+ _Recover: {"recover", 0, false, statement},
+
+ _Alignof: {"Alignof", 1, false, expression},
+ _Offsetof: {"Offsetof", 1, false, expression},
+ _Sizeof: {"Sizeof", 1, false, expression},
+
+ _Assert: {"assert", 1, false, statement},
+ _Trace: {"trace", 0, true, statement},
+}
+
+func defPredeclaredFuncs() {
+ for i := range predeclaredFuncs {
+ id := builtinId(i)
+ if id == _Assert || id == _Trace {
+ continue // only define these in testing environment
+ }
+ def(newBuiltin(id))
+ }
+}
+
+// DefPredeclaredTestFuncs defines the assert and trace built-ins.
+// These built-ins are intended for debugging and testing of this
+// package only.
+func DefPredeclaredTestFuncs() {
+ if Universe.Lookup("assert") != nil {
+ return // already defined
+ }
+ def(newBuiltin(_Assert))
+ def(newBuiltin(_Trace))
+}
+
+func init() {
+ Universe = NewScope(nil, token.NoPos, token.NoPos, "universe")
+ Unsafe = NewPackage("unsafe", "unsafe")
+ Unsafe.complete = true
+
+ defPredeclaredTypes()
+ defPredeclaredConsts()
+ defPredeclaredNil()
+ defPredeclaredFuncs()
+
+ universeIota = Universe.Lookup("iota").(*Const)
+ universeByte = Universe.Lookup("byte").(*TypeName).typ.(*Basic)
+ universeRune = Universe.Lookup("rune").(*TypeName).typ.(*Basic)
+}
+
+// Objects with names containing blanks are internal and not entered into
+// a scope. Objects with exported names are inserted in the unsafe package
+// scope; other objects are inserted in the universe scope.
+//
+func def(obj Object) {
+ name := obj.Name()
+ if strings.Index(name, " ") >= 0 {
+ return // nothing to do
+ }
+ // fix Obj link for named types
+ if typ, ok := obj.Type().(*Named); ok {
+ typ.obj = obj.(*TypeName)
+ }
+ // exported identifiers go into package unsafe
+ scope := Universe
+ if obj.Exported() {
+ scope = Unsafe.scope
+ // set Pkg field
+ switch obj := obj.(type) {
+ case *TypeName:
+ obj.pkg = Unsafe
+ case *Builtin:
+ obj.pkg = Unsafe
+ default:
+ unreachable()
+ }
+ }
+ if scope.Insert(obj) != nil {
+ panic("internal error: double declaration")
+ }
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/imports/fix.go b/Godeps/_workspace/src/golang.org/x/tools/imports/fix.go
new file mode 100644
index 0000000000..22fde6c1f0
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/imports/fix.go
@@ -0,0 +1,387 @@
+// 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.
+
+package imports
+
+import (
+ "fmt"
+ "go/ast"
+ "go/build"
+ "go/parser"
+ "go/token"
+ "os"
+ "path"
+ "path/filepath"
+ "strings"
+ "sync"
+
+ "golang.org/x/tools/go/ast/astutil"
+)
+
+// importToGroup is a list of functions which map from an import path to
+// a group number.
+var importToGroup = []func(importPath string) (num int, ok bool){
+ func(importPath string) (num int, ok bool) {
+ if strings.HasPrefix(importPath, "appengine") {
+ return 2, true
+ }
+ return
+ },
+ func(importPath string) (num int, ok bool) {
+ if strings.Contains(importPath, ".") {
+ return 1, true
+ }
+ return
+ },
+}
+
+func importGroup(importPath string) int {
+ for _, fn := range importToGroup {
+ if n, ok := fn(importPath); ok {
+ return n
+ }
+ }
+ return 0
+}
+
+func fixImports(fset *token.FileSet, f *ast.File) (added []string, err error) {
+ // refs are a set of possible package references currently unsatisfied by imports.
+ // first key: either base package (e.g. "fmt") or renamed package
+ // second key: referenced package symbol (e.g. "Println")
+ refs := make(map[string]map[string]bool)
+
+ // decls are the current package imports. key is base package or renamed package.
+ decls := make(map[string]*ast.ImportSpec)
+
+ // collect potential uses of packages.
+ var visitor visitFn
+ visitor = visitFn(func(node ast.Node) ast.Visitor {
+ if node == nil {
+ return visitor
+ }
+ switch v := node.(type) {
+ case *ast.ImportSpec:
+ if v.Name != nil {
+ decls[v.Name.Name] = v
+ } else {
+ local := importPathToName(strings.Trim(v.Path.Value, `\"`))
+ decls[local] = v
+ }
+ case *ast.SelectorExpr:
+ xident, ok := v.X.(*ast.Ident)
+ if !ok {
+ break
+ }
+ if xident.Obj != nil {
+ // if the parser can resolve it, it's not a package ref
+ break
+ }
+ pkgName := xident.Name
+ if refs[pkgName] == nil {
+ refs[pkgName] = make(map[string]bool)
+ }
+ if decls[pkgName] == nil {
+ refs[pkgName][v.Sel.Name] = true
+ }
+ }
+ return visitor
+ })
+ ast.Walk(visitor, f)
+
+ // Search for imports matching potential package references.
+ searches := 0
+ type result struct {
+ ipath string
+ name string
+ err error
+ }
+ results := make(chan result)
+ for pkgName, symbols := range refs {
+ if len(symbols) == 0 {
+ continue // skip over packages already imported
+ }
+ go func(pkgName string, symbols map[string]bool) {
+ ipath, rename, err := findImport(pkgName, symbols)
+ r := result{ipath: ipath, err: err}
+ if rename {
+ r.name = pkgName
+ }
+ results <- r
+ }(pkgName, symbols)
+ searches++
+ }
+ for i := 0; i < searches; i++ {
+ result := <-results
+ if result.err != nil {
+ return nil, result.err
+ }
+ if result.ipath != "" {
+ if result.name != "" {
+ astutil.AddNamedImport(fset, f, result.name, result.ipath)
+ } else {
+ astutil.AddImport(fset, f, result.ipath)
+ }
+ added = append(added, result.ipath)
+ }
+ }
+
+ // Nil out any unused ImportSpecs, to be removed in following passes
+ unusedImport := map[string]bool{}
+ for pkg, is := range decls {
+ if refs[pkg] == nil && pkg != "_" && pkg != "." {
+ unusedImport[strings.Trim(is.Path.Value, `"`)] = true
+ }
+ }
+ for ipath := range unusedImport {
+ if ipath == "C" {
+ // Don't remove cgo stuff.
+ continue
+ }
+ astutil.DeleteImport(fset, f, ipath)
+ }
+
+ return added, nil
+}
+
+// importPathToName returns the package name for the given import path.
+var importPathToName = importPathToNameGoPath
+
+// importPathToNameBasic assumes the package name is the base of import path.
+func importPathToNameBasic(importPath string) (packageName string) {
+ return path.Base(importPath)
+}
+
+// importPathToNameGoPath finds out the actual package name, as declared in its .go files.
+// If there's a problem, it falls back to using importPathToNameBasic.
+func importPathToNameGoPath(importPath string) (packageName string) {
+ if buildPkg, err := build.Import(importPath, "", 0); err == nil {
+ return buildPkg.Name
+ } else {
+ return importPathToNameBasic(importPath)
+ }
+}
+
+type pkg struct {
+ importpath string // full pkg import path, e.g. "net/http"
+ dir string // absolute file path to pkg directory e.g. "/usr/lib/go/src/fmt"
+}
+
+var pkgIndexOnce sync.Once
+
+var pkgIndex struct {
+ sync.Mutex
+ m map[string][]pkg // shortname => []pkg, e.g "http" => "net/http"
+}
+
+// gate is a semaphore for limiting concurrency.
+type gate chan struct{}
+
+func (g gate) enter() { g <- struct{}{} }
+func (g gate) leave() { <-g }
+
+// fsgate protects the OS & filesystem from too much concurrency.
+// Too much disk I/O -> too many threads -> swapping and bad scheduling.
+var fsgate = make(gate, 8)
+
+func loadPkgIndex() {
+ pkgIndex.Lock()
+ pkgIndex.m = make(map[string][]pkg)
+ pkgIndex.Unlock()
+
+ var wg sync.WaitGroup
+ for _, path := range build.Default.SrcDirs() {
+ fsgate.enter()
+ f, err := os.Open(path)
+ if err != nil {
+ fsgate.leave()
+ fmt.Fprint(os.Stderr, err)
+ continue
+ }
+ children, err := f.Readdir(-1)
+ f.Close()
+ fsgate.leave()
+ if err != nil {
+ fmt.Fprint(os.Stderr, err)
+ continue
+ }
+ for _, child := range children {
+ if child.IsDir() {
+ wg.Add(1)
+ go func(path, name string) {
+ defer wg.Done()
+ loadPkg(&wg, path, name)
+ }(path, child.Name())
+ }
+ }
+ }
+ wg.Wait()
+}
+
+func loadPkg(wg *sync.WaitGroup, root, pkgrelpath string) {
+ importpath := filepath.ToSlash(pkgrelpath)
+ dir := filepath.Join(root, importpath)
+
+ fsgate.enter()
+ defer fsgate.leave()
+ pkgDir, err := os.Open(dir)
+ if err != nil {
+ return
+ }
+ children, err := pkgDir.Readdir(-1)
+ pkgDir.Close()
+ if err != nil {
+ return
+ }
+ // hasGo tracks whether a directory actually appears to be a
+ // Go source code directory. If $GOPATH == $HOME, and
+ // $HOME/src has lots of other large non-Go projects in it,
+ // then the calls to importPathToName below can be expensive.
+ hasGo := false
+ for _, child := range children {
+ // Avoid .foo, _foo, and testdata directory trees.
+ name := child.Name()
+ if name == "" || name[0] == '.' || name[0] == '_' || name == "testdata" {
+ continue
+ }
+ if strings.HasSuffix(name, ".go") {
+ hasGo = true
+ }
+ if child.IsDir() {
+ wg.Add(1)
+ go func(root, name string) {
+ defer wg.Done()
+ loadPkg(wg, root, name)
+ }(root, filepath.Join(importpath, name))
+ }
+ }
+ if hasGo {
+ shortName := importPathToName(importpath)
+ pkgIndex.Lock()
+ pkgIndex.m[shortName] = append(pkgIndex.m[shortName], pkg{
+ importpath: importpath,
+ dir: dir,
+ })
+ pkgIndex.Unlock()
+ }
+
+}
+
+// loadExports returns a list exports for a package.
+var loadExports = loadExportsGoPath
+
+func loadExportsGoPath(dir string) map[string]bool {
+ exports := make(map[string]bool)
+ buildPkg, err := build.ImportDir(dir, 0)
+ if err != nil {
+ if strings.Contains(err.Error(), "no buildable Go source files in") {
+ return nil
+ }
+ fmt.Fprintf(os.Stderr, "could not import %q: %v\n", dir, err)
+ return nil
+ }
+ fset := token.NewFileSet()
+ for _, files := range [...][]string{buildPkg.GoFiles, buildPkg.CgoFiles} {
+ for _, file := range files {
+ f, err := parser.ParseFile(fset, filepath.Join(dir, file), nil, 0)
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "could not parse %q: %v\n", file, err)
+ continue
+ }
+ for name := range f.Scope.Objects {
+ if ast.IsExported(name) {
+ exports[name] = true
+ }
+ }
+ }
+ }
+ return exports
+}
+
+// findImport searches for a package with the given symbols.
+// If no package is found, findImport returns "".
+// Declared as a variable rather than a function so goimports can be easily
+// extended by adding a file with an init function.
+var findImport = findImportGoPath
+
+func findImportGoPath(pkgName string, symbols map[string]bool) (string, bool, error) {
+ // Fast path for the standard library.
+ // In the common case we hopefully never have to scan the GOPATH, which can
+ // be slow with moving disks.
+ if pkg, rename, ok := findImportStdlib(pkgName, symbols); ok {
+ return pkg, rename, nil
+ }
+
+ // TODO(sameer): look at the import lines for other Go files in the
+ // local directory, since the user is likely to import the same packages
+ // in the current Go file. Return rename=true when the other Go files
+ // use a renamed package that's also used in the current file.
+
+ pkgIndexOnce.Do(loadPkgIndex)
+
+ // Collect exports for packages with matching names.
+ var wg sync.WaitGroup
+ var pkgsMu sync.Mutex // guards pkgs
+ // full importpath => exported symbol => True
+ // e.g. "net/http" => "Client" => True
+ pkgs := make(map[string]map[string]bool)
+ pkgIndex.Lock()
+ for _, pkg := range pkgIndex.m[pkgName] {
+ wg.Add(1)
+ go func(importpath, dir string) {
+ defer wg.Done()
+ exports := loadExports(dir)
+ if exports != nil {
+ pkgsMu.Lock()
+ pkgs[importpath] = exports
+ pkgsMu.Unlock()
+ }
+ }(pkg.importpath, pkg.dir)
+ }
+ pkgIndex.Unlock()
+ wg.Wait()
+
+ // Filter out packages missing required exported symbols.
+ for symbol := range symbols {
+ for importpath, exports := range pkgs {
+ if !exports[symbol] {
+ delete(pkgs, importpath)
+ }
+ }
+ }
+ if len(pkgs) == 0 {
+ return "", false, nil
+ }
+
+ // If there are multiple candidate packages, the shortest one wins.
+ // This is a heuristic to prefer the standard library (e.g. "bytes")
+ // over e.g. "github.com/foo/bar/bytes".
+ shortest := ""
+ for importPath := range pkgs {
+ if shortest == "" || len(importPath) < len(shortest) {
+ shortest = importPath
+ }
+ }
+ return shortest, false, nil
+}
+
+type visitFn func(node ast.Node) ast.Visitor
+
+func (fn visitFn) Visit(node ast.Node) ast.Visitor {
+ return fn(node)
+}
+
+func findImportStdlib(shortPkg string, symbols map[string]bool) (importPath string, rename, ok bool) {
+ for symbol := range symbols {
+ path := stdlib[shortPkg+"."+symbol]
+ if path == "" {
+ return "", false, false
+ }
+ if importPath != "" && importPath != path {
+ // Ambiguous. Symbols pointed to different things.
+ return "", false, false
+ }
+ importPath = path
+ }
+ return importPath, false, importPath != ""
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/imports/fix_test.go b/Godeps/_workspace/src/golang.org/x/tools/imports/fix_test.go
new file mode 100644
index 0000000000..6be1d578e1
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/imports/fix_test.go
@@ -0,0 +1,844 @@
+// 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.
+
+package imports
+
+import (
+ "flag"
+ "go/build"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "sync"
+ "testing"
+)
+
+var only = flag.String("only", "", "If non-empty, the fix test to run")
+
+var tests = []struct {
+ name string
+ in, out string
+}{
+ // Adding an import to an existing parenthesized import
+ {
+ name: "factored_imports_add",
+ in: `package foo
+import (
+ "fmt"
+)
+func bar() {
+var b bytes.Buffer
+fmt.Println(b.String())
+}
+`,
+ out: `package foo
+
+import (
+ "bytes"
+ "fmt"
+)
+
+func bar() {
+ var b bytes.Buffer
+ fmt.Println(b.String())
+}
+`,
+ },
+
+ // Adding an import to an existing parenthesized import,
+ // verifying it goes into the first section.
+ {
+ name: "factored_imports_add_first_sec",
+ in: `package foo
+import (
+ "fmt"
+
+ "appengine"
+)
+func bar() {
+var b bytes.Buffer
+_ = appengine.IsDevServer
+fmt.Println(b.String())
+}
+`,
+ out: `package foo
+
+import (
+ "bytes"
+ "fmt"
+
+ "appengine"
+)
+
+func bar() {
+ var b bytes.Buffer
+ _ = appengine.IsDevServer
+ fmt.Println(b.String())
+}
+`,
+ },
+
+ // Adding an import to an existing parenthesized import,
+ // verifying it goes into the first section. (test 2)
+ {
+ name: "factored_imports_add_first_sec_2",
+ in: `package foo
+import (
+ "fmt"
+
+ "appengine"
+)
+func bar() {
+_ = math.NaN
+_ = fmt.Sprintf
+_ = appengine.IsDevServer
+}
+`,
+ out: `package foo
+
+import (
+ "fmt"
+ "math"
+
+ "appengine"
+)
+
+func bar() {
+ _ = math.NaN
+ _ = fmt.Sprintf
+ _ = appengine.IsDevServer
+}
+`,
+ },
+
+ // Adding a new import line, without parens
+ {
+ name: "add_import_section",
+ in: `package foo
+func bar() {
+var b bytes.Buffer
+}
+`,
+ out: `package foo
+
+import "bytes"
+
+func bar() {
+ var b bytes.Buffer
+}
+`,
+ },
+
+ // Adding two new imports, which should make a parenthesized import decl.
+ {
+ name: "add_import_paren_section",
+ in: `package foo
+func bar() {
+_, _ := bytes.Buffer, zip.NewReader
+}
+`,
+ out: `package foo
+
+import (
+ "archive/zip"
+ "bytes"
+)
+
+func bar() {
+ _, _ := bytes.Buffer, zip.NewReader
+}
+`,
+ },
+
+ // Make sure we don't add things twice
+ {
+ name: "no_double_add",
+ in: `package foo
+func bar() {
+_, _ := bytes.Buffer, bytes.NewReader
+}
+`,
+ out: `package foo
+
+import "bytes"
+
+func bar() {
+ _, _ := bytes.Buffer, bytes.NewReader
+}
+`,
+ },
+
+ // Remove unused imports, 1 of a factored block
+ {
+ name: "remove_unused_1_of_2",
+ in: `package foo
+import (
+"bytes"
+"fmt"
+)
+
+func bar() {
+_, _ := bytes.Buffer, bytes.NewReader
+}
+`,
+ out: `package foo
+
+import "bytes"
+
+func bar() {
+ _, _ := bytes.Buffer, bytes.NewReader
+}
+`,
+ },
+
+ // Remove unused imports, 2 of 2
+ {
+ name: "remove_unused_2_of_2",
+ in: `package foo
+import (
+"bytes"
+"fmt"
+)
+
+func bar() {
+}
+`,
+ out: `package foo
+
+func bar() {
+}
+`,
+ },
+
+ // Remove unused imports, 1 of 1
+ {
+ name: "remove_unused_1_of_1",
+ in: `package foo
+
+import "fmt"
+
+func bar() {
+}
+`,
+ out: `package foo
+
+func bar() {
+}
+`,
+ },
+
+ // Don't remove empty imports.
+ {
+ name: "dont_remove_empty_imports",
+ in: `package foo
+import (
+_ "image/png"
+_ "image/jpeg"
+)
+`,
+ out: `package foo
+
+import (
+ _ "image/jpeg"
+ _ "image/png"
+)
+`,
+ },
+
+ // Don't remove dot imports.
+ {
+ name: "dont_remove_dot_imports",
+ in: `package foo
+import (
+. "foo"
+. "bar"
+)
+`,
+ out: `package foo
+
+import (
+ . "bar"
+ . "foo"
+)
+`,
+ },
+
+ // Skip refs the parser can resolve.
+ {
+ name: "skip_resolved_refs",
+ in: `package foo
+
+func f() {
+ type t struct{ Println func(string) }
+ fmt := t{Println: func(string) {}}
+ fmt.Println("foo")
+}
+`,
+ out: `package foo
+
+func f() {
+ type t struct{ Println func(string) }
+ fmt := t{Println: func(string) {}}
+ fmt.Println("foo")
+}
+`,
+ },
+
+ // Do not add a package we already have a resolution for.
+ {
+ name: "skip_template",
+ in: `package foo
+
+import "html/template"
+
+func f() { t = template.New("sometemplate") }
+`,
+ out: `package foo
+
+import "html/template"
+
+func f() { t = template.New("sometemplate") }
+`,
+ },
+
+ // Don't touch cgo
+ {
+ name: "cgo",
+ in: `package foo
+
+/*
+#include
+*/
+import "C"
+`,
+ out: `package foo
+
+/*
+#include
+*/
+import "C"
+`,
+ },
+
+ // Put some things in their own section
+ {
+ name: "make_sections",
+ in: `package foo
+
+import (
+"os"
+)
+
+func foo () {
+_, _ = os.Args, fmt.Println
+_, _ = appengine.FooSomething, user.Current
+}
+`,
+ out: `package foo
+
+import (
+ "fmt"
+ "os"
+
+ "appengine"
+ "appengine/user"
+)
+
+func foo() {
+ _, _ = os.Args, fmt.Println
+ _, _ = appengine.FooSomething, user.Current
+}
+`,
+ },
+
+ // Delete existing empty import block
+ {
+ name: "delete_empty_import_block",
+ in: `package foo
+
+import ()
+`,
+ out: `package foo
+`,
+ },
+
+ // Use existing empty import block
+ {
+ name: "use_empty_import_block",
+ in: `package foo
+
+import ()
+
+func f() {
+ _ = fmt.Println
+}
+`,
+ out: `package foo
+
+import "fmt"
+
+func f() {
+ _ = fmt.Println
+}
+`,
+ },
+
+ // Blank line before adding new section.
+ {
+ name: "blank_line_before_new_group",
+ in: `package foo
+
+import (
+ "fmt"
+ "net"
+)
+
+func f() {
+ _ = net.Dial
+ _ = fmt.Printf
+ _ = snappy.Foo
+}
+`,
+ out: `package foo
+
+import (
+ "fmt"
+ "net"
+
+ "code.google.com/p/snappy-go/snappy"
+)
+
+func f() {
+ _ = net.Dial
+ _ = fmt.Printf
+ _ = snappy.Foo
+}
+`,
+ },
+
+ // Blank line between standard library and third-party stuff.
+ {
+ name: "blank_line_separating_std_and_third_party",
+ in: `package foo
+
+import (
+ "code.google.com/p/snappy-go/snappy"
+ "fmt"
+ "net"
+)
+
+func f() {
+ _ = net.Dial
+ _ = fmt.Printf
+ _ = snappy.Foo
+}
+`,
+ out: `package foo
+
+import (
+ "fmt"
+ "net"
+
+ "code.google.com/p/snappy-go/snappy"
+)
+
+func f() {
+ _ = net.Dial
+ _ = fmt.Printf
+ _ = snappy.Foo
+}
+`,
+ },
+
+ // golang.org/issue/6884
+ {
+ name: "issue 6884",
+ in: `package main
+
+// A comment
+func main() {
+ fmt.Println("Hello, world")
+}
+`,
+ out: `package main
+
+import "fmt"
+
+// A comment
+func main() {
+ fmt.Println("Hello, world")
+}
+`,
+ },
+
+ // golang.org/issue/7132
+ {
+ name: "issue 7132",
+ in: `package main
+
+import (
+"fmt"
+
+"gu"
+"github.com/foo/bar"
+)
+
+var (
+a = bar.a
+b = gu.a
+c = fmt.Printf
+)
+`,
+ out: `package main
+
+import (
+ "fmt"
+
+ "gu"
+
+ "github.com/foo/bar"
+)
+
+var (
+ a = bar.a
+ b = gu.a
+ c = fmt.Printf
+)
+`,
+ },
+
+ {
+ name: "renamed package",
+ in: `package main
+
+var _ = str.HasPrefix
+`,
+ out: `package main
+
+import str "strings"
+
+var _ = str.HasPrefix
+`,
+ },
+
+ {
+ name: "fragment with main",
+ in: `func main(){fmt.Println("Hello, world")}`,
+ out: `package main
+
+import "fmt"
+
+func main() { fmt.Println("Hello, world") }
+`,
+ },
+
+ {
+ name: "fragment without main",
+ in: `func notmain(){fmt.Println("Hello, world")}`,
+ out: `import "fmt"
+
+func notmain() { fmt.Println("Hello, world") }`,
+ },
+
+ // Remove first import within in a 2nd/3rd/4th/etc. section.
+ // golang.org/issue/7679
+ {
+ name: "issue 7679",
+ in: `package main
+
+import (
+ "fmt"
+
+ "github.com/foo/bar"
+ "github.com/foo/qux"
+)
+
+func main() {
+ var _ = fmt.Println
+ //var _ = bar.A
+ var _ = qux.B
+}
+`,
+ out: `package main
+
+import (
+ "fmt"
+
+ "github.com/foo/qux"
+)
+
+func main() {
+ var _ = fmt.Println
+ //var _ = bar.A
+ var _ = qux.B
+}
+`,
+ },
+
+ // Blank line can be added before all types of import declarations.
+ // golang.org/issue/7866
+ {
+ name: "issue 7866",
+ in: `package main
+
+import (
+ "fmt"
+ renamed_bar "github.com/foo/bar"
+
+ . "github.com/foo/baz"
+ "io"
+
+ _ "github.com/foo/qux"
+ "strings"
+)
+
+func main() {
+ _, _, _, _, _ = fmt.Errorf, io.Copy, strings.Contains, renamed_bar.A, B
+}
+`,
+ out: `package main
+
+import (
+ "fmt"
+
+ renamed_bar "github.com/foo/bar"
+
+ "io"
+
+ . "github.com/foo/baz"
+
+ "strings"
+
+ _ "github.com/foo/qux"
+)
+
+func main() {
+ _, _, _, _, _ = fmt.Errorf, io.Copy, strings.Contains, renamed_bar.A, B
+}
+`,
+ },
+
+ // Non-idempotent comment formatting
+ // golang.org/issue/8035
+ {
+ name: "issue 8035",
+ in: `package main
+
+import (
+ "fmt" // A
+ "go/ast" // B
+ _ "launchpad.net/gocheck" // C
+)
+
+func main() { _, _ = fmt.Print, ast.Walk }
+`,
+ out: `package main
+
+import (
+ "fmt" // A
+ "go/ast" // B
+
+ _ "launchpad.net/gocheck" // C
+)
+
+func main() { _, _ = fmt.Print, ast.Walk }
+`,
+ },
+
+ // Failure to delete all duplicate imports
+ // golang.org/issue/8459
+ {
+ name: "issue 8459",
+ in: `package main
+
+import (
+ "fmt"
+ "log"
+ "log"
+ "math"
+)
+
+func main() { fmt.Println("pi:", math.Pi) }
+`,
+ out: `package main
+
+import (
+ "fmt"
+ "math"
+)
+
+func main() { fmt.Println("pi:", math.Pi) }
+`,
+ },
+
+ // Too aggressive prefix matching
+ // golang.org/issue/9961
+ {
+ name: "issue 9961",
+ in: `package p
+
+import (
+ "zip"
+
+ "rsc.io/p"
+)
+
+var (
+ _ = fmt.Print
+ _ = zip.Store
+ _ p.P
+ _ = regexp.Compile
+)
+`,
+ out: `package p
+
+import (
+ "fmt"
+ "regexp"
+ "zip"
+
+ "rsc.io/p"
+)
+
+var (
+ _ = fmt.Print
+ _ = zip.Store
+ _ p.P
+ _ = regexp.Compile
+)
+`,
+ },
+}
+
+func TestFixImports(t *testing.T) {
+ simplePkgs := map[string]string{
+ "appengine": "appengine",
+ "bytes": "bytes",
+ "fmt": "fmt",
+ "math": "math",
+ "os": "os",
+ "p": "rsc.io/p",
+ "regexp": "regexp",
+ "snappy": "code.google.com/p/snappy-go/snappy",
+ "str": "strings",
+ "user": "appengine/user",
+ "zip": "archive/zip",
+ }
+ findImport = func(pkgName string, symbols map[string]bool) (string, bool, error) {
+ return simplePkgs[pkgName], pkgName == "str", nil
+ }
+
+ options := &Options{
+ TabWidth: 8,
+ TabIndent: true,
+ Comments: true,
+ Fragment: true,
+ }
+
+ for _, tt := range tests {
+ if *only != "" && tt.name != *only {
+ continue
+ }
+ buf, err := Process(tt.name+".go", []byte(tt.in), options)
+ if err != nil {
+ t.Errorf("error on %q: %v", tt.name, err)
+ continue
+ }
+ if got := string(buf); got != tt.out {
+ t.Errorf("results diff on %q\nGOT:\n%s\nWANT:\n%s\n", tt.name, got, tt.out)
+ }
+ }
+}
+
+func TestFindImportGoPath(t *testing.T) {
+ goroot, err := ioutil.TempDir("", "goimports-")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer os.RemoveAll(goroot)
+
+ pkgIndexOnce = sync.Once{}
+
+ origStdlib := stdlib
+ defer func() {
+ stdlib = origStdlib
+ }()
+ stdlib = nil
+
+ // Test against imaginary bits/bytes package in std lib
+ bytesDir := filepath.Join(goroot, "src", "pkg", "bits", "bytes")
+ for _, tag := range build.Default.ReleaseTags {
+ // Go 1.4 rearranged the GOROOT tree to remove the "pkg" path component.
+ if tag == "go1.4" {
+ bytesDir = filepath.Join(goroot, "src", "bits", "bytes")
+ }
+ }
+ if err := os.MkdirAll(bytesDir, 0755); err != nil {
+ t.Fatal(err)
+ }
+ bytesSrcPath := filepath.Join(bytesDir, "bytes.go")
+ bytesPkgPath := "bits/bytes"
+ bytesSrc := []byte(`package bytes
+
+type Buffer2 struct {}
+`)
+ if err := ioutil.WriteFile(bytesSrcPath, bytesSrc, 0775); err != nil {
+ t.Fatal(err)
+ }
+ oldGOROOT := build.Default.GOROOT
+ oldGOPATH := build.Default.GOPATH
+ build.Default.GOROOT = goroot
+ build.Default.GOPATH = ""
+ defer func() {
+ build.Default.GOROOT = oldGOROOT
+ build.Default.GOPATH = oldGOPATH
+ }()
+
+ got, rename, err := findImportGoPath("bytes", map[string]bool{"Buffer2": true})
+ if err != nil {
+ t.Fatal(err)
+ }
+ if got != bytesPkgPath || rename {
+ t.Errorf(`findImportGoPath("bytes", Buffer2 ...)=%q, %t, want "%s", false`, got, rename, bytesPkgPath)
+ }
+
+ got, rename, err = findImportGoPath("bytes", map[string]bool{"Missing": true})
+ if err != nil {
+ t.Fatal(err)
+ }
+ if got != "" || rename {
+ t.Errorf(`findImportGoPath("bytes", Missing ...)=%q, %t, want "", false`, got, rename)
+ }
+}
+
+func TestFindImportStdlib(t *testing.T) {
+ tests := []struct {
+ pkg string
+ symbols []string
+ want string
+ }{
+ {"http", []string{"Get"}, "net/http"},
+ {"http", []string{"Get", "Post"}, "net/http"},
+ {"http", []string{"Get", "Foo"}, ""},
+ {"bytes", []string{"Buffer"}, "bytes"},
+ {"ioutil", []string{"Discard"}, "io/ioutil"},
+ }
+ for _, tt := range tests {
+ got, rename, ok := findImportStdlib(tt.pkg, strSet(tt.symbols))
+ if (got != "") != ok {
+ t.Error("findImportStdlib return value inconsistent")
+ }
+ if got != tt.want || rename {
+ t.Errorf("findImportStdlib(%q, %q) = %q, %t; want %q, false", tt.pkg, tt.symbols, got, rename, tt.want)
+ }
+ }
+}
+
+func strSet(ss []string) map[string]bool {
+ m := make(map[string]bool)
+ for _, s := range ss {
+ m[s] = true
+ }
+ return m
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/imports/imports.go b/Godeps/_workspace/src/golang.org/x/tools/imports/imports.go
new file mode 100644
index 0000000000..3c83d1d4cc
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/imports/imports.go
@@ -0,0 +1,279 @@
+// 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.
+
+// Package imports implements a Go pretty-printer (like package "go/format")
+// that also adds or removes import statements as necessary.
+package imports
+
+import (
+ "bufio"
+ "bytes"
+ "fmt"
+ "go/ast"
+ "go/format"
+ "go/parser"
+ "go/printer"
+ "go/token"
+ "io"
+ "regexp"
+ "strconv"
+ "strings"
+
+ "golang.org/x/tools/go/ast/astutil"
+)
+
+// Options specifies options for processing files.
+type Options struct {
+ Fragment bool // Accept fragment of a source file (no package statement)
+ AllErrors bool // Report all errors (not just the first 10 on different lines)
+
+ Comments bool // Print comments (true if nil *Options provided)
+ TabIndent bool // Use tabs for indent (true if nil *Options provided)
+ TabWidth int // Tab width (8 if nil *Options provided)
+}
+
+// Process formats and adjusts imports for the provided file.
+// If opt is nil the defaults are used.
+func Process(filename string, src []byte, opt *Options) ([]byte, error) {
+ if opt == nil {
+ opt = &Options{Comments: true, TabIndent: true, TabWidth: 8}
+ }
+
+ fileSet := token.NewFileSet()
+ file, adjust, err := parse(fileSet, filename, src, opt)
+ if err != nil {
+ return nil, err
+ }
+
+ _, err = fixImports(fileSet, file)
+ if err != nil {
+ return nil, err
+ }
+
+ sortImports(fileSet, file)
+ imps := astutil.Imports(fileSet, file)
+
+ var spacesBefore []string // import paths we need spaces before
+ for _, impSection := range imps {
+ // Within each block of contiguous imports, see if any
+ // import lines are in different group numbers. If so,
+ // we'll need to put a space between them so it's
+ // compatible with gofmt.
+ lastGroup := -1
+ for _, importSpec := range impSection {
+ importPath, _ := strconv.Unquote(importSpec.Path.Value)
+ groupNum := importGroup(importPath)
+ if groupNum != lastGroup && lastGroup != -1 {
+ spacesBefore = append(spacesBefore, importPath)
+ }
+ lastGroup = groupNum
+ }
+
+ }
+
+ printerMode := printer.UseSpaces
+ if opt.TabIndent {
+ printerMode |= printer.TabIndent
+ }
+ printConfig := &printer.Config{Mode: printerMode, Tabwidth: opt.TabWidth}
+
+ var buf bytes.Buffer
+ err = printConfig.Fprint(&buf, fileSet, file)
+ if err != nil {
+ return nil, err
+ }
+ out := buf.Bytes()
+ if adjust != nil {
+ out = adjust(src, out)
+ }
+ if len(spacesBefore) > 0 {
+ out = addImportSpaces(bytes.NewReader(out), spacesBefore)
+ }
+
+ out, err = format.Source(out)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// parse parses src, which was read from filename,
+// as a Go source file or statement list.
+func parse(fset *token.FileSet, filename string, src []byte, opt *Options) (*ast.File, func(orig, src []byte) []byte, error) {
+ parserMode := parser.Mode(0)
+ if opt.Comments {
+ parserMode |= parser.ParseComments
+ }
+ if opt.AllErrors {
+ parserMode |= parser.AllErrors
+ }
+
+ // Try as whole source file.
+ file, err := parser.ParseFile(fset, filename, src, parserMode)
+ if err == nil {
+ return file, nil, nil
+ }
+ // If the error is that the source file didn't begin with a
+ // package line and we accept fragmented input, fall through to
+ // try as a source fragment. Stop and return on any other error.
+ if !opt.Fragment || !strings.Contains(err.Error(), "expected 'package'") {
+ return nil, nil, err
+ }
+
+ // If this is a declaration list, make it a source file
+ // by inserting a package clause.
+ // Insert using a ;, not a newline, so that the line numbers
+ // in psrc match the ones in src.
+ psrc := append([]byte("package main;"), src...)
+ file, err = parser.ParseFile(fset, filename, psrc, parserMode)
+ if err == nil {
+ // If a main function exists, we will assume this is a main
+ // package and leave the file.
+ if containsMainFunc(file) {
+ return file, nil, nil
+ }
+
+ adjust := func(orig, src []byte) []byte {
+ // Remove the package clause.
+ // Gofmt has turned the ; into a \n.
+ src = src[len("package main\n"):]
+ return matchSpace(orig, src)
+ }
+ return file, adjust, nil
+ }
+ // If the error is that the source file didn't begin with a
+ // declaration, fall through to try as a statement list.
+ // Stop and return on any other error.
+ if !strings.Contains(err.Error(), "expected declaration") {
+ return nil, nil, err
+ }
+
+ // If this is a statement list, make it a source file
+ // by inserting a package clause and turning the list
+ // into a function body. This handles expressions too.
+ // Insert using a ;, not a newline, so that the line numbers
+ // in fsrc match the ones in src.
+ fsrc := append(append([]byte("package p; func _() {"), src...), '}')
+ file, err = parser.ParseFile(fset, filename, fsrc, parserMode)
+ if err == nil {
+ adjust := func(orig, src []byte) []byte {
+ // Remove the wrapping.
+ // Gofmt has turned the ; into a \n\n.
+ src = src[len("package p\n\nfunc _() {"):]
+ src = src[:len(src)-len("}\n")]
+ // Gofmt has also indented the function body one level.
+ // Remove that indent.
+ src = bytes.Replace(src, []byte("\n\t"), []byte("\n"), -1)
+ return matchSpace(orig, src)
+ }
+ return file, adjust, nil
+ }
+
+ // Failed, and out of options.
+ return nil, nil, err
+}
+
+// containsMainFunc checks if a file contains a function declaration with the
+// function signature 'func main()'
+func containsMainFunc(file *ast.File) bool {
+ for _, decl := range file.Decls {
+ if f, ok := decl.(*ast.FuncDecl); ok {
+ if f.Name.Name != "main" {
+ continue
+ }
+
+ if len(f.Type.Params.List) != 0 {
+ continue
+ }
+
+ if f.Type.Results != nil && len(f.Type.Results.List) != 0 {
+ continue
+ }
+
+ return true
+ }
+ }
+
+ return false
+}
+
+func cutSpace(b []byte) (before, middle, after []byte) {
+ i := 0
+ for i < len(b) && (b[i] == ' ' || b[i] == '\t' || b[i] == '\n') {
+ i++
+ }
+ j := len(b)
+ for j > 0 && (b[j-1] == ' ' || b[j-1] == '\t' || b[j-1] == '\n') {
+ j--
+ }
+ if i <= j {
+ return b[:i], b[i:j], b[j:]
+ }
+ return nil, nil, b[j:]
+}
+
+// matchSpace reformats src to use the same space context as orig.
+// 1) If orig begins with blank lines, matchSpace inserts them at the beginning of src.
+// 2) matchSpace copies the indentation of the first non-blank line in orig
+// to every non-blank line in src.
+// 3) matchSpace copies the trailing space from orig and uses it in place
+// of src's trailing space.
+func matchSpace(orig []byte, src []byte) []byte {
+ before, _, after := cutSpace(orig)
+ i := bytes.LastIndex(before, []byte{'\n'})
+ before, indent := before[:i+1], before[i+1:]
+
+ _, src, _ = cutSpace(src)
+
+ var b bytes.Buffer
+ b.Write(before)
+ for len(src) > 0 {
+ line := src
+ if i := bytes.IndexByte(line, '\n'); i >= 0 {
+ line, src = line[:i+1], line[i+1:]
+ } else {
+ src = nil
+ }
+ if len(line) > 0 && line[0] != '\n' { // not blank
+ b.Write(indent)
+ }
+ b.Write(line)
+ }
+ b.Write(after)
+ return b.Bytes()
+}
+
+var impLine = regexp.MustCompile(`^\s+(?:[\w\.]+\s+)?"(.+)"`)
+
+func addImportSpaces(r io.Reader, breaks []string) []byte {
+ var out bytes.Buffer
+ sc := bufio.NewScanner(r)
+ inImports := false
+ done := false
+ for sc.Scan() {
+ s := sc.Text()
+
+ if !inImports && !done && strings.HasPrefix(s, "import") {
+ inImports = true
+ }
+ if inImports && (strings.HasPrefix(s, "var") ||
+ strings.HasPrefix(s, "func") ||
+ strings.HasPrefix(s, "const") ||
+ strings.HasPrefix(s, "type")) {
+ done = true
+ inImports = false
+ }
+ if inImports && len(breaks) > 0 {
+ if m := impLine.FindStringSubmatch(s); m != nil {
+ if m[1] == string(breaks[0]) {
+ out.WriteByte('\n')
+ breaks = breaks[1:]
+ }
+ }
+ }
+
+ fmt.Fprintln(&out, s)
+ }
+ return out.Bytes()
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/imports/mkindex.go b/Godeps/_workspace/src/golang.org/x/tools/imports/mkindex.go
new file mode 100644
index 0000000000..755e2394f2
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/imports/mkindex.go
@@ -0,0 +1,173 @@
+// +build ignore
+
+// 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.
+
+// Command mkindex creates the file "pkgindex.go" containing an index of the Go
+// standard library. The file is intended to be built as part of the imports
+// package, so that the package may be used in environments where a GOROOT is
+// not available (such as App Engine).
+package main
+
+import (
+ "bytes"
+ "fmt"
+ "go/ast"
+ "go/build"
+ "go/format"
+ "go/parser"
+ "go/token"
+ "io/ioutil"
+ "log"
+ "os"
+ "path"
+ "path/filepath"
+ "strings"
+)
+
+var (
+ pkgIndex = make(map[string][]pkg)
+ exports = make(map[string]map[string]bool)
+)
+
+func main() {
+ // Don't use GOPATH.
+ ctx := build.Default
+ ctx.GOPATH = ""
+
+ // Populate pkgIndex global from GOROOT.
+ for _, path := range ctx.SrcDirs() {
+ f, err := os.Open(path)
+ if err != nil {
+ log.Print(err)
+ continue
+ }
+ children, err := f.Readdir(-1)
+ f.Close()
+ if err != nil {
+ log.Print(err)
+ continue
+ }
+ for _, child := range children {
+ if child.IsDir() {
+ loadPkg(path, child.Name())
+ }
+ }
+ }
+ // Populate exports global.
+ for _, ps := range pkgIndex {
+ for _, p := range ps {
+ e := loadExports(p.dir)
+ if e != nil {
+ exports[p.dir] = e
+ }
+ }
+ }
+
+ // Construct source file.
+ var buf bytes.Buffer
+ fmt.Fprint(&buf, pkgIndexHead)
+ fmt.Fprintf(&buf, "var pkgIndexMaster = %#v\n", pkgIndex)
+ fmt.Fprintf(&buf, "var exportsMaster = %#v\n", exports)
+ src := buf.Bytes()
+
+ // Replace main.pkg type name with pkg.
+ src = bytes.Replace(src, []byte("main.pkg"), []byte("pkg"), -1)
+ // Replace actual GOROOT with "/go".
+ src = bytes.Replace(src, []byte(ctx.GOROOT), []byte("/go"), -1)
+ // Add some line wrapping.
+ src = bytes.Replace(src, []byte("}, "), []byte("},\n"), -1)
+ src = bytes.Replace(src, []byte("true, "), []byte("true,\n"), -1)
+
+ var err error
+ src, err = format.Source(src)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ // Write out source file.
+ err = ioutil.WriteFile("pkgindex.go", src, 0644)
+ if err != nil {
+ log.Fatal(err)
+ }
+}
+
+const pkgIndexHead = `package imports
+
+func init() {
+ pkgIndexOnce.Do(func() {
+ pkgIndex.m = pkgIndexMaster
+ })
+ loadExports = func(dir string) map[string]bool {
+ return exportsMaster[dir]
+ }
+}
+`
+
+type pkg struct {
+ importpath string // full pkg import path, e.g. "net/http"
+ dir string // absolute file path to pkg directory e.g. "/usr/lib/go/src/fmt"
+}
+
+var fset = token.NewFileSet()
+
+func loadPkg(root, importpath string) {
+ shortName := path.Base(importpath)
+ if shortName == "testdata" {
+ return
+ }
+
+ dir := filepath.Join(root, importpath)
+ pkgIndex[shortName] = append(pkgIndex[shortName], pkg{
+ importpath: importpath,
+ dir: dir,
+ })
+
+ pkgDir, err := os.Open(dir)
+ if err != nil {
+ return
+ }
+ children, err := pkgDir.Readdir(-1)
+ pkgDir.Close()
+ if err != nil {
+ return
+ }
+ for _, child := range children {
+ name := child.Name()
+ if name == "" {
+ continue
+ }
+ if c := name[0]; c == '.' || ('0' <= c && c <= '9') {
+ continue
+ }
+ if child.IsDir() {
+ loadPkg(root, filepath.Join(importpath, name))
+ }
+ }
+}
+
+func loadExports(dir string) map[string]bool {
+ exports := make(map[string]bool)
+ buildPkg, err := build.ImportDir(dir, 0)
+ if err != nil {
+ if strings.Contains(err.Error(), "no buildable Go source files in") {
+ return nil
+ }
+ log.Printf("could not import %q: %v", dir, err)
+ return nil
+ }
+ for _, file := range buildPkg.GoFiles {
+ f, err := parser.ParseFile(fset, filepath.Join(dir, file), nil, 0)
+ if err != nil {
+ log.Printf("could not parse %q: %v", file, err)
+ continue
+ }
+ for name := range f.Scope.Objects {
+ if ast.IsExported(name) {
+ exports[name] = true
+ }
+ }
+ }
+ return exports
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/imports/mkstdlib.go b/Godeps/_workspace/src/golang.org/x/tools/imports/mkstdlib.go
new file mode 100644
index 0000000000..c43d3255a3
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/imports/mkstdlib.go
@@ -0,0 +1,90 @@
+// +build ignore
+
+// mkstdlib generates the zstdlib.go file, containing the Go standard
+// library API symbols. It's baked into the binary to avoid scanning
+// GOPATH in the common case.
+package main
+
+import (
+ "bufio"
+ "bytes"
+ "fmt"
+ "go/format"
+ "io"
+ "log"
+ "os"
+ "path"
+ "path/filepath"
+ "regexp"
+ "sort"
+ "strings"
+)
+
+func mustOpen(name string) io.Reader {
+ f, err := os.Open(name)
+ if err != nil {
+ log.Fatal(err)
+ }
+ return f
+}
+
+func api(base string) string {
+ return filepath.Join(os.Getenv("GOROOT"), "api", base)
+}
+
+var sym = regexp.MustCompile(`^pkg (\S+).*?, (?:var|func|type|const) ([A-Z]\w*)`)
+
+func main() {
+ var buf bytes.Buffer
+ outf := func(format string, args ...interface{}) {
+ fmt.Fprintf(&buf, format, args...)
+ }
+ outf("// AUTO-GENERATED BY mkstdlib.go\n\n")
+ outf("package imports\n")
+ outf("var stdlib = map[string]string{\n")
+ f := io.MultiReader(
+ mustOpen(api("go1.txt")),
+ mustOpen(api("go1.1.txt")),
+ mustOpen(api("go1.2.txt")),
+ )
+ sc := bufio.NewScanner(f)
+ fullImport := map[string]string{} // "zip.NewReader" => "archive/zip"
+ ambiguous := map[string]bool{}
+ var keys []string
+ for sc.Scan() {
+ l := sc.Text()
+ has := func(v string) bool { return strings.Contains(l, v) }
+ if has("struct, ") || has("interface, ") || has(", method (") {
+ continue
+ }
+ if m := sym.FindStringSubmatch(l); m != nil {
+ full := m[1]
+ key := path.Base(full) + "." + m[2]
+ if exist, ok := fullImport[key]; ok {
+ if exist != full {
+ ambiguous[key] = true
+ }
+ } else {
+ fullImport[key] = full
+ keys = append(keys, key)
+ }
+ }
+ }
+ if err := sc.Err(); err != nil {
+ log.Fatal(err)
+ }
+ sort.Strings(keys)
+ for _, key := range keys {
+ if ambiguous[key] {
+ outf("\t// %q is ambiguous\n", key)
+ } else {
+ outf("\t%q: %q,\n", key, fullImport[key])
+ }
+ }
+ outf("}\n")
+ fmtbuf, err := format.Source(buf.Bytes())
+ if err != nil {
+ log.Fatal(err)
+ }
+ os.Stdout.Write(fmtbuf)
+}
diff --git a/Godeps/_workspace/src/golang.org/x/tools/imports/sortimports.go b/Godeps/_workspace/src/golang.org/x/tools/imports/sortimports.go
new file mode 100644
index 0000000000..68b3dc4eca
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/imports/sortimports.go
@@ -0,0 +1,214 @@
+// +build go1.2
+
+// 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.
+
+// Hacked up copy of go/ast/import.go
+
+package imports
+
+import (
+ "go/ast"
+ "go/token"
+ "sort"
+ "strconv"
+)
+
+// sortImports sorts runs of consecutive import lines in import blocks in f.
+// It also removes duplicate imports when it is possible to do so without data loss.
+func sortImports(fset *token.FileSet, f *ast.File) {
+ for i, d := range f.Decls {
+ d, ok := d.(*ast.GenDecl)
+ if !ok || d.Tok != token.IMPORT {
+ // Not an import declaration, so we're done.
+ // Imports are always first.
+ break
+ }
+
+ if len(d.Specs) == 0 {
+ // Empty import block, remove it.
+ f.Decls = append(f.Decls[:i], f.Decls[i+1:]...)
+ }
+
+ if !d.Lparen.IsValid() {
+ // Not a block: sorted by default.
+ continue
+ }
+
+ // Identify and sort runs of specs on successive lines.
+ i := 0
+ specs := d.Specs[:0]
+ for j, s := range d.Specs {
+ if j > i && fset.Position(s.Pos()).Line > 1+fset.Position(d.Specs[j-1].End()).Line {
+ // j begins a new run. End this one.
+ specs = append(specs, sortSpecs(fset, f, d.Specs[i:j])...)
+ i = j
+ }
+ }
+ specs = append(specs, sortSpecs(fset, f, d.Specs[i:])...)
+ d.Specs = specs
+
+ // Deduping can leave a blank line before the rparen; clean that up.
+ if len(d.Specs) > 0 {
+ lastSpec := d.Specs[len(d.Specs)-1]
+ lastLine := fset.Position(lastSpec.Pos()).Line
+ if rParenLine := fset.Position(d.Rparen).Line; rParenLine > lastLine+1 {
+ fset.File(d.Rparen).MergeLine(rParenLine - 1)
+ }
+ }
+ }
+}
+
+func importPath(s ast.Spec) string {
+ t, err := strconv.Unquote(s.(*ast.ImportSpec).Path.Value)
+ if err == nil {
+ return t
+ }
+ return ""
+}
+
+func importName(s ast.Spec) string {
+ n := s.(*ast.ImportSpec).Name
+ if n == nil {
+ return ""
+ }
+ return n.Name
+}
+
+func importComment(s ast.Spec) string {
+ c := s.(*ast.ImportSpec).Comment
+ if c == nil {
+ return ""
+ }
+ return c.Text()
+}
+
+// collapse indicates whether prev may be removed, leaving only next.
+func collapse(prev, next ast.Spec) bool {
+ if importPath(next) != importPath(prev) || importName(next) != importName(prev) {
+ return false
+ }
+ return prev.(*ast.ImportSpec).Comment == nil
+}
+
+type posSpan struct {
+ Start token.Pos
+ End token.Pos
+}
+
+func sortSpecs(fset *token.FileSet, f *ast.File, specs []ast.Spec) []ast.Spec {
+ // Can't short-circuit here even if specs are already sorted,
+ // since they might yet need deduplication.
+ // A lone import, however, may be safely ignored.
+ if len(specs) <= 1 {
+ return specs
+ }
+
+ // Record positions for specs.
+ pos := make([]posSpan, len(specs))
+ for i, s := range specs {
+ pos[i] = posSpan{s.Pos(), s.End()}
+ }
+
+ // Identify comments in this range.
+ // Any comment from pos[0].Start to the final line counts.
+ lastLine := fset.Position(pos[len(pos)-1].End).Line
+ cstart := len(f.Comments)
+ cend := len(f.Comments)
+ for i, g := range f.Comments {
+ if g.Pos() < pos[0].Start {
+ continue
+ }
+ if i < cstart {
+ cstart = i
+ }
+ if fset.Position(g.End()).Line > lastLine {
+ cend = i
+ break
+ }
+ }
+ comments := f.Comments[cstart:cend]
+
+ // Assign each comment to the import spec preceding it.
+ importComment := map[*ast.ImportSpec][]*ast.CommentGroup{}
+ specIndex := 0
+ for _, g := range comments {
+ for specIndex+1 < len(specs) && pos[specIndex+1].Start <= g.Pos() {
+ specIndex++
+ }
+ s := specs[specIndex].(*ast.ImportSpec)
+ importComment[s] = append(importComment[s], g)
+ }
+
+ // Sort the import specs by import path.
+ // Remove duplicates, when possible without data loss.
+ // Reassign the import paths to have the same position sequence.
+ // Reassign each comment to abut the end of its spec.
+ // Sort the comments by new position.
+ sort.Sort(byImportSpec(specs))
+
+ // Dedup. Thanks to our sorting, we can just consider
+ // adjacent pairs of imports.
+ deduped := specs[:0]
+ for i, s := range specs {
+ if i == len(specs)-1 || !collapse(s, specs[i+1]) {
+ deduped = append(deduped, s)
+ } else {
+ p := s.Pos()
+ fset.File(p).MergeLine(fset.Position(p).Line)
+ }
+ }
+ specs = deduped
+
+ // Fix up comment positions
+ for i, s := range specs {
+ s := s.(*ast.ImportSpec)
+ if s.Name != nil {
+ s.Name.NamePos = pos[i].Start
+ }
+ s.Path.ValuePos = pos[i].Start
+ s.EndPos = pos[i].End
+ for _, g := range importComment[s] {
+ for _, c := range g.List {
+ c.Slash = pos[i].End
+ }
+ }
+ }
+
+ sort.Sort(byCommentPos(comments))
+
+ return specs
+}
+
+type byImportSpec []ast.Spec // slice of *ast.ImportSpec
+
+func (x byImportSpec) Len() int { return len(x) }
+func (x byImportSpec) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
+func (x byImportSpec) Less(i, j int) bool {
+ ipath := importPath(x[i])
+ jpath := importPath(x[j])
+
+ igroup := importGroup(ipath)
+ jgroup := importGroup(jpath)
+ if igroup != jgroup {
+ return igroup < jgroup
+ }
+
+ if ipath != jpath {
+ return ipath < jpath
+ }
+ iname := importName(x[i])
+ jname := importName(x[j])
+
+ if iname != jname {
+ return iname < jname
+ }
+ return importComment(x[i]) < importComment(x[j])
+}
+
+type byCommentPos []*ast.CommentGroup
+
+func (x byCommentPos) Len() int { return len(x) }
+func (x byCommentPos) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
+func (x byCommentPos) Less(i, j int) bool { return x[i].Pos() < x[j].Pos() }
diff --git a/Godeps/_workspace/src/golang.org/x/tools/imports/sortimports_compat.go b/Godeps/_workspace/src/golang.org/x/tools/imports/sortimports_compat.go
new file mode 100644
index 0000000000..295f237a79
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/imports/sortimports_compat.go
@@ -0,0 +1,14 @@
+// +build !go1.2
+
+// 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.
+
+package imports
+
+import "go/ast"
+
+// Go 1.1 users don't get fancy package grouping.
+// But this is still gofmt-compliant:
+
+var sortImports = ast.SortImports
diff --git a/Godeps/_workspace/src/golang.org/x/tools/imports/zstdlib.go b/Godeps/_workspace/src/golang.org/x/tools/imports/zstdlib.go
new file mode 100644
index 0000000000..6cdc03347f
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/tools/imports/zstdlib.go
@@ -0,0 +1,8374 @@
+// AUTO-GENERATED BY mkstdlib.go
+
+package imports
+
+var stdlib = map[string]string{
+ "adler32.Checksum": "hash/adler32",
+ "adler32.New": "hash/adler32",
+ "adler32.Size": "hash/adler32",
+ "aes.BlockSize": "crypto/aes",
+ "aes.KeySizeError": "crypto/aes",
+ "aes.NewCipher": "crypto/aes",
+ "ascii85.CorruptInputError": "encoding/ascii85",
+ "ascii85.Decode": "encoding/ascii85",
+ "ascii85.Encode": "encoding/ascii85",
+ "ascii85.MaxEncodedLen": "encoding/ascii85",
+ "ascii85.NewDecoder": "encoding/ascii85",
+ "ascii85.NewEncoder": "encoding/ascii85",
+ "asn1.BitString": "encoding/asn1",
+ "asn1.Enumerated": "encoding/asn1",
+ "asn1.Flag": "encoding/asn1",
+ "asn1.Marshal": "encoding/asn1",
+ "asn1.ObjectIdentifier": "encoding/asn1",
+ "asn1.RawContent": "encoding/asn1",
+ "asn1.RawValue": "encoding/asn1",
+ "asn1.StructuralError": "encoding/asn1",
+ "asn1.SyntaxError": "encoding/asn1",
+ "asn1.Unmarshal": "encoding/asn1",
+ "asn1.UnmarshalWithParams": "encoding/asn1",
+ "ast.ArrayType": "go/ast",
+ "ast.AssignStmt": "go/ast",
+ "ast.Bad": "go/ast",
+ "ast.BadDecl": "go/ast",
+ "ast.BadExpr": "go/ast",
+ "ast.BadStmt": "go/ast",
+ "ast.BasicLit": "go/ast",
+ "ast.BinaryExpr": "go/ast",
+ "ast.BlockStmt": "go/ast",
+ "ast.BranchStmt": "go/ast",
+ "ast.CallExpr": "go/ast",
+ "ast.CaseClause": "go/ast",
+ "ast.ChanDir": "go/ast",
+ "ast.ChanType": "go/ast",
+ "ast.CommClause": "go/ast",
+ "ast.Comment": "go/ast",
+ "ast.CommentGroup": "go/ast",
+ "ast.CommentMap": "go/ast",
+ "ast.CompositeLit": "go/ast",
+ "ast.Con": "go/ast",
+ "ast.DeclStmt": "go/ast",
+ "ast.DeferStmt": "go/ast",
+ "ast.Ellipsis": "go/ast",
+ "ast.EmptyStmt": "go/ast",
+ "ast.ExprStmt": "go/ast",
+ "ast.Field": "go/ast",
+ "ast.FieldFilter": "go/ast",
+ "ast.FieldList": "go/ast",
+ "ast.File": "go/ast",
+ "ast.FileExports": "go/ast",
+ "ast.Filter": "go/ast",
+ "ast.FilterDecl": "go/ast",
+ "ast.FilterFile": "go/ast",
+ "ast.FilterFuncDuplicates": "go/ast",
+ "ast.FilterImportDuplicates": "go/ast",
+ "ast.FilterPackage": "go/ast",
+ "ast.FilterUnassociatedComments": "go/ast",
+ "ast.ForStmt": "go/ast",
+ "ast.Fprint": "go/ast",
+ "ast.Fun": "go/ast",
+ "ast.FuncDecl": "go/ast",
+ "ast.FuncLit": "go/ast",
+ "ast.FuncType": "go/ast",
+ "ast.GenDecl": "go/ast",
+ "ast.GoStmt": "go/ast",
+ "ast.Ident": "go/ast",
+ "ast.IfStmt": "go/ast",
+ "ast.ImportSpec": "go/ast",
+ "ast.Importer": "go/ast",
+ "ast.IncDecStmt": "go/ast",
+ "ast.IndexExpr": "go/ast",
+ "ast.Inspect": "go/ast",
+ "ast.InterfaceType": "go/ast",
+ "ast.IsExported": "go/ast",
+ "ast.KeyValueExpr": "go/ast",
+ "ast.LabeledStmt": "go/ast",
+ "ast.Lbl": "go/ast",
+ "ast.MapType": "go/ast",
+ "ast.MergeMode": "go/ast",
+ "ast.MergePackageFiles": "go/ast",
+ "ast.NewCommentMap": "go/ast",
+ "ast.NewIdent": "go/ast",
+ "ast.NewObj": "go/ast",
+ "ast.NewPackage": "go/ast",
+ "ast.NewScope": "go/ast",
+ "ast.Node": "go/ast",
+ "ast.NotNilFilter": "go/ast",
+ "ast.ObjKind": "go/ast",
+ "ast.Object": "go/ast",
+ "ast.Package": "go/ast",
+ "ast.PackageExports": "go/ast",
+ "ast.ParenExpr": "go/ast",
+ "ast.Pkg": "go/ast",
+ "ast.Print": "go/ast",
+ "ast.RECV": "go/ast",
+ "ast.RangeStmt": "go/ast",
+ "ast.ReturnStmt": "go/ast",
+ "ast.SEND": "go/ast",
+ "ast.Scope": "go/ast",
+ "ast.SelectStmt": "go/ast",
+ "ast.SelectorExpr": "go/ast",
+ "ast.SendStmt": "go/ast",
+ "ast.SliceExpr": "go/ast",
+ "ast.SortImports": "go/ast",
+ "ast.StarExpr": "go/ast",
+ "ast.StructType": "go/ast",
+ "ast.SwitchStmt": "go/ast",
+ "ast.Typ": "go/ast",
+ "ast.TypeAssertExpr": "go/ast",
+ "ast.TypeSpec": "go/ast",
+ "ast.TypeSwitchStmt": "go/ast",
+ "ast.UnaryExpr": "go/ast",
+ "ast.ValueSpec": "go/ast",
+ "ast.Var": "go/ast",
+ "ast.Visitor": "go/ast",
+ "ast.Walk": "go/ast",
+ "atomic.AddInt32": "sync/atomic",
+ "atomic.AddInt64": "sync/atomic",
+ "atomic.AddUint32": "sync/atomic",
+ "atomic.AddUint64": "sync/atomic",
+ "atomic.AddUintptr": "sync/atomic",
+ "atomic.CompareAndSwapInt32": "sync/atomic",
+ "atomic.CompareAndSwapInt64": "sync/atomic",
+ "atomic.CompareAndSwapPointer": "sync/atomic",
+ "atomic.CompareAndSwapUint32": "sync/atomic",
+ "atomic.CompareAndSwapUint64": "sync/atomic",
+ "atomic.CompareAndSwapUintptr": "sync/atomic",
+ "atomic.LoadInt32": "sync/atomic",
+ "atomic.LoadInt64": "sync/atomic",
+ "atomic.LoadPointer": "sync/atomic",
+ "atomic.LoadUint32": "sync/atomic",
+ "atomic.LoadUint64": "sync/atomic",
+ "atomic.LoadUintptr": "sync/atomic",
+ "atomic.StoreInt32": "sync/atomic",
+ "atomic.StoreInt64": "sync/atomic",
+ "atomic.StorePointer": "sync/atomic",
+ "atomic.StoreUint32": "sync/atomic",
+ "atomic.StoreUint64": "sync/atomic",
+ "atomic.StoreUintptr": "sync/atomic",
+ "atomic.SwapInt32": "sync/atomic",
+ "atomic.SwapInt64": "sync/atomic",
+ "atomic.SwapPointer": "sync/atomic",
+ "atomic.SwapUint32": "sync/atomic",
+ "atomic.SwapUint64": "sync/atomic",
+ "atomic.SwapUintptr": "sync/atomic",
+ "base32.CorruptInputError": "encoding/base32",
+ "base32.Encoding": "encoding/base32",
+ "base32.HexEncoding": "encoding/base32",
+ "base32.NewDecoder": "encoding/base32",
+ "base32.NewEncoder": "encoding/base32",
+ "base32.NewEncoding": "encoding/base32",
+ "base32.StdEncoding": "encoding/base32",
+ "base64.CorruptInputError": "encoding/base64",
+ "base64.Encoding": "encoding/base64",
+ "base64.NewDecoder": "encoding/base64",
+ "base64.NewEncoder": "encoding/base64",
+ "base64.NewEncoding": "encoding/base64",
+ "base64.StdEncoding": "encoding/base64",
+ "base64.URLEncoding": "encoding/base64",
+ "big.Int": "math/big",
+ "big.MaxBase": "math/big",
+ "big.NewInt": "math/big",
+ "big.NewRat": "math/big",
+ "big.Rat": "math/big",
+ "big.Word": "math/big",
+ "binary.BigEndian": "encoding/binary",
+ "binary.ByteOrder": "encoding/binary",
+ "binary.LittleEndian": "encoding/binary",
+ "binary.MaxVarintLen16": "encoding/binary",
+ "binary.MaxVarintLen32": "encoding/binary",
+ "binary.MaxVarintLen64": "encoding/binary",
+ "binary.PutUvarint": "encoding/binary",
+ "binary.PutVarint": "encoding/binary",
+ "binary.Read": "encoding/binary",
+ "binary.ReadUvarint": "encoding/binary",
+ "binary.ReadVarint": "encoding/binary",
+ "binary.Size": "encoding/binary",
+ "binary.Uvarint": "encoding/binary",
+ "binary.Varint": "encoding/binary",
+ "binary.Write": "encoding/binary",
+ "bufio.ErrAdvanceTooFar": "bufio",
+ "bufio.ErrBufferFull": "bufio",
+ "bufio.ErrInvalidUnreadByte": "bufio",
+ "bufio.ErrInvalidUnreadRune": "bufio",
+ "bufio.ErrNegativeAdvance": "bufio",
+ "bufio.ErrNegativeCount": "bufio",
+ "bufio.ErrTooLong": "bufio",
+ "bufio.MaxScanTokenSize": "bufio",
+ "bufio.NewReadWriter": "bufio",
+ "bufio.NewReader": "bufio",
+ "bufio.NewReaderSize": "bufio",
+ "bufio.NewScanner": "bufio",
+ "bufio.NewWriter": "bufio",
+ "bufio.NewWriterSize": "bufio",
+ "bufio.ReadWriter": "bufio",
+ "bufio.Reader": "bufio",
+ "bufio.ScanBytes": "bufio",
+ "bufio.ScanLines": "bufio",
+ "bufio.ScanRunes": "bufio",
+ "bufio.ScanWords": "bufio",
+ "bufio.Scanner": "bufio",
+ "bufio.SplitFunc": "bufio",
+ "bufio.Writer": "bufio",
+ "build.AllowBinary": "go/build",
+ "build.ArchChar": "go/build",
+ "build.Context": "go/build",
+ "build.Default": "go/build",
+ "build.FindOnly": "go/build",
+ "build.Import": "go/build",
+ "build.ImportDir": "go/build",
+ "build.ImportMode": "go/build",
+ "build.IsLocalImport": "go/build",
+ "build.NoGoError": "go/build",
+ "build.Package": "go/build",
+ "build.ToolDir": "go/build",
+ "bytes.Buffer": "bytes",
+ "bytes.Compare": "bytes",
+ "bytes.Contains": "bytes",
+ "bytes.Count": "bytes",
+ "bytes.Equal": "bytes",
+ "bytes.EqualFold": "bytes",
+ "bytes.ErrTooLarge": "bytes",
+ "bytes.Fields": "bytes",
+ "bytes.FieldsFunc": "bytes",
+ "bytes.HasPrefix": "bytes",
+ "bytes.HasSuffix": "bytes",
+ "bytes.Index": "bytes",
+ "bytes.IndexAny": "bytes",
+ "bytes.IndexByte": "bytes",
+ "bytes.IndexFunc": "bytes",
+ "bytes.IndexRune": "bytes",
+ "bytes.Join": "bytes",
+ "bytes.LastIndex": "bytes",
+ "bytes.LastIndexAny": "bytes",
+ "bytes.LastIndexFunc": "bytes",
+ "bytes.Map": "bytes",
+ "bytes.MinRead": "bytes",
+ "bytes.NewBuffer": "bytes",
+ "bytes.NewBufferString": "bytes",
+ "bytes.NewReader": "bytes",
+ "bytes.Reader": "bytes",
+ "bytes.Repeat": "bytes",
+ "bytes.Replace": "bytes",
+ "bytes.Runes": "bytes",
+ "bytes.Split": "bytes",
+ "bytes.SplitAfter": "bytes",
+ "bytes.SplitAfterN": "bytes",
+ "bytes.SplitN": "bytes",
+ "bytes.Title": "bytes",
+ "bytes.ToLower": "bytes",
+ "bytes.ToLowerSpecial": "bytes",
+ "bytes.ToTitle": "bytes",
+ "bytes.ToTitleSpecial": "bytes",
+ "bytes.ToUpper": "bytes",
+ "bytes.ToUpperSpecial": "bytes",
+ "bytes.Trim": "bytes",
+ "bytes.TrimFunc": "bytes",
+ "bytes.TrimLeft": "bytes",
+ "bytes.TrimLeftFunc": "bytes",
+ "bytes.TrimPrefix": "bytes",
+ "bytes.TrimRight": "bytes",
+ "bytes.TrimRightFunc": "bytes",
+ "bytes.TrimSpace": "bytes",
+ "bytes.TrimSuffix": "bytes",
+ "bzip2.NewReader": "compress/bzip2",
+ "bzip2.StructuralError": "compress/bzip2",
+ "cgi.Handler": "net/http/cgi",
+ "cgi.Request": "net/http/cgi",
+ "cgi.RequestFromMap": "net/http/cgi",
+ "cgi.Serve": "net/http/cgi",
+ "cipher.AEAD": "crypto/cipher",
+ "cipher.Block": "crypto/cipher",
+ "cipher.BlockMode": "crypto/cipher",
+ "cipher.NewCBCDecrypter": "crypto/cipher",
+ "cipher.NewCBCEncrypter": "crypto/cipher",
+ "cipher.NewCFBDecrypter": "crypto/cipher",
+ "cipher.NewCFBEncrypter": "crypto/cipher",
+ "cipher.NewCTR": "crypto/cipher",
+ "cipher.NewGCM": "crypto/cipher",
+ "cipher.NewOFB": "crypto/cipher",
+ "cipher.Stream": "crypto/cipher",
+ "cipher.StreamReader": "crypto/cipher",
+ "cipher.StreamWriter": "crypto/cipher",
+ "cmplx.Abs": "math/cmplx",
+ "cmplx.Acos": "math/cmplx",
+ "cmplx.Acosh": "math/cmplx",
+ "cmplx.Asin": "math/cmplx",
+ "cmplx.Asinh": "math/cmplx",
+ "cmplx.Atan": "math/cmplx",
+ "cmplx.Atanh": "math/cmplx",
+ "cmplx.Conj": "math/cmplx",
+ "cmplx.Cos": "math/cmplx",
+ "cmplx.Cosh": "math/cmplx",
+ "cmplx.Cot": "math/cmplx",
+ "cmplx.Exp": "math/cmplx",
+ "cmplx.Inf": "math/cmplx",
+ "cmplx.IsInf": "math/cmplx",
+ "cmplx.IsNaN": "math/cmplx",
+ "cmplx.Log": "math/cmplx",
+ "cmplx.Log10": "math/cmplx",
+ "cmplx.NaN": "math/cmplx",
+ "cmplx.Phase": "math/cmplx",
+ "cmplx.Polar": "math/cmplx",
+ "cmplx.Pow": "math/cmplx",
+ "cmplx.Rect": "math/cmplx",
+ "cmplx.Sin": "math/cmplx",
+ "cmplx.Sinh": "math/cmplx",
+ "cmplx.Sqrt": "math/cmplx",
+ "cmplx.Tan": "math/cmplx",
+ "cmplx.Tanh": "math/cmplx",
+ "color.Alpha": "image/color",
+ "color.Alpha16": "image/color",
+ "color.Alpha16Model": "image/color",
+ "color.AlphaModel": "image/color",
+ "color.Black": "image/color",
+ "color.Color": "image/color",
+ "color.Gray": "image/color",
+ "color.Gray16": "image/color",
+ "color.Gray16Model": "image/color",
+ "color.GrayModel": "image/color",
+ "color.Model": "image/color",
+ "color.ModelFunc": "image/color",
+ "color.NRGBA": "image/color",
+ "color.NRGBA64": "image/color",
+ "color.NRGBA64Model": "image/color",
+ "color.NRGBAModel": "image/color",
+ "color.Opaque": "image/color",
+ "color.Palette": "image/color",
+ "color.RGBA": "image/color",
+ "color.RGBA64": "image/color",
+ "color.RGBA64Model": "image/color",
+ "color.RGBAModel": "image/color",
+ "color.RGBToYCbCr": "image/color",
+ "color.Transparent": "image/color",
+ "color.White": "image/color",
+ "color.YCbCr": "image/color",
+ "color.YCbCrModel": "image/color",
+ "color.YCbCrToRGB": "image/color",
+ "cookiejar.Jar": "net/http/cookiejar",
+ "cookiejar.New": "net/http/cookiejar",
+ "cookiejar.Options": "net/http/cookiejar",
+ "cookiejar.PublicSuffixList": "net/http/cookiejar",
+ "crc32.Castagnoli": "hash/crc32",
+ "crc32.Checksum": "hash/crc32",
+ "crc32.ChecksumIEEE": "hash/crc32",
+ "crc32.IEEE": "hash/crc32",
+ "crc32.IEEETable": "hash/crc32",
+ "crc32.Koopman": "hash/crc32",
+ "crc32.MakeTable": "hash/crc32",
+ "crc32.New": "hash/crc32",
+ "crc32.NewIEEE": "hash/crc32",
+ "crc32.Size": "hash/crc32",
+ "crc32.Table": "hash/crc32",
+ "crc32.Update": "hash/crc32",
+ "crc64.Checksum": "hash/crc64",
+ "crc64.ECMA": "hash/crc64",
+ "crc64.ISO": "hash/crc64",
+ "crc64.MakeTable": "hash/crc64",
+ "crc64.New": "hash/crc64",
+ "crc64.Size": "hash/crc64",
+ "crc64.Table": "hash/crc64",
+ "crc64.Update": "hash/crc64",
+ "crypto.Hash": "crypto",
+ "crypto.MD4": "crypto",
+ "crypto.MD5": "crypto",
+ "crypto.MD5SHA1": "crypto",
+ "crypto.PrivateKey": "crypto",
+ "crypto.PublicKey": "crypto",
+ "crypto.RIPEMD160": "crypto",
+ "crypto.RegisterHash": "crypto",
+ "crypto.SHA1": "crypto",
+ "crypto.SHA224": "crypto",
+ "crypto.SHA256": "crypto",
+ "crypto.SHA384": "crypto",
+ "crypto.SHA512": "crypto",
+ "csv.ErrBareQuote": "encoding/csv",
+ "csv.ErrFieldCount": "encoding/csv",
+ "csv.ErrQuote": "encoding/csv",
+ "csv.ErrTrailingComma": "encoding/csv",
+ "csv.NewReader": "encoding/csv",
+ "csv.NewWriter": "encoding/csv",
+ "csv.ParseError": "encoding/csv",
+ "csv.Reader": "encoding/csv",
+ "csv.Writer": "encoding/csv",
+ "debug.FreeOSMemory": "runtime/debug",
+ "debug.GCStats": "runtime/debug",
+ "debug.PrintStack": "runtime/debug",
+ "debug.ReadGCStats": "runtime/debug",
+ "debug.SetGCPercent": "runtime/debug",
+ "debug.SetMaxStack": "runtime/debug",
+ "debug.SetMaxThreads": "runtime/debug",
+ "debug.Stack": "runtime/debug",
+ "des.BlockSize": "crypto/des",
+ "des.KeySizeError": "crypto/des",
+ "des.NewCipher": "crypto/des",
+ "des.NewTripleDESCipher": "crypto/des",
+ "doc.AllDecls": "go/doc",
+ "doc.AllMethods": "go/doc",
+ "doc.Example": "go/doc",
+ "doc.Examples": "go/doc",
+ "doc.Filter": "go/doc",
+ "doc.Func": "go/doc",
+ "doc.IllegalPrefixes": "go/doc",
+ "doc.Mode": "go/doc",
+ "doc.New": "go/doc",
+ "doc.Note": "go/doc",
+ "doc.Package": "go/doc",
+ "doc.Synopsis": "go/doc",
+ "doc.ToHTML": "go/doc",
+ "doc.ToText": "go/doc",
+ "doc.Type": "go/doc",
+ "doc.Value": "go/doc",
+ "draw.Draw": "image/draw",
+ "draw.DrawMask": "image/draw",
+ "draw.Drawer": "image/draw",
+ "draw.FloydSteinberg": "image/draw",
+ "draw.Image": "image/draw",
+ "draw.Op": "image/draw",
+ "draw.Over": "image/draw",
+ "draw.Quantizer": "image/draw",
+ "draw.Src": "image/draw",
+ "driver.Bool": "database/sql/driver",
+ "driver.ColumnConverter": "database/sql/driver",
+ "driver.Conn": "database/sql/driver",
+ "driver.DefaultParameterConverter": "database/sql/driver",
+ "driver.Driver": "database/sql/driver",
+ "driver.ErrBadConn": "database/sql/driver",
+ "driver.ErrSkip": "database/sql/driver",
+ "driver.Execer": "database/sql/driver",
+ "driver.Int32": "database/sql/driver",
+ "driver.IsScanValue": "database/sql/driver",
+ "driver.IsValue": "database/sql/driver",
+ "driver.NotNull": "database/sql/driver",
+ "driver.Null": "database/sql/driver",
+ "driver.Queryer": "database/sql/driver",
+ "driver.Result": "database/sql/driver",
+ "driver.ResultNoRows": "database/sql/driver",
+ "driver.Rows": "database/sql/driver",
+ "driver.RowsAffected": "database/sql/driver",
+ "driver.Stmt": "database/sql/driver",
+ "driver.String": "database/sql/driver",
+ "driver.Tx": "database/sql/driver",
+ "driver.Value": "database/sql/driver",
+ "driver.ValueConverter": "database/sql/driver",
+ "driver.Valuer": "database/sql/driver",
+ "dsa.ErrInvalidPublicKey": "crypto/dsa",
+ "dsa.GenerateKey": "crypto/dsa",
+ "dsa.GenerateParameters": "crypto/dsa",
+ "dsa.L1024N160": "crypto/dsa",
+ "dsa.L2048N224": "crypto/dsa",
+ "dsa.L2048N256": "crypto/dsa",
+ "dsa.L3072N256": "crypto/dsa",
+ "dsa.ParameterSizes": "crypto/dsa",
+ "dsa.Parameters": "crypto/dsa",
+ "dsa.PrivateKey": "crypto/dsa",
+ "dsa.PublicKey": "crypto/dsa",
+ "dsa.Sign": "crypto/dsa",
+ "dsa.Verify": "crypto/dsa",
+ "dwarf.AddrType": "debug/dwarf",
+ "dwarf.ArrayType": "debug/dwarf",
+ "dwarf.Attr": "debug/dwarf",
+ "dwarf.AttrAbstractOrigin": "debug/dwarf",
+ "dwarf.AttrAccessibility": "debug/dwarf",
+ "dwarf.AttrAddrClass": "debug/dwarf",
+ "dwarf.AttrAllocated": "debug/dwarf",
+ "dwarf.AttrArtificial": "debug/dwarf",
+ "dwarf.AttrAssociated": "debug/dwarf",
+ "dwarf.AttrBaseTypes": "debug/dwarf",
+ "dwarf.AttrBitOffset": "debug/dwarf",
+ "dwarf.AttrBitSize": "debug/dwarf",
+ "dwarf.AttrByteSize": "debug/dwarf",
+ "dwarf.AttrCallColumn": "debug/dwarf",
+ "dwarf.AttrCallFile": "debug/dwarf",
+ "dwarf.AttrCallLine": "debug/dwarf",
+ "dwarf.AttrCalling": "debug/dwarf",
+ "dwarf.AttrCommonRef": "debug/dwarf",
+ "dwarf.AttrCompDir": "debug/dwarf",
+ "dwarf.AttrConstValue": "debug/dwarf",
+ "dwarf.AttrContainingType": "debug/dwarf",
+ "dwarf.AttrCount": "debug/dwarf",
+ "dwarf.AttrDataLocation": "debug/dwarf",
+ "dwarf.AttrDataMemberLoc": "debug/dwarf",
+ "dwarf.AttrDeclColumn": "debug/dwarf",
+ "dwarf.AttrDeclFile": "debug/dwarf",
+ "dwarf.AttrDeclLine": "debug/dwarf",
+ "dwarf.AttrDeclaration": "debug/dwarf",
+ "dwarf.AttrDefaultValue": "debug/dwarf",
+ "dwarf.AttrDescription": "debug/dwarf",
+ "dwarf.AttrDiscr": "debug/dwarf",
+ "dwarf.AttrDiscrList": "debug/dwarf",
+ "dwarf.AttrDiscrValue": "debug/dwarf",
+ "dwarf.AttrEncoding": "debug/dwarf",
+ "dwarf.AttrEntrypc": "debug/dwarf",
+ "dwarf.AttrExtension": "debug/dwarf",
+ "dwarf.AttrExternal": "debug/dwarf",
+ "dwarf.AttrFrameBase": "debug/dwarf",
+ "dwarf.AttrFriend": "debug/dwarf",
+ "dwarf.AttrHighpc": "debug/dwarf",
+ "dwarf.AttrIdentifierCase": "debug/dwarf",
+ "dwarf.AttrImport": "debug/dwarf",
+ "dwarf.AttrInline": "debug/dwarf",
+ "dwarf.AttrIsOptional": "debug/dwarf",
+ "dwarf.AttrLanguage": "debug/dwarf",
+ "dwarf.AttrLocation": "debug/dwarf",
+ "dwarf.AttrLowerBound": "debug/dwarf",
+ "dwarf.AttrLowpc": "debug/dwarf",
+ "dwarf.AttrMacroInfo": "debug/dwarf",
+ "dwarf.AttrName": "debug/dwarf",
+ "dwarf.AttrNamelistItem": "debug/dwarf",
+ "dwarf.AttrOrdering": "debug/dwarf",
+ "dwarf.AttrPriority": "debug/dwarf",
+ "dwarf.AttrProducer": "debug/dwarf",
+ "dwarf.AttrPrototyped": "debug/dwarf",
+ "dwarf.AttrRanges": "debug/dwarf",
+ "dwarf.AttrReturnAddr": "debug/dwarf",
+ "dwarf.AttrSegment": "debug/dwarf",
+ "dwarf.AttrSibling": "debug/dwarf",
+ "dwarf.AttrSpecification": "debug/dwarf",
+ "dwarf.AttrStartScope": "debug/dwarf",
+ "dwarf.AttrStaticLink": "debug/dwarf",
+ "dwarf.AttrStmtList": "debug/dwarf",
+ "dwarf.AttrStride": "debug/dwarf",
+ "dwarf.AttrStrideSize": "debug/dwarf",
+ "dwarf.AttrStringLength": "debug/dwarf",
+ "dwarf.AttrTrampoline": "debug/dwarf",
+ "dwarf.AttrType": "debug/dwarf",
+ "dwarf.AttrUpperBound": "debug/dwarf",
+ "dwarf.AttrUseLocation": "debug/dwarf",
+ "dwarf.AttrUseUTF8": "debug/dwarf",
+ "dwarf.AttrVarParam": "debug/dwarf",
+ "dwarf.AttrVirtuality": "debug/dwarf",
+ "dwarf.AttrVisibility": "debug/dwarf",
+ "dwarf.AttrVtableElemLoc": "debug/dwarf",
+ "dwarf.BasicType": "debug/dwarf",
+ "dwarf.BoolType": "debug/dwarf",
+ "dwarf.CharType": "debug/dwarf",
+ "dwarf.CommonType": "debug/dwarf",
+ "dwarf.ComplexType": "debug/dwarf",
+ "dwarf.Data": "debug/dwarf",
+ "dwarf.DecodeError": "debug/dwarf",
+ "dwarf.DotDotDotType": "debug/dwarf",
+ "dwarf.Entry": "debug/dwarf",
+ "dwarf.EnumType": "debug/dwarf",
+ "dwarf.EnumValue": "debug/dwarf",
+ "dwarf.Field": "debug/dwarf",
+ "dwarf.FloatType": "debug/dwarf",
+ "dwarf.FuncType": "debug/dwarf",
+ "dwarf.IntType": "debug/dwarf",
+ "dwarf.New": "debug/dwarf",
+ "dwarf.Offset": "debug/dwarf",
+ "dwarf.PtrType": "debug/dwarf",
+ "dwarf.QualType": "debug/dwarf",
+ "dwarf.Reader": "debug/dwarf",
+ "dwarf.StructField": "debug/dwarf",
+ "dwarf.StructType": "debug/dwarf",
+ "dwarf.Tag": "debug/dwarf",
+ "dwarf.TagAccessDeclaration": "debug/dwarf",
+ "dwarf.TagArrayType": "debug/dwarf",
+ "dwarf.TagBaseType": "debug/dwarf",
+ "dwarf.TagCatchDwarfBlock": "debug/dwarf",
+ "dwarf.TagClassType": "debug/dwarf",
+ "dwarf.TagCommonDwarfBlock": "debug/dwarf",
+ "dwarf.TagCommonInclusion": "debug/dwarf",
+ "dwarf.TagCompileUnit": "debug/dwarf",
+ "dwarf.TagConstType": "debug/dwarf",
+ "dwarf.TagConstant": "debug/dwarf",
+ "dwarf.TagDwarfProcedure": "debug/dwarf",
+ "dwarf.TagEntryPoint": "debug/dwarf",
+ "dwarf.TagEnumerationType": "debug/dwarf",
+ "dwarf.TagEnumerator": "debug/dwarf",
+ "dwarf.TagFileType": "debug/dwarf",
+ "dwarf.TagFormalParameter": "debug/dwarf",
+ "dwarf.TagFriend": "debug/dwarf",
+ "dwarf.TagImportedDeclaration": "debug/dwarf",
+ "dwarf.TagImportedModule": "debug/dwarf",
+ "dwarf.TagImportedUnit": "debug/dwarf",
+ "dwarf.TagInheritance": "debug/dwarf",
+ "dwarf.TagInlinedSubroutine": "debug/dwarf",
+ "dwarf.TagInterfaceType": "debug/dwarf",
+ "dwarf.TagLabel": "debug/dwarf",
+ "dwarf.TagLexDwarfBlock": "debug/dwarf",
+ "dwarf.TagMember": "debug/dwarf",
+ "dwarf.TagModule": "debug/dwarf",
+ "dwarf.TagMutableType": "debug/dwarf",
+ "dwarf.TagNamelist": "debug/dwarf",
+ "dwarf.TagNamelistItem": "debug/dwarf",
+ "dwarf.TagNamespace": "debug/dwarf",
+ "dwarf.TagPackedType": "debug/dwarf",
+ "dwarf.TagPartialUnit": "debug/dwarf",
+ "dwarf.TagPointerType": "debug/dwarf",
+ "dwarf.TagPtrToMemberType": "debug/dwarf",
+ "dwarf.TagReferenceType": "debug/dwarf",
+ "dwarf.TagRestrictType": "debug/dwarf",
+ "dwarf.TagSetType": "debug/dwarf",
+ "dwarf.TagStringType": "debug/dwarf",
+ "dwarf.TagStructType": "debug/dwarf",
+ "dwarf.TagSubprogram": "debug/dwarf",
+ "dwarf.TagSubrangeType": "debug/dwarf",
+ "dwarf.TagSubroutineType": "debug/dwarf",
+ "dwarf.TagTemplateTypeParameter": "debug/dwarf",
+ "dwarf.TagTemplateValueParameter": "debug/dwarf",
+ "dwarf.TagThrownType": "debug/dwarf",
+ "dwarf.TagTryDwarfBlock": "debug/dwarf",
+ "dwarf.TagTypedef": "debug/dwarf",
+ "dwarf.TagUnionType": "debug/dwarf",
+ "dwarf.TagUnspecifiedParameters": "debug/dwarf",
+ "dwarf.TagUnspecifiedType": "debug/dwarf",
+ "dwarf.TagVariable": "debug/dwarf",
+ "dwarf.TagVariant": "debug/dwarf",
+ "dwarf.TagVariantPart": "debug/dwarf",
+ "dwarf.TagVolatileType": "debug/dwarf",
+ "dwarf.TagWithStmt": "debug/dwarf",
+ "dwarf.Type": "debug/dwarf",
+ "dwarf.TypedefType": "debug/dwarf",
+ "dwarf.UcharType": "debug/dwarf",
+ "dwarf.UintType": "debug/dwarf",
+ "dwarf.VoidType": "debug/dwarf",
+ "ecdsa.GenerateKey": "crypto/ecdsa",
+ "ecdsa.PrivateKey": "crypto/ecdsa",
+ "ecdsa.PublicKey": "crypto/ecdsa",
+ "ecdsa.Sign": "crypto/ecdsa",
+ "ecdsa.Verify": "crypto/ecdsa",
+ "elf.ARM_MAGIC_TRAMP_NUMBER": "debug/elf",
+ "elf.Class": "debug/elf",
+ "elf.DF_BIND_NOW": "debug/elf",
+ "elf.DF_ORIGIN": "debug/elf",
+ "elf.DF_STATIC_TLS": "debug/elf",
+ "elf.DF_SYMBOLIC": "debug/elf",
+ "elf.DF_TEXTREL": "debug/elf",
+ "elf.DT_BIND_NOW": "debug/elf",
+ "elf.DT_DEBUG": "debug/elf",
+ "elf.DT_ENCODING": "debug/elf",
+ "elf.DT_FINI": "debug/elf",
+ "elf.DT_FINI_ARRAY": "debug/elf",
+ "elf.DT_FINI_ARRAYSZ": "debug/elf",
+ "elf.DT_FLAGS": "debug/elf",
+ "elf.DT_HASH": "debug/elf",
+ "elf.DT_HIOS": "debug/elf",
+ "elf.DT_HIPROC": "debug/elf",
+ "elf.DT_INIT": "debug/elf",
+ "elf.DT_INIT_ARRAY": "debug/elf",
+ "elf.DT_INIT_ARRAYSZ": "debug/elf",
+ "elf.DT_JMPREL": "debug/elf",
+ "elf.DT_LOOS": "debug/elf",
+ "elf.DT_LOPROC": "debug/elf",
+ "elf.DT_NEEDED": "debug/elf",
+ "elf.DT_NULL": "debug/elf",
+ "elf.DT_PLTGOT": "debug/elf",
+ "elf.DT_PLTREL": "debug/elf",
+ "elf.DT_PLTRELSZ": "debug/elf",
+ "elf.DT_PREINIT_ARRAY": "debug/elf",
+ "elf.DT_PREINIT_ARRAYSZ": "debug/elf",
+ "elf.DT_REL": "debug/elf",
+ "elf.DT_RELA": "debug/elf",
+ "elf.DT_RELAENT": "debug/elf",
+ "elf.DT_RELASZ": "debug/elf",
+ "elf.DT_RELENT": "debug/elf",
+ "elf.DT_RELSZ": "debug/elf",
+ "elf.DT_RPATH": "debug/elf",
+ "elf.DT_RUNPATH": "debug/elf",
+ "elf.DT_SONAME": "debug/elf",
+ "elf.DT_STRSZ": "debug/elf",
+ "elf.DT_STRTAB": "debug/elf",
+ "elf.DT_SYMBOLIC": "debug/elf",
+ "elf.DT_SYMENT": "debug/elf",
+ "elf.DT_SYMTAB": "debug/elf",
+ "elf.DT_TEXTREL": "debug/elf",
+ "elf.DT_VERNEED": "debug/elf",
+ "elf.DT_VERNEEDNUM": "debug/elf",
+ "elf.DT_VERSYM": "debug/elf",
+ "elf.Data": "debug/elf",
+ "elf.Dyn32": "debug/elf",
+ "elf.Dyn64": "debug/elf",
+ "elf.DynFlag": "debug/elf",
+ "elf.DynTag": "debug/elf",
+ "elf.EI_ABIVERSION": "debug/elf",
+ "elf.EI_CLASS": "debug/elf",
+ "elf.EI_DATA": "debug/elf",
+ "elf.EI_NIDENT": "debug/elf",
+ "elf.EI_OSABI": "debug/elf",
+ "elf.EI_PAD": "debug/elf",
+ "elf.EI_VERSION": "debug/elf",
+ "elf.ELFCLASS32": "debug/elf",
+ "elf.ELFCLASS64": "debug/elf",
+ "elf.ELFCLASSNONE": "debug/elf",
+ "elf.ELFDATA2LSB": "debug/elf",
+ "elf.ELFDATA2MSB": "debug/elf",
+ "elf.ELFDATANONE": "debug/elf",
+ "elf.ELFMAG": "debug/elf",
+ "elf.ELFOSABI_86OPEN": "debug/elf",
+ "elf.ELFOSABI_AIX": "debug/elf",
+ "elf.ELFOSABI_ARM": "debug/elf",
+ "elf.ELFOSABI_FREEBSD": "debug/elf",
+ "elf.ELFOSABI_HPUX": "debug/elf",
+ "elf.ELFOSABI_HURD": "debug/elf",
+ "elf.ELFOSABI_IRIX": "debug/elf",
+ "elf.ELFOSABI_LINUX": "debug/elf",
+ "elf.ELFOSABI_MODESTO": "debug/elf",
+ "elf.ELFOSABI_NETBSD": "debug/elf",
+ "elf.ELFOSABI_NONE": "debug/elf",
+ "elf.ELFOSABI_NSK": "debug/elf",
+ "elf.ELFOSABI_OPENBSD": "debug/elf",
+ "elf.ELFOSABI_OPENVMS": "debug/elf",
+ "elf.ELFOSABI_SOLARIS": "debug/elf",
+ "elf.ELFOSABI_STANDALONE": "debug/elf",
+ "elf.ELFOSABI_TRU64": "debug/elf",
+ "elf.EM_386": "debug/elf",
+ "elf.EM_486": "debug/elf",
+ "elf.EM_68HC12": "debug/elf",
+ "elf.EM_68K": "debug/elf",
+ "elf.EM_860": "debug/elf",
+ "elf.EM_88K": "debug/elf",
+ "elf.EM_960": "debug/elf",
+ "elf.EM_ALPHA": "debug/elf",
+ "elf.EM_ALPHA_STD": "debug/elf",
+ "elf.EM_ARC": "debug/elf",
+ "elf.EM_ARM": "debug/elf",
+ "elf.EM_COLDFIRE": "debug/elf",
+ "elf.EM_FR20": "debug/elf",
+ "elf.EM_H8S": "debug/elf",
+ "elf.EM_H8_300": "debug/elf",
+ "elf.EM_H8_300H": "debug/elf",
+ "elf.EM_H8_500": "debug/elf",
+ "elf.EM_IA_64": "debug/elf",
+ "elf.EM_M32": "debug/elf",
+ "elf.EM_ME16": "debug/elf",
+ "elf.EM_MIPS": "debug/elf",
+ "elf.EM_MIPS_RS3_LE": "debug/elf",
+ "elf.EM_MIPS_RS4_BE": "debug/elf",
+ "elf.EM_MIPS_X": "debug/elf",
+ "elf.EM_MMA": "debug/elf",
+ "elf.EM_NCPU": "debug/elf",
+ "elf.EM_NDR1": "debug/elf",
+ "elf.EM_NONE": "debug/elf",
+ "elf.EM_PARISC": "debug/elf",
+ "elf.EM_PCP": "debug/elf",
+ "elf.EM_PPC": "debug/elf",
+ "elf.EM_PPC64": "debug/elf",
+ "elf.EM_RCE": "debug/elf",
+ "elf.EM_RH32": "debug/elf",
+ "elf.EM_S370": "debug/elf",
+ "elf.EM_S390": "debug/elf",
+ "elf.EM_SH": "debug/elf",
+ "elf.EM_SPARC": "debug/elf",
+ "elf.EM_SPARC32PLUS": "debug/elf",
+ "elf.EM_SPARCV9": "debug/elf",
+ "elf.EM_ST100": "debug/elf",
+ "elf.EM_STARCORE": "debug/elf",
+ "elf.EM_TINYJ": "debug/elf",
+ "elf.EM_TRICORE": "debug/elf",
+ "elf.EM_V800": "debug/elf",
+ "elf.EM_VPP500": "debug/elf",
+ "elf.EM_X86_64": "debug/elf",
+ "elf.ET_CORE": "debug/elf",
+ "elf.ET_DYN": "debug/elf",
+ "elf.ET_EXEC": "debug/elf",
+ "elf.ET_HIOS": "debug/elf",
+ "elf.ET_HIPROC": "debug/elf",
+ "elf.ET_LOOS": "debug/elf",
+ "elf.ET_LOPROC": "debug/elf",
+ "elf.ET_NONE": "debug/elf",
+ "elf.ET_REL": "debug/elf",
+ "elf.EV_CURRENT": "debug/elf",
+ "elf.EV_NONE": "debug/elf",
+ "elf.File": "debug/elf",
+ "elf.FileHeader": "debug/elf",
+ "elf.FormatError": "debug/elf",
+ "elf.Header32": "debug/elf",
+ "elf.Header64": "debug/elf",
+ "elf.ImportedSymbol": "debug/elf",
+ "elf.Machine": "debug/elf",
+ "elf.NT_FPREGSET": "debug/elf",
+ "elf.NT_PRPSINFO": "debug/elf",
+ "elf.NT_PRSTATUS": "debug/elf",
+ "elf.NType": "debug/elf",
+ "elf.NewFile": "debug/elf",
+ "elf.OSABI": "debug/elf",
+ "elf.Open": "debug/elf",
+ "elf.PF_MASKOS": "debug/elf",
+ "elf.PF_MASKPROC": "debug/elf",
+ "elf.PF_R": "debug/elf",
+ "elf.PF_W": "debug/elf",
+ "elf.PF_X": "debug/elf",
+ "elf.PT_DYNAMIC": "debug/elf",
+ "elf.PT_HIOS": "debug/elf",
+ "elf.PT_HIPROC": "debug/elf",
+ "elf.PT_INTERP": "debug/elf",
+ "elf.PT_LOAD": "debug/elf",
+ "elf.PT_LOOS": "debug/elf",
+ "elf.PT_LOPROC": "debug/elf",
+ "elf.PT_NOTE": "debug/elf",
+ "elf.PT_NULL": "debug/elf",
+ "elf.PT_PHDR": "debug/elf",
+ "elf.PT_SHLIB": "debug/elf",
+ "elf.PT_TLS": "debug/elf",
+ "elf.Prog": "debug/elf",
+ "elf.Prog32": "debug/elf",
+ "elf.Prog64": "debug/elf",
+ "elf.ProgFlag": "debug/elf",
+ "elf.ProgHeader": "debug/elf",
+ "elf.ProgType": "debug/elf",
+ "elf.R_386": "debug/elf",
+ "elf.R_386_32": "debug/elf",
+ "elf.R_386_COPY": "debug/elf",
+ "elf.R_386_GLOB_DAT": "debug/elf",
+ "elf.R_386_GOT32": "debug/elf",
+ "elf.R_386_GOTOFF": "debug/elf",
+ "elf.R_386_GOTPC": "debug/elf",
+ "elf.R_386_JMP_SLOT": "debug/elf",
+ "elf.R_386_NONE": "debug/elf",
+ "elf.R_386_PC32": "debug/elf",
+ "elf.R_386_PLT32": "debug/elf",
+ "elf.R_386_RELATIVE": "debug/elf",
+ "elf.R_386_TLS_DTPMOD32": "debug/elf",
+ "elf.R_386_TLS_DTPOFF32": "debug/elf",
+ "elf.R_386_TLS_GD": "debug/elf",
+ "elf.R_386_TLS_GD_32": "debug/elf",
+ "elf.R_386_TLS_GD_CALL": "debug/elf",
+ "elf.R_386_TLS_GD_POP": "debug/elf",
+ "elf.R_386_TLS_GD_PUSH": "debug/elf",
+ "elf.R_386_TLS_GOTIE": "debug/elf",
+ "elf.R_386_TLS_IE": "debug/elf",
+ "elf.R_386_TLS_IE_32": "debug/elf",
+ "elf.R_386_TLS_LDM": "debug/elf",
+ "elf.R_386_TLS_LDM_32": "debug/elf",
+ "elf.R_386_TLS_LDM_CALL": "debug/elf",
+ "elf.R_386_TLS_LDM_POP": "debug/elf",
+ "elf.R_386_TLS_LDM_PUSH": "debug/elf",
+ "elf.R_386_TLS_LDO_32": "debug/elf",
+ "elf.R_386_TLS_LE": "debug/elf",
+ "elf.R_386_TLS_LE_32": "debug/elf",
+ "elf.R_386_TLS_TPOFF": "debug/elf",
+ "elf.R_386_TLS_TPOFF32": "debug/elf",
+ "elf.R_ALPHA": "debug/elf",
+ "elf.R_ALPHA_BRADDR": "debug/elf",
+ "elf.R_ALPHA_COPY": "debug/elf",
+ "elf.R_ALPHA_GLOB_DAT": "debug/elf",
+ "elf.R_ALPHA_GPDISP": "debug/elf",
+ "elf.R_ALPHA_GPREL32": "debug/elf",
+ "elf.R_ALPHA_GPRELHIGH": "debug/elf",
+ "elf.R_ALPHA_GPRELLOW": "debug/elf",
+ "elf.R_ALPHA_GPVALUE": "debug/elf",
+ "elf.R_ALPHA_HINT": "debug/elf",
+ "elf.R_ALPHA_IMMED_BR_HI32": "debug/elf",
+ "elf.R_ALPHA_IMMED_GP_16": "debug/elf",
+ "elf.R_ALPHA_IMMED_GP_HI32": "debug/elf",
+ "elf.R_ALPHA_IMMED_LO32": "debug/elf",
+ "elf.R_ALPHA_IMMED_SCN_HI32": "debug/elf",
+ "elf.R_ALPHA_JMP_SLOT": "debug/elf",
+ "elf.R_ALPHA_LITERAL": "debug/elf",
+ "elf.R_ALPHA_LITUSE": "debug/elf",
+ "elf.R_ALPHA_NONE": "debug/elf",
+ "elf.R_ALPHA_OP_PRSHIFT": "debug/elf",
+ "elf.R_ALPHA_OP_PSUB": "debug/elf",
+ "elf.R_ALPHA_OP_PUSH": "debug/elf",
+ "elf.R_ALPHA_OP_STORE": "debug/elf",
+ "elf.R_ALPHA_REFLONG": "debug/elf",
+ "elf.R_ALPHA_REFQUAD": "debug/elf",
+ "elf.R_ALPHA_RELATIVE": "debug/elf",
+ "elf.R_ALPHA_SREL16": "debug/elf",
+ "elf.R_ALPHA_SREL32": "debug/elf",
+ "elf.R_ALPHA_SREL64": "debug/elf",
+ "elf.R_ARM": "debug/elf",
+ "elf.R_ARM_ABS12": "debug/elf",
+ "elf.R_ARM_ABS16": "debug/elf",
+ "elf.R_ARM_ABS32": "debug/elf",
+ "elf.R_ARM_ABS8": "debug/elf",
+ "elf.R_ARM_AMP_VCALL9": "debug/elf",
+ "elf.R_ARM_COPY": "debug/elf",
+ "elf.R_ARM_GLOB_DAT": "debug/elf",
+ "elf.R_ARM_GNU_VTENTRY": "debug/elf",
+ "elf.R_ARM_GNU_VTINHERIT": "debug/elf",
+ "elf.R_ARM_GOT32": "debug/elf",
+ "elf.R_ARM_GOTOFF": "debug/elf",
+ "elf.R_ARM_GOTPC": "debug/elf",
+ "elf.R_ARM_JUMP_SLOT": "debug/elf",
+ "elf.R_ARM_NONE": "debug/elf",
+ "elf.R_ARM_PC13": "debug/elf",
+ "elf.R_ARM_PC24": "debug/elf",
+ "elf.R_ARM_PLT32": "debug/elf",
+ "elf.R_ARM_RABS32": "debug/elf",
+ "elf.R_ARM_RBASE": "debug/elf",
+ "elf.R_ARM_REL32": "debug/elf",
+ "elf.R_ARM_RELATIVE": "debug/elf",
+ "elf.R_ARM_RPC24": "debug/elf",
+ "elf.R_ARM_RREL32": "debug/elf",
+ "elf.R_ARM_RSBREL32": "debug/elf",
+ "elf.R_ARM_SBREL32": "debug/elf",
+ "elf.R_ARM_SWI24": "debug/elf",
+ "elf.R_ARM_THM_ABS5": "debug/elf",
+ "elf.R_ARM_THM_PC22": "debug/elf",
+ "elf.R_ARM_THM_PC8": "debug/elf",
+ "elf.R_ARM_THM_RPC22": "debug/elf",
+ "elf.R_ARM_THM_SWI8": "debug/elf",
+ "elf.R_ARM_THM_XPC22": "debug/elf",
+ "elf.R_ARM_XPC25": "debug/elf",
+ "elf.R_INFO": "debug/elf",
+ "elf.R_INFO32": "debug/elf",
+ "elf.R_PPC": "debug/elf",
+ "elf.R_PPC_ADDR14": "debug/elf",
+ "elf.R_PPC_ADDR14_BRNTAKEN": "debug/elf",
+ "elf.R_PPC_ADDR14_BRTAKEN": "debug/elf",
+ "elf.R_PPC_ADDR16": "debug/elf",
+ "elf.R_PPC_ADDR16_HA": "debug/elf",
+ "elf.R_PPC_ADDR16_HI": "debug/elf",
+ "elf.R_PPC_ADDR16_LO": "debug/elf",
+ "elf.R_PPC_ADDR24": "debug/elf",
+ "elf.R_PPC_ADDR32": "debug/elf",
+ "elf.R_PPC_COPY": "debug/elf",
+ "elf.R_PPC_DTPMOD32": "debug/elf",
+ "elf.R_PPC_DTPREL16": "debug/elf",
+ "elf.R_PPC_DTPREL16_HA": "debug/elf",
+ "elf.R_PPC_DTPREL16_HI": "debug/elf",
+ "elf.R_PPC_DTPREL16_LO": "debug/elf",
+ "elf.R_PPC_DTPREL32": "debug/elf",
+ "elf.R_PPC_EMB_BIT_FLD": "debug/elf",
+ "elf.R_PPC_EMB_MRKREF": "debug/elf",
+ "elf.R_PPC_EMB_NADDR16": "debug/elf",
+ "elf.R_PPC_EMB_NADDR16_HA": "debug/elf",
+ "elf.R_PPC_EMB_NADDR16_HI": "debug/elf",
+ "elf.R_PPC_EMB_NADDR16_LO": "debug/elf",
+ "elf.R_PPC_EMB_NADDR32": "debug/elf",
+ "elf.R_PPC_EMB_RELSDA": "debug/elf",
+ "elf.R_PPC_EMB_RELSEC16": "debug/elf",
+ "elf.R_PPC_EMB_RELST_HA": "debug/elf",
+ "elf.R_PPC_EMB_RELST_HI": "debug/elf",
+ "elf.R_PPC_EMB_RELST_LO": "debug/elf",
+ "elf.R_PPC_EMB_SDA21": "debug/elf",
+ "elf.R_PPC_EMB_SDA2I16": "debug/elf",
+ "elf.R_PPC_EMB_SDA2REL": "debug/elf",
+ "elf.R_PPC_EMB_SDAI16": "debug/elf",
+ "elf.R_PPC_GLOB_DAT": "debug/elf",
+ "elf.R_PPC_GOT16": "debug/elf",
+ "elf.R_PPC_GOT16_HA": "debug/elf",
+ "elf.R_PPC_GOT16_HI": "debug/elf",
+ "elf.R_PPC_GOT16_LO": "debug/elf",
+ "elf.R_PPC_GOT_TLSGD16": "debug/elf",
+ "elf.R_PPC_GOT_TLSGD16_HA": "debug/elf",
+ "elf.R_PPC_GOT_TLSGD16_HI": "debug/elf",
+ "elf.R_PPC_GOT_TLSGD16_LO": "debug/elf",
+ "elf.R_PPC_GOT_TLSLD16": "debug/elf",
+ "elf.R_PPC_GOT_TLSLD16_HA": "debug/elf",
+ "elf.R_PPC_GOT_TLSLD16_HI": "debug/elf",
+ "elf.R_PPC_GOT_TLSLD16_LO": "debug/elf",
+ "elf.R_PPC_GOT_TPREL16": "debug/elf",
+ "elf.R_PPC_GOT_TPREL16_HA": "debug/elf",
+ "elf.R_PPC_GOT_TPREL16_HI": "debug/elf",
+ "elf.R_PPC_GOT_TPREL16_LO": "debug/elf",
+ "elf.R_PPC_JMP_SLOT": "debug/elf",
+ "elf.R_PPC_LOCAL24PC": "debug/elf",
+ "elf.R_PPC_NONE": "debug/elf",
+ "elf.R_PPC_PLT16_HA": "debug/elf",
+ "elf.R_PPC_PLT16_HI": "debug/elf",
+ "elf.R_PPC_PLT16_LO": "debug/elf",
+ "elf.R_PPC_PLT32": "debug/elf",
+ "elf.R_PPC_PLTREL24": "debug/elf",
+ "elf.R_PPC_PLTREL32": "debug/elf",
+ "elf.R_PPC_REL14": "debug/elf",
+ "elf.R_PPC_REL14_BRNTAKEN": "debug/elf",
+ "elf.R_PPC_REL14_BRTAKEN": "debug/elf",
+ "elf.R_PPC_REL24": "debug/elf",
+ "elf.R_PPC_REL32": "debug/elf",
+ "elf.R_PPC_RELATIVE": "debug/elf",
+ "elf.R_PPC_SDAREL16": "debug/elf",
+ "elf.R_PPC_SECTOFF": "debug/elf",
+ "elf.R_PPC_SECTOFF_HA": "debug/elf",
+ "elf.R_PPC_SECTOFF_HI": "debug/elf",
+ "elf.R_PPC_SECTOFF_LO": "debug/elf",
+ "elf.R_PPC_TLS": "debug/elf",
+ "elf.R_PPC_TPREL16": "debug/elf",
+ "elf.R_PPC_TPREL16_HA": "debug/elf",
+ "elf.R_PPC_TPREL16_HI": "debug/elf",
+ "elf.R_PPC_TPREL16_LO": "debug/elf",
+ "elf.R_PPC_TPREL32": "debug/elf",
+ "elf.R_PPC_UADDR16": "debug/elf",
+ "elf.R_PPC_UADDR32": "debug/elf",
+ "elf.R_SPARC": "debug/elf",
+ "elf.R_SPARC_10": "debug/elf",
+ "elf.R_SPARC_11": "debug/elf",
+ "elf.R_SPARC_13": "debug/elf",
+ "elf.R_SPARC_16": "debug/elf",
+ "elf.R_SPARC_22": "debug/elf",
+ "elf.R_SPARC_32": "debug/elf",
+ "elf.R_SPARC_5": "debug/elf",
+ "elf.R_SPARC_6": "debug/elf",
+ "elf.R_SPARC_64": "debug/elf",
+ "elf.R_SPARC_7": "debug/elf",
+ "elf.R_SPARC_8": "debug/elf",
+ "elf.R_SPARC_COPY": "debug/elf",
+ "elf.R_SPARC_DISP16": "debug/elf",
+ "elf.R_SPARC_DISP32": "debug/elf",
+ "elf.R_SPARC_DISP64": "debug/elf",
+ "elf.R_SPARC_DISP8": "debug/elf",
+ "elf.R_SPARC_GLOB_DAT": "debug/elf",
+ "elf.R_SPARC_GLOB_JMP": "debug/elf",
+ "elf.R_SPARC_GOT10": "debug/elf",
+ "elf.R_SPARC_GOT13": "debug/elf",
+ "elf.R_SPARC_GOT22": "debug/elf",
+ "elf.R_SPARC_H44": "debug/elf",
+ "elf.R_SPARC_HH22": "debug/elf",
+ "elf.R_SPARC_HI22": "debug/elf",
+ "elf.R_SPARC_HIPLT22": "debug/elf",
+ "elf.R_SPARC_HIX22": "debug/elf",
+ "elf.R_SPARC_HM10": "debug/elf",
+ "elf.R_SPARC_JMP_SLOT": "debug/elf",
+ "elf.R_SPARC_L44": "debug/elf",
+ "elf.R_SPARC_LM22": "debug/elf",
+ "elf.R_SPARC_LO10": "debug/elf",
+ "elf.R_SPARC_LOPLT10": "debug/elf",
+ "elf.R_SPARC_LOX10": "debug/elf",
+ "elf.R_SPARC_M44": "debug/elf",
+ "elf.R_SPARC_NONE": "debug/elf",
+ "elf.R_SPARC_OLO10": "debug/elf",
+ "elf.R_SPARC_PC10": "debug/elf",
+ "elf.R_SPARC_PC22": "debug/elf",
+ "elf.R_SPARC_PCPLT10": "debug/elf",
+ "elf.R_SPARC_PCPLT22": "debug/elf",
+ "elf.R_SPARC_PCPLT32": "debug/elf",
+ "elf.R_SPARC_PC_HH22": "debug/elf",
+ "elf.R_SPARC_PC_HM10": "debug/elf",
+ "elf.R_SPARC_PC_LM22": "debug/elf",
+ "elf.R_SPARC_PLT32": "debug/elf",
+ "elf.R_SPARC_PLT64": "debug/elf",
+ "elf.R_SPARC_REGISTER": "debug/elf",
+ "elf.R_SPARC_RELATIVE": "debug/elf",
+ "elf.R_SPARC_UA16": "debug/elf",
+ "elf.R_SPARC_UA32": "debug/elf",
+ "elf.R_SPARC_UA64": "debug/elf",
+ "elf.R_SPARC_WDISP16": "debug/elf",
+ "elf.R_SPARC_WDISP19": "debug/elf",
+ "elf.R_SPARC_WDISP22": "debug/elf",
+ "elf.R_SPARC_WDISP30": "debug/elf",
+ "elf.R_SPARC_WPLT30": "debug/elf",
+ "elf.R_SYM32": "debug/elf",
+ "elf.R_SYM64": "debug/elf",
+ "elf.R_TYPE32": "debug/elf",
+ "elf.R_TYPE64": "debug/elf",
+ "elf.R_X86_64": "debug/elf",
+ "elf.R_X86_64_16": "debug/elf",
+ "elf.R_X86_64_32": "debug/elf",
+ "elf.R_X86_64_32S": "debug/elf",
+ "elf.R_X86_64_64": "debug/elf",
+ "elf.R_X86_64_8": "debug/elf",
+ "elf.R_X86_64_COPY": "debug/elf",
+ "elf.R_X86_64_DTPMOD64": "debug/elf",
+ "elf.R_X86_64_DTPOFF32": "debug/elf",
+ "elf.R_X86_64_DTPOFF64": "debug/elf",
+ "elf.R_X86_64_GLOB_DAT": "debug/elf",
+ "elf.R_X86_64_GOT32": "debug/elf",
+ "elf.R_X86_64_GOTPCREL": "debug/elf",
+ "elf.R_X86_64_GOTTPOFF": "debug/elf",
+ "elf.R_X86_64_JMP_SLOT": "debug/elf",
+ "elf.R_X86_64_NONE": "debug/elf",
+ "elf.R_X86_64_PC16": "debug/elf",
+ "elf.R_X86_64_PC32": "debug/elf",
+ "elf.R_X86_64_PC8": "debug/elf",
+ "elf.R_X86_64_PLT32": "debug/elf",
+ "elf.R_X86_64_RELATIVE": "debug/elf",
+ "elf.R_X86_64_TLSGD": "debug/elf",
+ "elf.R_X86_64_TLSLD": "debug/elf",
+ "elf.R_X86_64_TPOFF32": "debug/elf",
+ "elf.R_X86_64_TPOFF64": "debug/elf",
+ "elf.Rel32": "debug/elf",
+ "elf.Rel64": "debug/elf",
+ "elf.Rela32": "debug/elf",
+ "elf.Rela64": "debug/elf",
+ "elf.SHF_ALLOC": "debug/elf",
+ "elf.SHF_EXECINSTR": "debug/elf",
+ "elf.SHF_GROUP": "debug/elf",
+ "elf.SHF_INFO_LINK": "debug/elf",
+ "elf.SHF_LINK_ORDER": "debug/elf",
+ "elf.SHF_MASKOS": "debug/elf",
+ "elf.SHF_MASKPROC": "debug/elf",
+ "elf.SHF_MERGE": "debug/elf",
+ "elf.SHF_OS_NONCONFORMING": "debug/elf",
+ "elf.SHF_STRINGS": "debug/elf",
+ "elf.SHF_TLS": "debug/elf",
+ "elf.SHF_WRITE": "debug/elf",
+ "elf.SHN_ABS": "debug/elf",
+ "elf.SHN_COMMON": "debug/elf",
+ "elf.SHN_HIOS": "debug/elf",
+ "elf.SHN_HIPROC": "debug/elf",
+ "elf.SHN_HIRESERVE": "debug/elf",
+ "elf.SHN_LOOS": "debug/elf",
+ "elf.SHN_LOPROC": "debug/elf",
+ "elf.SHN_LORESERVE": "debug/elf",
+ "elf.SHN_UNDEF": "debug/elf",
+ "elf.SHN_XINDEX": "debug/elf",
+ "elf.SHT_DYNAMIC": "debug/elf",
+ "elf.SHT_DYNSYM": "debug/elf",
+ "elf.SHT_FINI_ARRAY": "debug/elf",
+ "elf.SHT_GNU_ATTRIBUTES": "debug/elf",
+ "elf.SHT_GNU_HASH": "debug/elf",
+ "elf.SHT_GNU_LIBLIST": "debug/elf",
+ "elf.SHT_GNU_VERDEF": "debug/elf",
+ "elf.SHT_GNU_VERNEED": "debug/elf",
+ "elf.SHT_GNU_VERSYM": "debug/elf",
+ "elf.SHT_GROUP": "debug/elf",
+ "elf.SHT_HASH": "debug/elf",
+ "elf.SHT_HIOS": "debug/elf",
+ "elf.SHT_HIPROC": "debug/elf",
+ "elf.SHT_HIUSER": "debug/elf",
+ "elf.SHT_INIT_ARRAY": "debug/elf",
+ "elf.SHT_LOOS": "debug/elf",
+ "elf.SHT_LOPROC": "debug/elf",
+ "elf.SHT_LOUSER": "debug/elf",
+ "elf.SHT_NOBITS": "debug/elf",
+ "elf.SHT_NOTE": "debug/elf",
+ "elf.SHT_NULL": "debug/elf",
+ "elf.SHT_PREINIT_ARRAY": "debug/elf",
+ "elf.SHT_PROGBITS": "debug/elf",
+ "elf.SHT_REL": "debug/elf",
+ "elf.SHT_RELA": "debug/elf",
+ "elf.SHT_SHLIB": "debug/elf",
+ "elf.SHT_STRTAB": "debug/elf",
+ "elf.SHT_SYMTAB": "debug/elf",
+ "elf.SHT_SYMTAB_SHNDX": "debug/elf",
+ "elf.STB_GLOBAL": "debug/elf",
+ "elf.STB_HIOS": "debug/elf",
+ "elf.STB_HIPROC": "debug/elf",
+ "elf.STB_LOCAL": "debug/elf",
+ "elf.STB_LOOS": "debug/elf",
+ "elf.STB_LOPROC": "debug/elf",
+ "elf.STB_WEAK": "debug/elf",
+ "elf.STT_COMMON": "debug/elf",
+ "elf.STT_FILE": "debug/elf",
+ "elf.STT_FUNC": "debug/elf",
+ "elf.STT_HIOS": "debug/elf",
+ "elf.STT_HIPROC": "debug/elf",
+ "elf.STT_LOOS": "debug/elf",
+ "elf.STT_LOPROC": "debug/elf",
+ "elf.STT_NOTYPE": "debug/elf",
+ "elf.STT_OBJECT": "debug/elf",
+ "elf.STT_SECTION": "debug/elf",
+ "elf.STT_TLS": "debug/elf",
+ "elf.STV_DEFAULT": "debug/elf",
+ "elf.STV_HIDDEN": "debug/elf",
+ "elf.STV_INTERNAL": "debug/elf",
+ "elf.STV_PROTECTED": "debug/elf",
+ "elf.ST_BIND": "debug/elf",
+ "elf.ST_INFO": "debug/elf",
+ "elf.ST_TYPE": "debug/elf",
+ "elf.ST_VISIBILITY": "debug/elf",
+ "elf.Section": "debug/elf",
+ "elf.Section32": "debug/elf",
+ "elf.Section64": "debug/elf",
+ "elf.SectionFlag": "debug/elf",
+ "elf.SectionHeader": "debug/elf",
+ "elf.SectionIndex": "debug/elf",
+ "elf.SectionType": "debug/elf",
+ "elf.Sym32": "debug/elf",
+ "elf.Sym32Size": "debug/elf",
+ "elf.Sym64": "debug/elf",
+ "elf.Sym64Size": "debug/elf",
+ "elf.SymBind": "debug/elf",
+ "elf.SymType": "debug/elf",
+ "elf.SymVis": "debug/elf",
+ "elf.Symbol": "debug/elf",
+ "elf.Type": "debug/elf",
+ "elf.Version": "debug/elf",
+ "elliptic.Curve": "crypto/elliptic",
+ "elliptic.CurveParams": "crypto/elliptic",
+ "elliptic.GenerateKey": "crypto/elliptic",
+ "elliptic.Marshal": "crypto/elliptic",
+ "elliptic.P224": "crypto/elliptic",
+ "elliptic.P256": "crypto/elliptic",
+ "elliptic.P384": "crypto/elliptic",
+ "elliptic.P521": "crypto/elliptic",
+ "elliptic.Unmarshal": "crypto/elliptic",
+ "encoding.BinaryMarshaler": "encoding",
+ "encoding.BinaryUnmarshaler": "encoding",
+ "encoding.TextMarshaler": "encoding",
+ "encoding.TextUnmarshaler": "encoding",
+ "errors.New": "errors",
+ "exec.Cmd": "os/exec",
+ "exec.Command": "os/exec",
+ "exec.ErrNotFound": "os/exec",
+ "exec.Error": "os/exec",
+ "exec.ExitError": "os/exec",
+ "exec.LookPath": "os/exec",
+ "expvar.Do": "expvar",
+ "expvar.Float": "expvar",
+ "expvar.Func": "expvar",
+ "expvar.Get": "expvar",
+ "expvar.Int": "expvar",
+ "expvar.KeyValue": "expvar",
+ "expvar.Map": "expvar",
+ "expvar.NewFloat": "expvar",
+ "expvar.NewInt": "expvar",
+ "expvar.NewMap": "expvar",
+ "expvar.NewString": "expvar",
+ "expvar.Publish": "expvar",
+ "expvar.String": "expvar",
+ "expvar.Var": "expvar",
+ "fcgi.Serve": "net/http/fcgi",
+ "filepath.Abs": "path/filepath",
+ "filepath.Base": "path/filepath",
+ "filepath.Clean": "path/filepath",
+ "filepath.Dir": "path/filepath",
+ "filepath.ErrBadPattern": "path/filepath",
+ "filepath.EvalSymlinks": "path/filepath",
+ "filepath.Ext": "path/filepath",
+ "filepath.FromSlash": "path/filepath",
+ "filepath.Glob": "path/filepath",
+ "filepath.HasPrefix": "path/filepath",
+ "filepath.IsAbs": "path/filepath",
+ "filepath.Join": "path/filepath",
+ "filepath.ListSeparator": "path/filepath",
+ "filepath.Match": "path/filepath",
+ "filepath.Rel": "path/filepath",
+ "filepath.Separator": "path/filepath",
+ "filepath.SkipDir": "path/filepath",
+ "filepath.Split": "path/filepath",
+ "filepath.SplitList": "path/filepath",
+ "filepath.ToSlash": "path/filepath",
+ "filepath.VolumeName": "path/filepath",
+ "filepath.Walk": "path/filepath",
+ "filepath.WalkFunc": "path/filepath",
+ "flag.Arg": "flag",
+ "flag.Args": "flag",
+ "flag.Bool": "flag",
+ "flag.BoolVar": "flag",
+ "flag.CommandLine": "flag",
+ "flag.ContinueOnError": "flag",
+ "flag.Duration": "flag",
+ "flag.DurationVar": "flag",
+ "flag.ErrHelp": "flag",
+ "flag.ErrorHandling": "flag",
+ "flag.ExitOnError": "flag",
+ "flag.Flag": "flag",
+ "flag.FlagSet": "flag",
+ "flag.Float64": "flag",
+ "flag.Float64Var": "flag",
+ "flag.Getter": "flag",
+ "flag.Int": "flag",
+ "flag.Int64": "flag",
+ "flag.Int64Var": "flag",
+ "flag.IntVar": "flag",
+ "flag.Lookup": "flag",
+ "flag.NArg": "flag",
+ "flag.NFlag": "flag",
+ "flag.NewFlagSet": "flag",
+ "flag.PanicOnError": "flag",
+ "flag.Parse": "flag",
+ "flag.Parsed": "flag",
+ "flag.PrintDefaults": "flag",
+ "flag.Set": "flag",
+ "flag.String": "flag",
+ "flag.StringVar": "flag",
+ "flag.Uint": "flag",
+ "flag.Uint64": "flag",
+ "flag.Uint64Var": "flag",
+ "flag.UintVar": "flag",
+ "flag.Usage": "flag",
+ "flag.Value": "flag",
+ "flag.Var": "flag",
+ "flag.Visit": "flag",
+ "flag.VisitAll": "flag",
+ "flate.BestCompression": "compress/flate",
+ "flate.BestSpeed": "compress/flate",
+ "flate.CorruptInputError": "compress/flate",
+ "flate.DefaultCompression": "compress/flate",
+ "flate.InternalError": "compress/flate",
+ "flate.NewReader": "compress/flate",
+ "flate.NewReaderDict": "compress/flate",
+ "flate.NewWriter": "compress/flate",
+ "flate.NewWriterDict": "compress/flate",
+ "flate.NoCompression": "compress/flate",
+ "flate.ReadError": "compress/flate",
+ "flate.Reader": "compress/flate",
+ "flate.WriteError": "compress/flate",
+ "flate.Writer": "compress/flate",
+ "fmt.Errorf": "fmt",
+ "fmt.Formatter": "fmt",
+ "fmt.Fprint": "fmt",
+ "fmt.Fprintf": "fmt",
+ "fmt.Fprintln": "fmt",
+ "fmt.Fscan": "fmt",
+ "fmt.Fscanf": "fmt",
+ "fmt.Fscanln": "fmt",
+ "fmt.GoStringer": "fmt",
+ "fmt.Print": "fmt",
+ "fmt.Printf": "fmt",
+ "fmt.Println": "fmt",
+ "fmt.Scan": "fmt",
+ "fmt.ScanState": "fmt",
+ "fmt.Scanf": "fmt",
+ "fmt.Scanln": "fmt",
+ "fmt.Scanner": "fmt",
+ "fmt.Sprint": "fmt",
+ "fmt.Sprintf": "fmt",
+ "fmt.Sprintln": "fmt",
+ "fmt.Sscan": "fmt",
+ "fmt.Sscanf": "fmt",
+ "fmt.Sscanln": "fmt",
+ "fmt.State": "fmt",
+ "fmt.Stringer": "fmt",
+ "fnv.New32": "hash/fnv",
+ "fnv.New32a": "hash/fnv",
+ "fnv.New64": "hash/fnv",
+ "fnv.New64a": "hash/fnv",
+ "format.Node": "go/format",
+ "format.Source": "go/format",
+ "gif.Decode": "image/gif",
+ "gif.DecodeAll": "image/gif",
+ "gif.DecodeConfig": "image/gif",
+ "gif.Encode": "image/gif",
+ "gif.EncodeAll": "image/gif",
+ "gif.GIF": "image/gif",
+ "gif.Options": "image/gif",
+ "gob.CommonType": "encoding/gob",
+ "gob.Decoder": "encoding/gob",
+ "gob.Encoder": "encoding/gob",
+ "gob.GobDecoder": "encoding/gob",
+ "gob.GobEncoder": "encoding/gob",
+ "gob.NewDecoder": "encoding/gob",
+ "gob.NewEncoder": "encoding/gob",
+ "gob.Register": "encoding/gob",
+ "gob.RegisterName": "encoding/gob",
+ "gosym.DecodingError": "debug/gosym",
+ "gosym.Func": "debug/gosym",
+ "gosym.LineTable": "debug/gosym",
+ "gosym.NewLineTable": "debug/gosym",
+ "gosym.NewTable": "debug/gosym",
+ "gosym.Obj": "debug/gosym",
+ "gosym.Sym": "debug/gosym",
+ "gosym.Table": "debug/gosym",
+ "gosym.UnknownFileError": "debug/gosym",
+ "gosym.UnknownLineError": "debug/gosym",
+ "gzip.BestCompression": "compress/gzip",
+ "gzip.BestSpeed": "compress/gzip",
+ "gzip.DefaultCompression": "compress/gzip",
+ "gzip.ErrChecksum": "compress/gzip",
+ "gzip.ErrHeader": "compress/gzip",
+ "gzip.Header": "compress/gzip",
+ "gzip.NewReader": "compress/gzip",
+ "gzip.NewWriter": "compress/gzip",
+ "gzip.NewWriterLevel": "compress/gzip",
+ "gzip.NoCompression": "compress/gzip",
+ "gzip.Reader": "compress/gzip",
+ "gzip.Writer": "compress/gzip",
+ "hash.Hash": "hash",
+ "hash.Hash32": "hash",
+ "hash.Hash64": "hash",
+ "heap.Fix": "container/heap",
+ "heap.Init": "container/heap",
+ "heap.Interface": "container/heap",
+ "heap.Pop": "container/heap",
+ "heap.Push": "container/heap",
+ "heap.Remove": "container/heap",
+ "hex.Decode": "encoding/hex",
+ "hex.DecodeString": "encoding/hex",
+ "hex.DecodedLen": "encoding/hex",
+ "hex.Dump": "encoding/hex",
+ "hex.Dumper": "encoding/hex",
+ "hex.Encode": "encoding/hex",
+ "hex.EncodeToString": "encoding/hex",
+ "hex.EncodedLen": "encoding/hex",
+ "hex.ErrLength": "encoding/hex",
+ "hex.InvalidByteError": "encoding/hex",
+ "hmac.Equal": "crypto/hmac",
+ "hmac.New": "crypto/hmac",
+ "html.EscapeString": "html",
+ "html.UnescapeString": "html",
+ "http.CanonicalHeaderKey": "net/http",
+ "http.Client": "net/http",
+ "http.CloseNotifier": "net/http",
+ "http.Cookie": "net/http",
+ "http.CookieJar": "net/http",
+ "http.DefaultClient": "net/http",
+ "http.DefaultMaxHeaderBytes": "net/http",
+ "http.DefaultMaxIdleConnsPerHost": "net/http",
+ "http.DefaultServeMux": "net/http",
+ "http.DefaultTransport": "net/http",
+ "http.DetectContentType": "net/http",
+ "http.Dir": "net/http",
+ "http.ErrBodyNotAllowed": "net/http",
+ "http.ErrBodyReadAfterClose": "net/http",
+ "http.ErrContentLength": "net/http",
+ "http.ErrHandlerTimeout": "net/http",
+ "http.ErrHeaderTooLong": "net/http",
+ "http.ErrHijacked": "net/http",
+ "http.ErrLineTooLong": "net/http",
+ "http.ErrMissingBoundary": "net/http",
+ "http.ErrMissingContentLength": "net/http",
+ "http.ErrMissingFile": "net/http",
+ "http.ErrNoCookie": "net/http",
+ "http.ErrNoLocation": "net/http",
+ "http.ErrNotMultipart": "net/http",
+ "http.ErrNotSupported": "net/http",
+ "http.ErrShortBody": "net/http",
+ "http.ErrUnexpectedTrailer": "net/http",
+ "http.ErrWriteAfterFlush": "net/http",
+ "http.Error": "net/http",
+ "http.File": "net/http",
+ "http.FileServer": "net/http",
+ "http.FileSystem": "net/http",
+ "http.Flusher": "net/http",
+ "http.Get": "net/http",
+ "http.Handle": "net/http",
+ "http.HandleFunc": "net/http",
+ "http.Handler": "net/http",
+ "http.HandlerFunc": "net/http",
+ "http.Head": "net/http",
+ "http.Header": "net/http",
+ "http.Hijacker": "net/http",
+ "http.ListenAndServe": "net/http",
+ "http.ListenAndServeTLS": "net/http",
+ "http.MaxBytesReader": "net/http",
+ "http.NewFileTransport": "net/http",
+ "http.NewRequest": "net/http",
+ "http.NewServeMux": "net/http",
+ "http.NotFound": "net/http",
+ "http.NotFoundHandler": "net/http",
+ "http.ParseHTTPVersion": "net/http",
+ "http.ParseTime": "net/http",
+ "http.Post": "net/http",
+ "http.PostForm": "net/http",
+ "http.ProtocolError": "net/http",
+ "http.ProxyFromEnvironment": "net/http",
+ "http.ProxyURL": "net/http",
+ "http.ReadRequest": "net/http",
+ "http.ReadResponse": "net/http",
+ "http.Redirect": "net/http",
+ "http.RedirectHandler": "net/http",
+ "http.Request": "net/http",
+ "http.Response": "net/http",
+ "http.ResponseWriter": "net/http",
+ "http.RoundTripper": "net/http",
+ "http.Serve": "net/http",
+ "http.ServeContent": "net/http",
+ "http.ServeFile": "net/http",
+ "http.ServeMux": "net/http",
+ "http.Server": "net/http",
+ "http.SetCookie": "net/http",
+ "http.StatusAccepted": "net/http",
+ "http.StatusBadGateway": "net/http",
+ "http.StatusBadRequest": "net/http",
+ "http.StatusConflict": "net/http",
+ "http.StatusContinue": "net/http",
+ "http.StatusCreated": "net/http",
+ "http.StatusExpectationFailed": "net/http",
+ "http.StatusForbidden": "net/http",
+ "http.StatusFound": "net/http",
+ "http.StatusGatewayTimeout": "net/http",
+ "http.StatusGone": "net/http",
+ "http.StatusHTTPVersionNotSupported": "net/http",
+ "http.StatusInternalServerError": "net/http",
+ "http.StatusLengthRequired": "net/http",
+ "http.StatusMethodNotAllowed": "net/http",
+ "http.StatusMovedPermanently": "net/http",
+ "http.StatusMultipleChoices": "net/http",
+ "http.StatusNoContent": "net/http",
+ "http.StatusNonAuthoritativeInfo": "net/http",
+ "http.StatusNotAcceptable": "net/http",
+ "http.StatusNotFound": "net/http",
+ "http.StatusNotImplemented": "net/http",
+ "http.StatusNotModified": "net/http",
+ "http.StatusOK": "net/http",
+ "http.StatusPartialContent": "net/http",
+ "http.StatusPaymentRequired": "net/http",
+ "http.StatusPreconditionFailed": "net/http",
+ "http.StatusProxyAuthRequired": "net/http",
+ "http.StatusRequestEntityTooLarge": "net/http",
+ "http.StatusRequestTimeout": "net/http",
+ "http.StatusRequestURITooLong": "net/http",
+ "http.StatusRequestedRangeNotSatisfiable": "net/http",
+ "http.StatusResetContent": "net/http",
+ "http.StatusSeeOther": "net/http",
+ "http.StatusServiceUnavailable": "net/http",
+ "http.StatusSwitchingProtocols": "net/http",
+ "http.StatusTeapot": "net/http",
+ "http.StatusTemporaryRedirect": "net/http",
+ "http.StatusText": "net/http",
+ "http.StatusUnauthorized": "net/http",
+ "http.StatusUnsupportedMediaType": "net/http",
+ "http.StatusUseProxy": "net/http",
+ "http.StripPrefix": "net/http",
+ "http.TimeFormat": "net/http",
+ "http.TimeoutHandler": "net/http",
+ "http.Transport": "net/http",
+ "httptest.DefaultRemoteAddr": "net/http/httptest",
+ "httptest.NewRecorder": "net/http/httptest",
+ "httptest.NewServer": "net/http/httptest",
+ "httptest.NewTLSServer": "net/http/httptest",
+ "httptest.NewUnstartedServer": "net/http/httptest",
+ "httptest.ResponseRecorder": "net/http/httptest",
+ "httptest.Server": "net/http/httptest",
+ "httputil.ClientConn": "net/http/httputil",
+ "httputil.DumpRequest": "net/http/httputil",
+ "httputil.DumpRequestOut": "net/http/httputil",
+ "httputil.DumpResponse": "net/http/httputil",
+ "httputil.ErrClosed": "net/http/httputil",
+ "httputil.ErrLineTooLong": "net/http/httputil",
+ "httputil.ErrPersistEOF": "net/http/httputil",
+ "httputil.ErrPipeline": "net/http/httputil",
+ "httputil.NewChunkedReader": "net/http/httputil",
+ "httputil.NewChunkedWriter": "net/http/httputil",
+ "httputil.NewClientConn": "net/http/httputil",
+ "httputil.NewProxyClientConn": "net/http/httputil",
+ "httputil.NewServerConn": "net/http/httputil",
+ "httputil.NewSingleHostReverseProxy": "net/http/httputil",
+ "httputil.ReverseProxy": "net/http/httputil",
+ "httputil.ServerConn": "net/http/httputil",
+ "image.Alpha": "image",
+ "image.Alpha16": "image",
+ "image.Black": "image",
+ "image.Config": "image",
+ "image.Decode": "image",
+ "image.DecodeConfig": "image",
+ "image.ErrFormat": "image",
+ "image.Gray": "image",
+ "image.Gray16": "image",
+ "image.Image": "image",
+ "image.NRGBA": "image",
+ "image.NRGBA64": "image",
+ "image.NewAlpha": "image",
+ "image.NewAlpha16": "image",
+ "image.NewGray": "image",
+ "image.NewGray16": "image",
+ "image.NewNRGBA": "image",
+ "image.NewNRGBA64": "image",
+ "image.NewPaletted": "image",
+ "image.NewRGBA": "image",
+ "image.NewRGBA64": "image",
+ "image.NewUniform": "image",
+ "image.NewYCbCr": "image",
+ "image.Opaque": "image",
+ "image.Paletted": "image",
+ "image.PalettedImage": "image",
+ "image.Point": "image",
+ "image.Pt": "image",
+ "image.RGBA": "image",
+ "image.RGBA64": "image",
+ "image.Rect": "image",
+ "image.Rectangle": "image",
+ "image.RegisterFormat": "image",
+ "image.Transparent": "image",
+ "image.Uniform": "image",
+ "image.White": "image",
+ "image.YCbCr": "image",
+ "image.YCbCrSubsampleRatio": "image",
+ "image.YCbCrSubsampleRatio420": "image",
+ "image.YCbCrSubsampleRatio422": "image",
+ "image.YCbCrSubsampleRatio440": "image",
+ "image.YCbCrSubsampleRatio444": "image",
+ "image.ZP": "image",
+ "image.ZR": "image",
+ "io.ByteReader": "io",
+ "io.ByteScanner": "io",
+ "io.ByteWriter": "io",
+ "io.Closer": "io",
+ "io.Copy": "io",
+ "io.CopyN": "io",
+ "io.EOF": "io",
+ "io.ErrClosedPipe": "io",
+ "io.ErrNoProgress": "io",
+ "io.ErrShortBuffer": "io",
+ "io.ErrShortWrite": "io",
+ "io.ErrUnexpectedEOF": "io",
+ "io.LimitReader": "io",
+ "io.LimitedReader": "io",
+ "io.MultiReader": "io",
+ "io.MultiWriter": "io",
+ "io.NewSectionReader": "io",
+ "io.Pipe": "io",
+ "io.PipeReader": "io",
+ "io.PipeWriter": "io",
+ "io.ReadAtLeast": "io",
+ "io.ReadCloser": "io",
+ "io.ReadFull": "io",
+ "io.ReadSeeker": "io",
+ "io.ReadWriteCloser": "io",
+ "io.ReadWriteSeeker": "io",
+ "io.ReadWriter": "io",
+ "io.Reader": "io",
+ "io.ReaderAt": "io",
+ "io.ReaderFrom": "io",
+ "io.RuneReader": "io",
+ "io.RuneScanner": "io",
+ "io.SectionReader": "io",
+ "io.Seeker": "io",
+ "io.TeeReader": "io",
+ "io.WriteCloser": "io",
+ "io.WriteSeeker": "io",
+ "io.WriteString": "io",
+ "io.Writer": "io",
+ "io.WriterAt": "io",
+ "io.WriterTo": "io",
+ "iotest.DataErrReader": "testing/iotest",
+ "iotest.ErrTimeout": "testing/iotest",
+ "iotest.HalfReader": "testing/iotest",
+ "iotest.NewReadLogger": "testing/iotest",
+ "iotest.NewWriteLogger": "testing/iotest",
+ "iotest.OneByteReader": "testing/iotest",
+ "iotest.TimeoutReader": "testing/iotest",
+ "iotest.TruncateWriter": "testing/iotest",
+ "ioutil.Discard": "io/ioutil",
+ "ioutil.NopCloser": "io/ioutil",
+ "ioutil.ReadAll": "io/ioutil",
+ "ioutil.ReadDir": "io/ioutil",
+ "ioutil.ReadFile": "io/ioutil",
+ "ioutil.TempDir": "io/ioutil",
+ "ioutil.TempFile": "io/ioutil",
+ "ioutil.WriteFile": "io/ioutil",
+ "jpeg.Decode": "image/jpeg",
+ "jpeg.DecodeConfig": "image/jpeg",
+ "jpeg.DefaultQuality": "image/jpeg",
+ "jpeg.Encode": "image/jpeg",
+ "jpeg.FormatError": "image/jpeg",
+ "jpeg.Options": "image/jpeg",
+ "jpeg.Reader": "image/jpeg",
+ "jpeg.UnsupportedError": "image/jpeg",
+ "json.Compact": "encoding/json",
+ "json.Decoder": "encoding/json",
+ "json.Encoder": "encoding/json",
+ "json.HTMLEscape": "encoding/json",
+ "json.Indent": "encoding/json",
+ "json.InvalidUTF8Error": "encoding/json",
+ "json.InvalidUnmarshalError": "encoding/json",
+ "json.Marshal": "encoding/json",
+ "json.MarshalIndent": "encoding/json",
+ "json.Marshaler": "encoding/json",
+ "json.MarshalerError": "encoding/json",
+ "json.NewDecoder": "encoding/json",
+ "json.NewEncoder": "encoding/json",
+ "json.Number": "encoding/json",
+ "json.RawMessage": "encoding/json",
+ "json.SyntaxError": "encoding/json",
+ "json.Unmarshal": "encoding/json",
+ "json.UnmarshalFieldError": "encoding/json",
+ "json.UnmarshalTypeError": "encoding/json",
+ "json.Unmarshaler": "encoding/json",
+ "json.UnsupportedTypeError": "encoding/json",
+ "json.UnsupportedValueError": "encoding/json",
+ "jsonrpc.Dial": "net/rpc/jsonrpc",
+ "jsonrpc.NewClient": "net/rpc/jsonrpc",
+ "jsonrpc.NewClientCodec": "net/rpc/jsonrpc",
+ "jsonrpc.NewServerCodec": "net/rpc/jsonrpc",
+ "jsonrpc.ServeConn": "net/rpc/jsonrpc",
+ "list.Element": "container/list",
+ "list.List": "container/list",
+ "list.New": "container/list",
+ "log.Fatal": "log",
+ "log.Fatalf": "log",
+ "log.Fatalln": "log",
+ "log.Flags": "log",
+ "log.Ldate": "log",
+ "log.Llongfile": "log",
+ "log.Lmicroseconds": "log",
+ "log.Logger": "log",
+ "log.Lshortfile": "log",
+ "log.LstdFlags": "log",
+ "log.Ltime": "log",
+ "log.New": "log",
+ "log.Panic": "log",
+ "log.Panicf": "log",
+ "log.Panicln": "log",
+ "log.Prefix": "log",
+ "log.Print": "log",
+ "log.Printf": "log",
+ "log.Println": "log",
+ "log.SetFlags": "log",
+ "log.SetOutput": "log",
+ "log.SetPrefix": "log",
+ "lzw.LSB": "compress/lzw",
+ "lzw.MSB": "compress/lzw",
+ "lzw.NewReader": "compress/lzw",
+ "lzw.NewWriter": "compress/lzw",
+ "lzw.Order": "compress/lzw",
+ "macho.Cpu": "debug/macho",
+ "macho.Cpu386": "debug/macho",
+ "macho.CpuAmd64": "debug/macho",
+ "macho.Dylib": "debug/macho",
+ "macho.DylibCmd": "debug/macho",
+ "macho.Dysymtab": "debug/macho",
+ "macho.DysymtabCmd": "debug/macho",
+ "macho.File": "debug/macho",
+ "macho.FileHeader": "debug/macho",
+ "macho.FormatError": "debug/macho",
+ "macho.Load": "debug/macho",
+ "macho.LoadBytes": "debug/macho",
+ "macho.LoadCmd": "debug/macho",
+ "macho.LoadCmdDylib": "debug/macho",
+ "macho.LoadCmdDylinker": "debug/macho",
+ "macho.LoadCmdDysymtab": "debug/macho",
+ "macho.LoadCmdSegment": "debug/macho",
+ "macho.LoadCmdSegment64": "debug/macho",
+ "macho.LoadCmdSymtab": "debug/macho",
+ "macho.LoadCmdThread": "debug/macho",
+ "macho.LoadCmdUnixThread": "debug/macho",
+ "macho.Magic32": "debug/macho",
+ "macho.Magic64": "debug/macho",
+ "macho.NewFile": "debug/macho",
+ "macho.Nlist32": "debug/macho",
+ "macho.Nlist64": "debug/macho",
+ "macho.Open": "debug/macho",
+ "macho.Regs386": "debug/macho",
+ "macho.RegsAMD64": "debug/macho",
+ "macho.Section": "debug/macho",
+ "macho.Section32": "debug/macho",
+ "macho.Section64": "debug/macho",
+ "macho.SectionHeader": "debug/macho",
+ "macho.Segment": "debug/macho",
+ "macho.Segment32": "debug/macho",
+ "macho.Segment64": "debug/macho",
+ "macho.SegmentHeader": "debug/macho",
+ "macho.Symbol": "debug/macho",
+ "macho.Symtab": "debug/macho",
+ "macho.SymtabCmd": "debug/macho",
+ "macho.Thread": "debug/macho",
+ "macho.Type": "debug/macho",
+ "macho.TypeExec": "debug/macho",
+ "macho.TypeObj": "debug/macho",
+ "mail.Address": "net/mail",
+ "mail.ErrHeaderNotPresent": "net/mail",
+ "mail.Header": "net/mail",
+ "mail.Message": "net/mail",
+ "mail.ParseAddress": "net/mail",
+ "mail.ParseAddressList": "net/mail",
+ "mail.ReadMessage": "net/mail",
+ "math.Abs": "math",
+ "math.Acos": "math",
+ "math.Acosh": "math",
+ "math.Asin": "math",
+ "math.Asinh": "math",
+ "math.Atan": "math",
+ "math.Atan2": "math",
+ "math.Atanh": "math",
+ "math.Cbrt": "math",
+ "math.Ceil": "math",
+ "math.Copysign": "math",
+ "math.Cos": "math",
+ "math.Cosh": "math",
+ "math.Dim": "math",
+ "math.E": "math",
+ "math.Erf": "math",
+ "math.Erfc": "math",
+ "math.Exp": "math",
+ "math.Exp2": "math",
+ "math.Expm1": "math",
+ "math.Float32bits": "math",
+ "math.Float32frombits": "math",
+ "math.Float64bits": "math",
+ "math.Float64frombits": "math",
+ "math.Floor": "math",
+ "math.Frexp": "math",
+ "math.Gamma": "math",
+ "math.Hypot": "math",
+ "math.Ilogb": "math",
+ "math.Inf": "math",
+ "math.IsInf": "math",
+ "math.IsNaN": "math",
+ "math.J0": "math",
+ "math.J1": "math",
+ "math.Jn": "math",
+ "math.Ldexp": "math",
+ "math.Lgamma": "math",
+ "math.Ln10": "math",
+ "math.Ln2": "math",
+ "math.Log": "math",
+ "math.Log10": "math",
+ "math.Log10E": "math",
+ "math.Log1p": "math",
+ "math.Log2": "math",
+ "math.Log2E": "math",
+ "math.Logb": "math",
+ "math.Max": "math",
+ "math.MaxFloat32": "math",
+ "math.MaxFloat64": "math",
+ "math.MaxInt16": "math",
+ "math.MaxInt32": "math",
+ "math.MaxInt64": "math",
+ "math.MaxInt8": "math",
+ "math.MaxUint16": "math",
+ "math.MaxUint32": "math",
+ "math.MaxUint64": "math",
+ "math.MaxUint8": "math",
+ "math.Min": "math",
+ "math.MinInt16": "math",
+ "math.MinInt32": "math",
+ "math.MinInt64": "math",
+ "math.MinInt8": "math",
+ "math.Mod": "math",
+ "math.Modf": "math",
+ "math.NaN": "math",
+ "math.Nextafter": "math",
+ "math.Phi": "math",
+ "math.Pi": "math",
+ "math.Pow": "math",
+ "math.Pow10": "math",
+ "math.Remainder": "math",
+ "math.Signbit": "math",
+ "math.Sin": "math",
+ "math.Sincos": "math",
+ "math.Sinh": "math",
+ "math.SmallestNonzeroFloat32": "math",
+ "math.SmallestNonzeroFloat64": "math",
+ "math.Sqrt": "math",
+ "math.Sqrt2": "math",
+ "math.SqrtE": "math",
+ "math.SqrtPhi": "math",
+ "math.SqrtPi": "math",
+ "math.Tan": "math",
+ "math.Tanh": "math",
+ "math.Trunc": "math",
+ "math.Y0": "math",
+ "math.Y1": "math",
+ "math.Yn": "math",
+ "md5.BlockSize": "crypto/md5",
+ "md5.New": "crypto/md5",
+ "md5.Size": "crypto/md5",
+ "md5.Sum": "crypto/md5",
+ "mime.AddExtensionType": "mime",
+ "mime.FormatMediaType": "mime",
+ "mime.ParseMediaType": "mime",
+ "mime.TypeByExtension": "mime",
+ "multipart.File": "mime/multipart",
+ "multipart.FileHeader": "mime/multipart",
+ "multipart.Form": "mime/multipart",
+ "multipart.NewReader": "mime/multipart",
+ "multipart.NewWriter": "mime/multipart",
+ "multipart.Part": "mime/multipart",
+ "multipart.Reader": "mime/multipart",
+ "multipart.Writer": "mime/multipart",
+ "net.Addr": "net",
+ "net.AddrError": "net",
+ "net.CIDRMask": "net",
+ "net.Conn": "net",
+ "net.DNSConfigError": "net",
+ "net.DNSError": "net",
+ "net.Dial": "net",
+ "net.DialIP": "net",
+ "net.DialTCP": "net",
+ "net.DialTimeout": "net",
+ "net.DialUDP": "net",
+ "net.DialUnix": "net",
+ "net.Dialer": "net",
+ "net.ErrWriteToConnected": "net",
+ "net.Error": "net",
+ "net.FileConn": "net",
+ "net.FileListener": "net",
+ "net.FilePacketConn": "net",
+ "net.FlagBroadcast": "net",
+ "net.FlagLoopback": "net",
+ "net.FlagMulticast": "net",
+ "net.FlagPointToPoint": "net",
+ "net.FlagUp": "net",
+ "net.Flags": "net",
+ "net.HardwareAddr": "net",
+ "net.IP": "net",
+ "net.IPAddr": "net",
+ "net.IPConn": "net",
+ "net.IPMask": "net",
+ "net.IPNet": "net",
+ "net.IPv4": "net",
+ "net.IPv4Mask": "net",
+ "net.IPv4allrouter": "net",
+ "net.IPv4allsys": "net",
+ "net.IPv4bcast": "net",
+ "net.IPv4len": "net",
+ "net.IPv4zero": "net",
+ "net.IPv6interfacelocalallnodes": "net",
+ "net.IPv6len": "net",
+ "net.IPv6linklocalallnodes": "net",
+ "net.IPv6linklocalallrouters": "net",
+ "net.IPv6loopback": "net",
+ "net.IPv6unspecified": "net",
+ "net.IPv6zero": "net",
+ "net.Interface": "net",
+ "net.InterfaceAddrs": "net",
+ "net.InterfaceByIndex": "net",
+ "net.InterfaceByName": "net",
+ "net.Interfaces": "net",
+ "net.InvalidAddrError": "net",
+ "net.JoinHostPort": "net",
+ "net.Listen": "net",
+ "net.ListenIP": "net",
+ "net.ListenMulticastUDP": "net",
+ "net.ListenPacket": "net",
+ "net.ListenTCP": "net",
+ "net.ListenUDP": "net",
+ "net.ListenUnix": "net",
+ "net.ListenUnixgram": "net",
+ "net.Listener": "net",
+ "net.LookupAddr": "net",
+ "net.LookupCNAME": "net",
+ "net.LookupHost": "net",
+ "net.LookupIP": "net",
+ "net.LookupMX": "net",
+ "net.LookupNS": "net",
+ "net.LookupPort": "net",
+ "net.LookupSRV": "net",
+ "net.LookupTXT": "net",
+ "net.MX": "net",
+ "net.NS": "net",
+ "net.OpError": "net",
+ "net.PacketConn": "net",
+ "net.ParseCIDR": "net",
+ "net.ParseError": "net",
+ "net.ParseIP": "net",
+ "net.ParseMAC": "net",
+ "net.Pipe": "net",
+ "net.ResolveIPAddr": "net",
+ "net.ResolveTCPAddr": "net",
+ "net.ResolveUDPAddr": "net",
+ "net.ResolveUnixAddr": "net",
+ "net.SRV": "net",
+ "net.SplitHostPort": "net",
+ "net.TCPAddr": "net",
+ "net.TCPConn": "net",
+ "net.TCPListener": "net",
+ "net.UDPAddr": "net",
+ "net.UDPConn": "net",
+ "net.UnixAddr": "net",
+ "net.UnixConn": "net",
+ "net.UnixListener": "net",
+ "net.UnknownNetworkError": "net",
+ "os.Args": "os",
+ "os.Chdir": "os",
+ "os.Chmod": "os",
+ "os.Chown": "os",
+ "os.Chtimes": "os",
+ "os.Clearenv": "os",
+ "os.Create": "os",
+ "os.DevNull": "os",
+ "os.Environ": "os",
+ "os.ErrExist": "os",
+ "os.ErrInvalid": "os",
+ "os.ErrNotExist": "os",
+ "os.ErrPermission": "os",
+ "os.Exit": "os",
+ "os.Expand": "os",
+ "os.ExpandEnv": "os",
+ "os.File": "os",
+ "os.FileInfo": "os",
+ "os.FileMode": "os",
+ "os.FindProcess": "os",
+ "os.Getegid": "os",
+ "os.Getenv": "os",
+ "os.Geteuid": "os",
+ "os.Getgid": "os",
+ "os.Getgroups": "os",
+ "os.Getpagesize": "os",
+ "os.Getpid": "os",
+ "os.Getppid": "os",
+ "os.Getuid": "os",
+ "os.Getwd": "os",
+ "os.Hostname": "os",
+ "os.Interrupt": "os",
+ "os.IsExist": "os",
+ "os.IsNotExist": "os",
+ "os.IsPathSeparator": "os",
+ "os.IsPermission": "os",
+ "os.Kill": "os",
+ "os.Lchown": "os",
+ "os.Link": "os",
+ "os.LinkError": "os",
+ "os.Lstat": "os",
+ "os.Mkdir": "os",
+ "os.MkdirAll": "os",
+ "os.ModeAppend": "os",
+ "os.ModeCharDevice": "os",
+ "os.ModeDevice": "os",
+ "os.ModeDir": "os",
+ "os.ModeExclusive": "os",
+ "os.ModeNamedPipe": "os",
+ "os.ModePerm": "os",
+ "os.ModeSetgid": "os",
+ "os.ModeSetuid": "os",
+ "os.ModeSocket": "os",
+ "os.ModeSticky": "os",
+ "os.ModeSymlink": "os",
+ "os.ModeTemporary": "os",
+ "os.ModeType": "os",
+ "os.NewFile": "os",
+ "os.NewSyscallError": "os",
+ "os.O_APPEND": "os",
+ "os.O_CREATE": "os",
+ "os.O_EXCL": "os",
+ "os.O_RDONLY": "os",
+ "os.O_RDWR": "os",
+ "os.O_SYNC": "os",
+ "os.O_TRUNC": "os",
+ "os.O_WRONLY": "os",
+ "os.Open": "os",
+ "os.OpenFile": "os",
+ "os.PathError": "os",
+ "os.PathListSeparator": "os",
+ "os.PathSeparator": "os",
+ "os.Pipe": "os",
+ "os.ProcAttr": "os",
+ "os.Process": "os",
+ "os.ProcessState": "os",
+ "os.Readlink": "os",
+ "os.Remove": "os",
+ "os.RemoveAll": "os",
+ "os.Rename": "os",
+ "os.SEEK_CUR": "os",
+ "os.SEEK_END": "os",
+ "os.SEEK_SET": "os",
+ "os.SameFile": "os",
+ "os.Setenv": "os",
+ "os.Signal": "os",
+ "os.StartProcess": "os",
+ "os.Stat": "os",
+ "os.Stderr": "os",
+ "os.Stdin": "os",
+ "os.Stdout": "os",
+ "os.Symlink": "os",
+ "os.SyscallError": "os",
+ "os.TempDir": "os",
+ "os.Truncate": "os",
+ "palette.Plan9": "image/color/palette",
+ "palette.WebSafe": "image/color/palette",
+ "parse.ActionNode": "text/template/parse",
+ "parse.BoolNode": "text/template/parse",
+ "parse.BranchNode": "text/template/parse",
+ "parse.ChainNode": "text/template/parse",
+ "parse.CommandNode": "text/template/parse",
+ "parse.DotNode": "text/template/parse",
+ "parse.FieldNode": "text/template/parse",
+ "parse.IdentifierNode": "text/template/parse",
+ "parse.IfNode": "text/template/parse",
+ "parse.IsEmptyTree": "text/template/parse",
+ "parse.ListNode": "text/template/parse",
+ "parse.New": "text/template/parse",
+ "parse.NewIdentifier": "text/template/parse",
+ "parse.NilNode": "text/template/parse",
+ "parse.Node": "text/template/parse",
+ "parse.NodeAction": "text/template/parse",
+ "parse.NodeBool": "text/template/parse",
+ "parse.NodeChain": "text/template/parse",
+ "parse.NodeCommand": "text/template/parse",
+ "parse.NodeDot": "text/template/parse",
+ "parse.NodeField": "text/template/parse",
+ "parse.NodeIdentifier": "text/template/parse",
+ "parse.NodeIf": "text/template/parse",
+ "parse.NodeList": "text/template/parse",
+ "parse.NodeNil": "text/template/parse",
+ "parse.NodeNumber": "text/template/parse",
+ "parse.NodePipe": "text/template/parse",
+ "parse.NodeRange": "text/template/parse",
+ "parse.NodeString": "text/template/parse",
+ "parse.NodeTemplate": "text/template/parse",
+ "parse.NodeText": "text/template/parse",
+ "parse.NodeType": "text/template/parse",
+ "parse.NodeVariable": "text/template/parse",
+ "parse.NodeWith": "text/template/parse",
+ "parse.NumberNode": "text/template/parse",
+ "parse.Parse": "text/template/parse",
+ "parse.PipeNode": "text/template/parse",
+ "parse.Pos": "text/template/parse",
+ "parse.RangeNode": "text/template/parse",
+ "parse.StringNode": "text/template/parse",
+ "parse.TemplateNode": "text/template/parse",
+ "parse.TextNode": "text/template/parse",
+ "parse.Tree": "text/template/parse",
+ "parse.VariableNode": "text/template/parse",
+ "parse.WithNode": "text/template/parse",
+ "parser.AllErrors": "go/parser",
+ "parser.DeclarationErrors": "go/parser",
+ "parser.ImportsOnly": "go/parser",
+ "parser.Mode": "go/parser",
+ "parser.PackageClauseOnly": "go/parser",
+ "parser.ParseComments": "go/parser",
+ "parser.ParseDir": "go/parser",
+ "parser.ParseExpr": "go/parser",
+ "parser.ParseFile": "go/parser",
+ "parser.SpuriousErrors": "go/parser",
+ "parser.Trace": "go/parser",
+ "path.Base": "path",
+ "path.Clean": "path",
+ "path.Dir": "path",
+ "path.ErrBadPattern": "path",
+ "path.Ext": "path",
+ "path.IsAbs": "path",
+ "path.Join": "path",
+ "path.Match": "path",
+ "path.Split": "path",
+ "pe.COFFSymbol": "debug/pe",
+ "pe.COFFSymbolSize": "debug/pe",
+ "pe.File": "debug/pe",
+ "pe.FileHeader": "debug/pe",
+ "pe.FormatError": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_AM33": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_AMD64": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_ARM": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_EBC": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_I386": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_IA64": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_M32R": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_MIPS16": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_MIPSFPU": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_MIPSFPU16": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_POWERPC": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_POWERPCFP": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_R4000": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_SH3": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_SH3DSP": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_SH4": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_SH5": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_THUMB": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_UNKNOWN": "debug/pe",
+ "pe.IMAGE_FILE_MACHINE_WCEMIPSV2": "debug/pe",
+ "pe.ImportDirectory": "debug/pe",
+ "pe.NewFile": "debug/pe",
+ "pe.Open": "debug/pe",
+ "pe.Section": "debug/pe",
+ "pe.SectionHeader": "debug/pe",
+ "pe.SectionHeader32": "debug/pe",
+ "pe.Symbol": "debug/pe",
+ "pem.Block": "encoding/pem",
+ "pem.Decode": "encoding/pem",
+ "pem.Encode": "encoding/pem",
+ "pem.EncodeToMemory": "encoding/pem",
+ "pkix.AlgorithmIdentifier": "crypto/x509/pkix",
+ "pkix.AttributeTypeAndValue": "crypto/x509/pkix",
+ "pkix.CertificateList": "crypto/x509/pkix",
+ "pkix.Extension": "crypto/x509/pkix",
+ "pkix.Name": "crypto/x509/pkix",
+ "pkix.RDNSequence": "crypto/x509/pkix",
+ "pkix.RelativeDistinguishedNameSET": "crypto/x509/pkix",
+ "pkix.RevokedCertificate": "crypto/x509/pkix",
+ "pkix.TBSCertificateList": "crypto/x509/pkix",
+ "png.Decode": "image/png",
+ "png.DecodeConfig": "image/png",
+ "png.Encode": "image/png",
+ "png.FormatError": "image/png",
+ "png.UnsupportedError": "image/png",
+ "pprof.Cmdline": "net/http/pprof",
+ "pprof.Handler": "net/http/pprof",
+ "pprof.Index": "net/http/pprof",
+ "pprof.Lookup": "runtime/pprof",
+ "pprof.NewProfile": "runtime/pprof",
+ // "pprof.Profile" is ambiguous
+ "pprof.Profiles": "runtime/pprof",
+ "pprof.StartCPUProfile": "runtime/pprof",
+ "pprof.StopCPUProfile": "runtime/pprof",
+ "pprof.Symbol": "net/http/pprof",
+ "pprof.WriteHeapProfile": "runtime/pprof",
+ "printer.CommentedNode": "go/printer",
+ "printer.Config": "go/printer",
+ "printer.Fprint": "go/printer",
+ "printer.Mode": "go/printer",
+ "printer.RawFormat": "go/printer",
+ "printer.SourcePos": "go/printer",
+ "printer.TabIndent": "go/printer",
+ "printer.UseSpaces": "go/printer",
+ "quick.Check": "testing/quick",
+ "quick.CheckEqual": "testing/quick",
+ "quick.CheckEqualError": "testing/quick",
+ "quick.CheckError": "testing/quick",
+ "quick.Config": "testing/quick",
+ "quick.Generator": "testing/quick",
+ "quick.SetupError": "testing/quick",
+ "quick.Value": "testing/quick",
+ "rand.ExpFloat64": "math/rand",
+ "rand.Float32": "math/rand",
+ "rand.Float64": "math/rand",
+ // "rand.Int" is ambiguous
+ "rand.Int31": "math/rand",
+ "rand.Int31n": "math/rand",
+ "rand.Int63": "math/rand",
+ "rand.Int63n": "math/rand",
+ "rand.Intn": "math/rand",
+ "rand.New": "math/rand",
+ "rand.NewSource": "math/rand",
+ "rand.NewZipf": "math/rand",
+ "rand.NormFloat64": "math/rand",
+ "rand.Perm": "math/rand",
+ "rand.Prime": "crypto/rand",
+ "rand.Rand": "math/rand",
+ "rand.Read": "crypto/rand",
+ "rand.Reader": "crypto/rand",
+ "rand.Seed": "math/rand",
+ "rand.Source": "math/rand",
+ "rand.Uint32": "math/rand",
+ "rand.Zipf": "math/rand",
+ "rc4.Cipher": "crypto/rc4",
+ "rc4.KeySizeError": "crypto/rc4",
+ "rc4.NewCipher": "crypto/rc4",
+ "reflect.Append": "reflect",
+ "reflect.AppendSlice": "reflect",
+ "reflect.Array": "reflect",
+ "reflect.Bool": "reflect",
+ "reflect.BothDir": "reflect",
+ "reflect.Chan": "reflect",
+ "reflect.ChanDir": "reflect",
+ "reflect.ChanOf": "reflect",
+ "reflect.Complex128": "reflect",
+ "reflect.Complex64": "reflect",
+ "reflect.Copy": "reflect",
+ "reflect.DeepEqual": "reflect",
+ "reflect.Float32": "reflect",
+ "reflect.Float64": "reflect",
+ "reflect.Func": "reflect",
+ "reflect.Indirect": "reflect",
+ "reflect.Int": "reflect",
+ "reflect.Int16": "reflect",
+ "reflect.Int32": "reflect",
+ "reflect.Int64": "reflect",
+ "reflect.Int8": "reflect",
+ "reflect.Interface": "reflect",
+ "reflect.Invalid": "reflect",
+ "reflect.Kind": "reflect",
+ "reflect.MakeChan": "reflect",
+ "reflect.MakeFunc": "reflect",
+ "reflect.MakeMap": "reflect",
+ "reflect.MakeSlice": "reflect",
+ "reflect.Map": "reflect",
+ "reflect.MapOf": "reflect",
+ "reflect.Method": "reflect",
+ "reflect.New": "reflect",
+ "reflect.NewAt": "reflect",
+ "reflect.Ptr": "reflect",
+ "reflect.PtrTo": "reflect",
+ "reflect.RecvDir": "reflect",
+ "reflect.Select": "reflect",
+ "reflect.SelectCase": "reflect",
+ "reflect.SelectDefault": "reflect",
+ "reflect.SelectDir": "reflect",
+ "reflect.SelectRecv": "reflect",
+ "reflect.SelectSend": "reflect",
+ "reflect.SendDir": "reflect",
+ "reflect.Slice": "reflect",
+ "reflect.SliceHeader": "reflect",
+ "reflect.SliceOf": "reflect",
+ "reflect.String": "reflect",
+ "reflect.StringHeader": "reflect",
+ "reflect.Struct": "reflect",
+ "reflect.StructField": "reflect",
+ "reflect.StructTag": "reflect",
+ "reflect.TypeOf": "reflect",
+ "reflect.Uint": "reflect",
+ "reflect.Uint16": "reflect",
+ "reflect.Uint32": "reflect",
+ "reflect.Uint64": "reflect",
+ "reflect.Uint8": "reflect",
+ "reflect.Uintptr": "reflect",
+ "reflect.UnsafePointer": "reflect",
+ "reflect.Value": "reflect",
+ "reflect.ValueError": "reflect",
+ "reflect.ValueOf": "reflect",
+ "reflect.Zero": "reflect",
+ "regexp.Compile": "regexp",
+ "regexp.CompilePOSIX": "regexp",
+ "regexp.Match": "regexp",
+ "regexp.MatchReader": "regexp",
+ "regexp.MatchString": "regexp",
+ "regexp.MustCompile": "regexp",
+ "regexp.MustCompilePOSIX": "regexp",
+ "regexp.QuoteMeta": "regexp",
+ "regexp.Regexp": "regexp",
+ "ring.New": "container/ring",
+ "ring.Ring": "container/ring",
+ "rpc.Accept": "net/rpc",
+ "rpc.Call": "net/rpc",
+ "rpc.Client": "net/rpc",
+ "rpc.ClientCodec": "net/rpc",
+ "rpc.DefaultDebugPath": "net/rpc",
+ "rpc.DefaultRPCPath": "net/rpc",
+ "rpc.DefaultServer": "net/rpc",
+ "rpc.Dial": "net/rpc",
+ "rpc.DialHTTP": "net/rpc",
+ "rpc.DialHTTPPath": "net/rpc",
+ "rpc.ErrShutdown": "net/rpc",
+ "rpc.HandleHTTP": "net/rpc",
+ "rpc.NewClient": "net/rpc",
+ "rpc.NewClientWithCodec": "net/rpc",
+ "rpc.NewServer": "net/rpc",
+ "rpc.Register": "net/rpc",
+ "rpc.RegisterName": "net/rpc",
+ "rpc.Request": "net/rpc",
+ "rpc.Response": "net/rpc",
+ "rpc.ServeCodec": "net/rpc",
+ "rpc.ServeConn": "net/rpc",
+ "rpc.ServeRequest": "net/rpc",
+ "rpc.Server": "net/rpc",
+ "rpc.ServerCodec": "net/rpc",
+ "rpc.ServerError": "net/rpc",
+ "rsa.CRTValue": "crypto/rsa",
+ "rsa.DecryptOAEP": "crypto/rsa",
+ "rsa.DecryptPKCS1v15": "crypto/rsa",
+ "rsa.DecryptPKCS1v15SessionKey": "crypto/rsa",
+ "rsa.EncryptOAEP": "crypto/rsa",
+ "rsa.EncryptPKCS1v15": "crypto/rsa",
+ "rsa.ErrDecryption": "crypto/rsa",
+ "rsa.ErrMessageTooLong": "crypto/rsa",
+ "rsa.ErrVerification": "crypto/rsa",
+ "rsa.GenerateKey": "crypto/rsa",
+ "rsa.GenerateMultiPrimeKey": "crypto/rsa",
+ "rsa.PSSOptions": "crypto/rsa",
+ "rsa.PSSSaltLengthAuto": "crypto/rsa",
+ "rsa.PSSSaltLengthEqualsHash": "crypto/rsa",
+ "rsa.PrecomputedValues": "crypto/rsa",
+ "rsa.PrivateKey": "crypto/rsa",
+ "rsa.PublicKey": "crypto/rsa",
+ "rsa.SignPKCS1v15": "crypto/rsa",
+ "rsa.SignPSS": "crypto/rsa",
+ "rsa.VerifyPKCS1v15": "crypto/rsa",
+ "rsa.VerifyPSS": "crypto/rsa",
+ "runtime.BlockProfile": "runtime",
+ "runtime.BlockProfileRecord": "runtime",
+ "runtime.Breakpoint": "runtime",
+ "runtime.CPUProfile": "runtime",
+ "runtime.Caller": "runtime",
+ "runtime.Callers": "runtime",
+ "runtime.Compiler": "runtime",
+ "runtime.Error": "runtime",
+ "runtime.Func": "runtime",
+ "runtime.FuncForPC": "runtime",
+ "runtime.GC": "runtime",
+ "runtime.GOARCH": "runtime",
+ "runtime.GOMAXPROCS": "runtime",
+ "runtime.GOOS": "runtime",
+ "runtime.GOROOT": "runtime",
+ "runtime.Goexit": "runtime",
+ "runtime.GoroutineProfile": "runtime",
+ "runtime.Gosched": "runtime",
+ "runtime.LockOSThread": "runtime",
+ "runtime.MemProfile": "runtime",
+ "runtime.MemProfileRate": "runtime",
+ "runtime.MemProfileRecord": "runtime",
+ "runtime.MemStats": "runtime",
+ "runtime.NumCPU": "runtime",
+ "runtime.NumCgoCall": "runtime",
+ "runtime.NumGoroutine": "runtime",
+ "runtime.ReadMemStats": "runtime",
+ "runtime.SetBlockProfileRate": "runtime",
+ "runtime.SetCPUProfileRate": "runtime",
+ "runtime.SetFinalizer": "runtime",
+ "runtime.Stack": "runtime",
+ "runtime.StackRecord": "runtime",
+ "runtime.ThreadCreateProfile": "runtime",
+ "runtime.TypeAssertionError": "runtime",
+ "runtime.UnlockOSThread": "runtime",
+ "runtime.Version": "runtime",
+ "scanner.Char": "text/scanner",
+ "scanner.Comment": "text/scanner",
+ "scanner.EOF": "text/scanner",
+ "scanner.Error": "go/scanner",
+ "scanner.ErrorHandler": "go/scanner",
+ "scanner.ErrorList": "go/scanner",
+ "scanner.Float": "text/scanner",
+ "scanner.GoTokens": "text/scanner",
+ "scanner.GoWhitespace": "text/scanner",
+ "scanner.Ident": "text/scanner",
+ "scanner.Int": "text/scanner",
+ "scanner.Mode": "go/scanner",
+ "scanner.Position": "text/scanner",
+ "scanner.PrintError": "go/scanner",
+ "scanner.RawString": "text/scanner",
+ "scanner.ScanChars": "text/scanner",
+ // "scanner.ScanComments" is ambiguous
+ "scanner.ScanFloats": "text/scanner",
+ "scanner.ScanIdents": "text/scanner",
+ "scanner.ScanInts": "text/scanner",
+ "scanner.ScanRawStrings": "text/scanner",
+ "scanner.ScanStrings": "text/scanner",
+ // "scanner.Scanner" is ambiguous
+ "scanner.SkipComments": "text/scanner",
+ "scanner.String": "text/scanner",
+ "scanner.TokenString": "text/scanner",
+ "sha1.BlockSize": "crypto/sha1",
+ "sha1.New": "crypto/sha1",
+ "sha1.Size": "crypto/sha1",
+ "sha1.Sum": "crypto/sha1",
+ "sha256.BlockSize": "crypto/sha256",
+ "sha256.New": "crypto/sha256",
+ "sha256.New224": "crypto/sha256",
+ "sha256.Size": "crypto/sha256",
+ "sha256.Size224": "crypto/sha256",
+ "sha256.Sum224": "crypto/sha256",
+ "sha256.Sum256": "crypto/sha256",
+ "sha512.BlockSize": "crypto/sha512",
+ "sha512.New": "crypto/sha512",
+ "sha512.New384": "crypto/sha512",
+ "sha512.Size": "crypto/sha512",
+ "sha512.Size384": "crypto/sha512",
+ "sha512.Sum384": "crypto/sha512",
+ "sha512.Sum512": "crypto/sha512",
+ "signal.Notify": "os/signal",
+ "signal.Stop": "os/signal",
+ "smtp.Auth": "net/smtp",
+ "smtp.CRAMMD5Auth": "net/smtp",
+ "smtp.Client": "net/smtp",
+ "smtp.Dial": "net/smtp",
+ "smtp.NewClient": "net/smtp",
+ "smtp.PlainAuth": "net/smtp",
+ "smtp.SendMail": "net/smtp",
+ "smtp.ServerInfo": "net/smtp",
+ "sort.Float64Slice": "sort",
+ "sort.Float64s": "sort",
+ "sort.Float64sAreSorted": "sort",
+ "sort.IntSlice": "sort",
+ "sort.Interface": "sort",
+ "sort.Ints": "sort",
+ "sort.IntsAreSorted": "sort",
+ "sort.IsSorted": "sort",
+ "sort.Reverse": "sort",
+ "sort.Search": "sort",
+ "sort.SearchFloat64s": "sort",
+ "sort.SearchInts": "sort",
+ "sort.SearchStrings": "sort",
+ "sort.Sort": "sort",
+ "sort.Stable": "sort",
+ "sort.StringSlice": "sort",
+ "sort.Strings": "sort",
+ "sort.StringsAreSorted": "sort",
+ "sql.DB": "database/sql",
+ "sql.ErrNoRows": "database/sql",
+ "sql.ErrTxDone": "database/sql",
+ "sql.NullBool": "database/sql",
+ "sql.NullFloat64": "database/sql",
+ "sql.NullInt64": "database/sql",
+ "sql.NullString": "database/sql",
+ "sql.Open": "database/sql",
+ "sql.RawBytes": "database/sql",
+ "sql.Register": "database/sql",
+ "sql.Result": "database/sql",
+ "sql.Row": "database/sql",
+ "sql.Rows": "database/sql",
+ "sql.Scanner": "database/sql",
+ "sql.Stmt": "database/sql",
+ "sql.Tx": "database/sql",
+ "strconv.AppendBool": "strconv",
+ "strconv.AppendFloat": "strconv",
+ "strconv.AppendInt": "strconv",
+ "strconv.AppendQuote": "strconv",
+ "strconv.AppendQuoteRune": "strconv",
+ "strconv.AppendQuoteRuneToASCII": "strconv",
+ "strconv.AppendQuoteToASCII": "strconv",
+ "strconv.AppendUint": "strconv",
+ "strconv.Atoi": "strconv",
+ "strconv.CanBackquote": "strconv",
+ "strconv.ErrRange": "strconv",
+ "strconv.ErrSyntax": "strconv",
+ "strconv.FormatBool": "strconv",
+ "strconv.FormatFloat": "strconv",
+ "strconv.FormatInt": "strconv",
+ "strconv.FormatUint": "strconv",
+ "strconv.IntSize": "strconv",
+ "strconv.IsPrint": "strconv",
+ "strconv.Itoa": "strconv",
+ "strconv.NumError": "strconv",
+ "strconv.ParseBool": "strconv",
+ "strconv.ParseFloat": "strconv",
+ "strconv.ParseInt": "strconv",
+ "strconv.ParseUint": "strconv",
+ "strconv.Quote": "strconv",
+ "strconv.QuoteRune": "strconv",
+ "strconv.QuoteRuneToASCII": "strconv",
+ "strconv.QuoteToASCII": "strconv",
+ "strconv.Unquote": "strconv",
+ "strconv.UnquoteChar": "strconv",
+ "strings.Contains": "strings",
+ "strings.ContainsAny": "strings",
+ "strings.ContainsRune": "strings",
+ "strings.Count": "strings",
+ "strings.EqualFold": "strings",
+ "strings.Fields": "strings",
+ "strings.FieldsFunc": "strings",
+ "strings.HasPrefix": "strings",
+ "strings.HasSuffix": "strings",
+ "strings.Index": "strings",
+ "strings.IndexAny": "strings",
+ "strings.IndexByte": "strings",
+ "strings.IndexFunc": "strings",
+ "strings.IndexRune": "strings",
+ "strings.Join": "strings",
+ "strings.LastIndex": "strings",
+ "strings.LastIndexAny": "strings",
+ "strings.LastIndexFunc": "strings",
+ "strings.Map": "strings",
+ "strings.NewReader": "strings",
+ "strings.NewReplacer": "strings",
+ "strings.Reader": "strings",
+ "strings.Repeat": "strings",
+ "strings.Replace": "strings",
+ "strings.Replacer": "strings",
+ "strings.Split": "strings",
+ "strings.SplitAfter": "strings",
+ "strings.SplitAfterN": "strings",
+ "strings.SplitN": "strings",
+ "strings.Title": "strings",
+ "strings.ToLower": "strings",
+ "strings.ToLowerSpecial": "strings",
+ "strings.ToTitle": "strings",
+ "strings.ToTitleSpecial": "strings",
+ "strings.ToUpper": "strings",
+ "strings.ToUpperSpecial": "strings",
+ "strings.Trim": "strings",
+ "strings.TrimFunc": "strings",
+ "strings.TrimLeft": "strings",
+ "strings.TrimLeftFunc": "strings",
+ "strings.TrimPrefix": "strings",
+ "strings.TrimRight": "strings",
+ "strings.TrimRightFunc": "strings",
+ "strings.TrimSpace": "strings",
+ "strings.TrimSuffix": "strings",
+ "subtle.ConstantTimeByteEq": "crypto/subtle",
+ "subtle.ConstantTimeCompare": "crypto/subtle",
+ "subtle.ConstantTimeCopy": "crypto/subtle",
+ "subtle.ConstantTimeEq": "crypto/subtle",
+ "subtle.ConstantTimeLessOrEq": "crypto/subtle",
+ "subtle.ConstantTimeSelect": "crypto/subtle",
+ "suffixarray.Index": "index/suffixarray",
+ "suffixarray.New": "index/suffixarray",
+ "sync.Cond": "sync",
+ "sync.Locker": "sync",
+ "sync.Mutex": "sync",
+ "sync.NewCond": "sync",
+ "sync.Once": "sync",
+ "sync.RWMutex": "sync",
+ "sync.WaitGroup": "sync",
+ "syntax.ClassNL": "regexp/syntax",
+ "syntax.Compile": "regexp/syntax",
+ "syntax.DotNL": "regexp/syntax",
+ "syntax.EmptyBeginLine": "regexp/syntax",
+ "syntax.EmptyBeginText": "regexp/syntax",
+ "syntax.EmptyEndLine": "regexp/syntax",
+ "syntax.EmptyEndText": "regexp/syntax",
+ "syntax.EmptyNoWordBoundary": "regexp/syntax",
+ "syntax.EmptyOp": "regexp/syntax",
+ "syntax.EmptyOpContext": "regexp/syntax",
+ "syntax.EmptyWordBoundary": "regexp/syntax",
+ "syntax.ErrInternalError": "regexp/syntax",
+ "syntax.ErrInvalidCharClass": "regexp/syntax",
+ "syntax.ErrInvalidCharRange": "regexp/syntax",
+ "syntax.ErrInvalidEscape": "regexp/syntax",
+ "syntax.ErrInvalidNamedCapture": "regexp/syntax",
+ "syntax.ErrInvalidPerlOp": "regexp/syntax",
+ "syntax.ErrInvalidRepeatOp": "regexp/syntax",
+ "syntax.ErrInvalidRepeatSize": "regexp/syntax",
+ "syntax.ErrInvalidUTF8": "regexp/syntax",
+ "syntax.ErrMissingBracket": "regexp/syntax",
+ "syntax.ErrMissingParen": "regexp/syntax",
+ "syntax.ErrMissingRepeatArgument": "regexp/syntax",
+ "syntax.ErrTrailingBackslash": "regexp/syntax",
+ "syntax.ErrUnexpectedParen": "regexp/syntax",
+ "syntax.Error": "regexp/syntax",
+ "syntax.ErrorCode": "regexp/syntax",
+ "syntax.Flags": "regexp/syntax",
+ "syntax.FoldCase": "regexp/syntax",
+ "syntax.Inst": "regexp/syntax",
+ "syntax.InstAlt": "regexp/syntax",
+ "syntax.InstAltMatch": "regexp/syntax",
+ "syntax.InstCapture": "regexp/syntax",
+ "syntax.InstEmptyWidth": "regexp/syntax",
+ "syntax.InstFail": "regexp/syntax",
+ "syntax.InstMatch": "regexp/syntax",
+ "syntax.InstNop": "regexp/syntax",
+ "syntax.InstOp": "regexp/syntax",
+ "syntax.InstRune": "regexp/syntax",
+ "syntax.InstRune1": "regexp/syntax",
+ "syntax.InstRuneAny": "regexp/syntax",
+ "syntax.InstRuneAnyNotNL": "regexp/syntax",
+ "syntax.IsWordChar": "regexp/syntax",
+ "syntax.Literal": "regexp/syntax",
+ "syntax.MatchNL": "regexp/syntax",
+ "syntax.NonGreedy": "regexp/syntax",
+ "syntax.OneLine": "regexp/syntax",
+ "syntax.Op": "regexp/syntax",
+ "syntax.OpAlternate": "regexp/syntax",
+ "syntax.OpAnyChar": "regexp/syntax",
+ "syntax.OpAnyCharNotNL": "regexp/syntax",
+ "syntax.OpBeginLine": "regexp/syntax",
+ "syntax.OpBeginText": "regexp/syntax",
+ "syntax.OpCapture": "regexp/syntax",
+ "syntax.OpCharClass": "regexp/syntax",
+ "syntax.OpConcat": "regexp/syntax",
+ "syntax.OpEmptyMatch": "regexp/syntax",
+ "syntax.OpEndLine": "regexp/syntax",
+ "syntax.OpEndText": "regexp/syntax",
+ "syntax.OpLiteral": "regexp/syntax",
+ "syntax.OpNoMatch": "regexp/syntax",
+ "syntax.OpNoWordBoundary": "regexp/syntax",
+ "syntax.OpPlus": "regexp/syntax",
+ "syntax.OpQuest": "regexp/syntax",
+ "syntax.OpRepeat": "regexp/syntax",
+ "syntax.OpStar": "regexp/syntax",
+ "syntax.OpWordBoundary": "regexp/syntax",
+ "syntax.POSIX": "regexp/syntax",
+ "syntax.Parse": "regexp/syntax",
+ "syntax.Perl": "regexp/syntax",
+ "syntax.PerlX": "regexp/syntax",
+ "syntax.Prog": "regexp/syntax",
+ "syntax.Regexp": "regexp/syntax",
+ "syntax.Simple": "regexp/syntax",
+ "syntax.UnicodeGroups": "regexp/syntax",
+ "syntax.WasDollar": "regexp/syntax",
+ "syscall.AF_ALG": "syscall",
+ "syscall.AF_APPLETALK": "syscall",
+ "syscall.AF_ARP": "syscall",
+ "syscall.AF_ASH": "syscall",
+ "syscall.AF_ATM": "syscall",
+ "syscall.AF_ATMPVC": "syscall",
+ "syscall.AF_ATMSVC": "syscall",
+ "syscall.AF_AX25": "syscall",
+ "syscall.AF_BLUETOOTH": "syscall",
+ "syscall.AF_BRIDGE": "syscall",
+ "syscall.AF_CAIF": "syscall",
+ "syscall.AF_CAN": "syscall",
+ "syscall.AF_CCITT": "syscall",
+ "syscall.AF_CHAOS": "syscall",
+ "syscall.AF_CNT": "syscall",
+ "syscall.AF_COIP": "syscall",
+ "syscall.AF_DATAKIT": "syscall",
+ "syscall.AF_DECnet": "syscall",
+ "syscall.AF_DLI": "syscall",
+ "syscall.AF_E164": "syscall",
+ "syscall.AF_ECMA": "syscall",
+ "syscall.AF_ECONET": "syscall",
+ "syscall.AF_ENCAP": "syscall",
+ "syscall.AF_FILE": "syscall",
+ "syscall.AF_HYLINK": "syscall",
+ "syscall.AF_IEEE80211": "syscall",
+ "syscall.AF_IEEE802154": "syscall",
+ "syscall.AF_IMPLINK": "syscall",
+ "syscall.AF_INET": "syscall",
+ "syscall.AF_INET6": "syscall",
+ "syscall.AF_IPX": "syscall",
+ "syscall.AF_IRDA": "syscall",
+ "syscall.AF_ISDN": "syscall",
+ "syscall.AF_ISO": "syscall",
+ "syscall.AF_IUCV": "syscall",
+ "syscall.AF_KEY": "syscall",
+ "syscall.AF_LAT": "syscall",
+ "syscall.AF_LINK": "syscall",
+ "syscall.AF_LLC": "syscall",
+ "syscall.AF_LOCAL": "syscall",
+ "syscall.AF_MAX": "syscall",
+ "syscall.AF_MPLS": "syscall",
+ "syscall.AF_NATM": "syscall",
+ "syscall.AF_NDRV": "syscall",
+ "syscall.AF_NETBEUI": "syscall",
+ "syscall.AF_NETBIOS": "syscall",
+ "syscall.AF_NETGRAPH": "syscall",
+ "syscall.AF_NETLINK": "syscall",
+ "syscall.AF_NETROM": "syscall",
+ "syscall.AF_NS": "syscall",
+ "syscall.AF_OROUTE": "syscall",
+ "syscall.AF_OSI": "syscall",
+ "syscall.AF_PACKET": "syscall",
+ "syscall.AF_PHONET": "syscall",
+ "syscall.AF_PPP": "syscall",
+ "syscall.AF_PPPOX": "syscall",
+ "syscall.AF_PUP": "syscall",
+ "syscall.AF_RDS": "syscall",
+ "syscall.AF_RESERVED_36": "syscall",
+ "syscall.AF_ROSE": "syscall",
+ "syscall.AF_ROUTE": "syscall",
+ "syscall.AF_RXRPC": "syscall",
+ "syscall.AF_SCLUSTER": "syscall",
+ "syscall.AF_SECURITY": "syscall",
+ "syscall.AF_SIP": "syscall",
+ "syscall.AF_SLOW": "syscall",
+ "syscall.AF_SNA": "syscall",
+ "syscall.AF_SYSTEM": "syscall",
+ "syscall.AF_TIPC": "syscall",
+ "syscall.AF_UNIX": "syscall",
+ "syscall.AF_UNSPEC": "syscall",
+ "syscall.AF_VENDOR00": "syscall",
+ "syscall.AF_VENDOR01": "syscall",
+ "syscall.AF_VENDOR02": "syscall",
+ "syscall.AF_VENDOR03": "syscall",
+ "syscall.AF_VENDOR04": "syscall",
+ "syscall.AF_VENDOR05": "syscall",
+ "syscall.AF_VENDOR06": "syscall",
+ "syscall.AF_VENDOR07": "syscall",
+ "syscall.AF_VENDOR08": "syscall",
+ "syscall.AF_VENDOR09": "syscall",
+ "syscall.AF_VENDOR10": "syscall",
+ "syscall.AF_VENDOR11": "syscall",
+ "syscall.AF_VENDOR12": "syscall",
+ "syscall.AF_VENDOR13": "syscall",
+ "syscall.AF_VENDOR14": "syscall",
+ "syscall.AF_VENDOR15": "syscall",
+ "syscall.AF_VENDOR16": "syscall",
+ "syscall.AF_VENDOR17": "syscall",
+ "syscall.AF_VENDOR18": "syscall",
+ "syscall.AF_VENDOR19": "syscall",
+ "syscall.AF_VENDOR20": "syscall",
+ "syscall.AF_VENDOR21": "syscall",
+ "syscall.AF_VENDOR22": "syscall",
+ "syscall.AF_VENDOR23": "syscall",
+ "syscall.AF_VENDOR24": "syscall",
+ "syscall.AF_VENDOR25": "syscall",
+ "syscall.AF_VENDOR26": "syscall",
+ "syscall.AF_VENDOR27": "syscall",
+ "syscall.AF_VENDOR28": "syscall",
+ "syscall.AF_VENDOR29": "syscall",
+ "syscall.AF_VENDOR30": "syscall",
+ "syscall.AF_VENDOR31": "syscall",
+ "syscall.AF_VENDOR32": "syscall",
+ "syscall.AF_VENDOR33": "syscall",
+ "syscall.AF_VENDOR34": "syscall",
+ "syscall.AF_VENDOR35": "syscall",
+ "syscall.AF_VENDOR36": "syscall",
+ "syscall.AF_VENDOR37": "syscall",
+ "syscall.AF_VENDOR38": "syscall",
+ "syscall.AF_VENDOR39": "syscall",
+ "syscall.AF_VENDOR40": "syscall",
+ "syscall.AF_VENDOR41": "syscall",
+ "syscall.AF_VENDOR42": "syscall",
+ "syscall.AF_VENDOR43": "syscall",
+ "syscall.AF_VENDOR44": "syscall",
+ "syscall.AF_VENDOR45": "syscall",
+ "syscall.AF_VENDOR46": "syscall",
+ "syscall.AF_VENDOR47": "syscall",
+ "syscall.AF_WANPIPE": "syscall",
+ "syscall.AF_X25": "syscall",
+ "syscall.AI_CANONNAME": "syscall",
+ "syscall.AI_NUMERICHOST": "syscall",
+ "syscall.AI_PASSIVE": "syscall",
+ "syscall.APPLICATION_ERROR": "syscall",
+ "syscall.ARPHRD_ADAPT": "syscall",
+ "syscall.ARPHRD_APPLETLK": "syscall",
+ "syscall.ARPHRD_ARCNET": "syscall",
+ "syscall.ARPHRD_ASH": "syscall",
+ "syscall.ARPHRD_ATM": "syscall",
+ "syscall.ARPHRD_AX25": "syscall",
+ "syscall.ARPHRD_BIF": "syscall",
+ "syscall.ARPHRD_CHAOS": "syscall",
+ "syscall.ARPHRD_CISCO": "syscall",
+ "syscall.ARPHRD_CSLIP": "syscall",
+ "syscall.ARPHRD_CSLIP6": "syscall",
+ "syscall.ARPHRD_DDCMP": "syscall",
+ "syscall.ARPHRD_DLCI": "syscall",
+ "syscall.ARPHRD_ECONET": "syscall",
+ "syscall.ARPHRD_EETHER": "syscall",
+ "syscall.ARPHRD_ETHER": "syscall",
+ "syscall.ARPHRD_EUI64": "syscall",
+ "syscall.ARPHRD_FCAL": "syscall",
+ "syscall.ARPHRD_FCFABRIC": "syscall",
+ "syscall.ARPHRD_FCPL": "syscall",
+ "syscall.ARPHRD_FCPP": "syscall",
+ "syscall.ARPHRD_FDDI": "syscall",
+ "syscall.ARPHRD_FRAD": "syscall",
+ "syscall.ARPHRD_FRELAY": "syscall",
+ "syscall.ARPHRD_HDLC": "syscall",
+ "syscall.ARPHRD_HIPPI": "syscall",
+ "syscall.ARPHRD_HWX25": "syscall",
+ "syscall.ARPHRD_IEEE1394": "syscall",
+ "syscall.ARPHRD_IEEE802": "syscall",
+ "syscall.ARPHRD_IEEE80211": "syscall",
+ "syscall.ARPHRD_IEEE80211_PRISM": "syscall",
+ "syscall.ARPHRD_IEEE80211_RADIOTAP": "syscall",
+ "syscall.ARPHRD_IEEE802154": "syscall",
+ "syscall.ARPHRD_IEEE802154_PHY": "syscall",
+ "syscall.ARPHRD_IEEE802_TR": "syscall",
+ "syscall.ARPHRD_INFINIBAND": "syscall",
+ "syscall.ARPHRD_IPDDP": "syscall",
+ "syscall.ARPHRD_IPGRE": "syscall",
+ "syscall.ARPHRD_IRDA": "syscall",
+ "syscall.ARPHRD_LAPB": "syscall",
+ "syscall.ARPHRD_LOCALTLK": "syscall",
+ "syscall.ARPHRD_LOOPBACK": "syscall",
+ "syscall.ARPHRD_METRICOM": "syscall",
+ "syscall.ARPHRD_NETROM": "syscall",
+ "syscall.ARPHRD_NONE": "syscall",
+ "syscall.ARPHRD_PIMREG": "syscall",
+ "syscall.ARPHRD_PPP": "syscall",
+ "syscall.ARPHRD_PRONET": "syscall",
+ "syscall.ARPHRD_RAWHDLC": "syscall",
+ "syscall.ARPHRD_ROSE": "syscall",
+ "syscall.ARPHRD_RSRVD": "syscall",
+ "syscall.ARPHRD_SIT": "syscall",
+ "syscall.ARPHRD_SKIP": "syscall",
+ "syscall.ARPHRD_SLIP": "syscall",
+ "syscall.ARPHRD_SLIP6": "syscall",
+ "syscall.ARPHRD_STRIP": "syscall",
+ "syscall.ARPHRD_TUNNEL": "syscall",
+ "syscall.ARPHRD_TUNNEL6": "syscall",
+ "syscall.ARPHRD_VOID": "syscall",
+ "syscall.ARPHRD_X25": "syscall",
+ "syscall.AUTHTYPE_CLIENT": "syscall",
+ "syscall.AUTHTYPE_SERVER": "syscall",
+ "syscall.Accept": "syscall",
+ "syscall.Accept4": "syscall",
+ "syscall.AcceptEx": "syscall",
+ "syscall.Access": "syscall",
+ "syscall.Acct": "syscall",
+ "syscall.AddrinfoW": "syscall",
+ "syscall.Adjtime": "syscall",
+ "syscall.Adjtimex": "syscall",
+ "syscall.AttachLsf": "syscall",
+ "syscall.B0": "syscall",
+ "syscall.B1000000": "syscall",
+ "syscall.B110": "syscall",
+ "syscall.B115200": "syscall",
+ "syscall.B1152000": "syscall",
+ "syscall.B1200": "syscall",
+ "syscall.B134": "syscall",
+ "syscall.B14400": "syscall",
+ "syscall.B150": "syscall",
+ "syscall.B1500000": "syscall",
+ "syscall.B1800": "syscall",
+ "syscall.B19200": "syscall",
+ "syscall.B200": "syscall",
+ "syscall.B2000000": "syscall",
+ "syscall.B230400": "syscall",
+ "syscall.B2400": "syscall",
+ "syscall.B2500000": "syscall",
+ "syscall.B28800": "syscall",
+ "syscall.B300": "syscall",
+ "syscall.B3000000": "syscall",
+ "syscall.B3500000": "syscall",
+ "syscall.B38400": "syscall",
+ "syscall.B4000000": "syscall",
+ "syscall.B460800": "syscall",
+ "syscall.B4800": "syscall",
+ "syscall.B50": "syscall",
+ "syscall.B500000": "syscall",
+ "syscall.B57600": "syscall",
+ "syscall.B576000": "syscall",
+ "syscall.B600": "syscall",
+ "syscall.B7200": "syscall",
+ "syscall.B75": "syscall",
+ "syscall.B76800": "syscall",
+ "syscall.B921600": "syscall",
+ "syscall.B9600": "syscall",
+ "syscall.BASE_PROTOCOL": "syscall",
+ "syscall.BIOCFEEDBACK": "syscall",
+ "syscall.BIOCFLUSH": "syscall",
+ "syscall.BIOCGBLEN": "syscall",
+ "syscall.BIOCGDIRECTION": "syscall",
+ "syscall.BIOCGDIRFILT": "syscall",
+ "syscall.BIOCGDLT": "syscall",
+ "syscall.BIOCGDLTLIST": "syscall",
+ "syscall.BIOCGETBUFMODE": "syscall",
+ "syscall.BIOCGETIF": "syscall",
+ "syscall.BIOCGETZMAX": "syscall",
+ "syscall.BIOCGFEEDBACK": "syscall",
+ "syscall.BIOCGFILDROP": "syscall",
+ "syscall.BIOCGHDRCMPLT": "syscall",
+ "syscall.BIOCGRSIG": "syscall",
+ "syscall.BIOCGRTIMEOUT": "syscall",
+ "syscall.BIOCGSEESENT": "syscall",
+ "syscall.BIOCGSTATS": "syscall",
+ "syscall.BIOCGSTATSOLD": "syscall",
+ "syscall.BIOCGTSTAMP": "syscall",
+ "syscall.BIOCIMMEDIATE": "syscall",
+ "syscall.BIOCLOCK": "syscall",
+ "syscall.BIOCPROMISC": "syscall",
+ "syscall.BIOCROTZBUF": "syscall",
+ "syscall.BIOCSBLEN": "syscall",
+ "syscall.BIOCSDIRECTION": "syscall",
+ "syscall.BIOCSDIRFILT": "syscall",
+ "syscall.BIOCSDLT": "syscall",
+ "syscall.BIOCSETBUFMODE": "syscall",
+ "syscall.BIOCSETF": "syscall",
+ "syscall.BIOCSETFNR": "syscall",
+ "syscall.BIOCSETIF": "syscall",
+ "syscall.BIOCSETWF": "syscall",
+ "syscall.BIOCSETZBUF": "syscall",
+ "syscall.BIOCSFEEDBACK": "syscall",
+ "syscall.BIOCSFILDROP": "syscall",
+ "syscall.BIOCSHDRCMPLT": "syscall",
+ "syscall.BIOCSRSIG": "syscall",
+ "syscall.BIOCSRTIMEOUT": "syscall",
+ "syscall.BIOCSSEESENT": "syscall",
+ "syscall.BIOCSTCPF": "syscall",
+ "syscall.BIOCSTSTAMP": "syscall",
+ "syscall.BIOCSUDPF": "syscall",
+ "syscall.BIOCVERSION": "syscall",
+ "syscall.BPF_A": "syscall",
+ "syscall.BPF_ABS": "syscall",
+ "syscall.BPF_ADD": "syscall",
+ "syscall.BPF_ALIGNMENT": "syscall",
+ "syscall.BPF_ALIGNMENT32": "syscall",
+ "syscall.BPF_ALU": "syscall",
+ "syscall.BPF_AND": "syscall",
+ "syscall.BPF_B": "syscall",
+ "syscall.BPF_BUFMODE_BUFFER": "syscall",
+ "syscall.BPF_BUFMODE_ZBUF": "syscall",
+ "syscall.BPF_DFLTBUFSIZE": "syscall",
+ "syscall.BPF_DIRECTION_IN": "syscall",
+ "syscall.BPF_DIRECTION_OUT": "syscall",
+ "syscall.BPF_DIV": "syscall",
+ "syscall.BPF_H": "syscall",
+ "syscall.BPF_IMM": "syscall",
+ "syscall.BPF_IND": "syscall",
+ "syscall.BPF_JA": "syscall",
+ "syscall.BPF_JEQ": "syscall",
+ "syscall.BPF_JGE": "syscall",
+ "syscall.BPF_JGT": "syscall",
+ "syscall.BPF_JMP": "syscall",
+ "syscall.BPF_JSET": "syscall",
+ "syscall.BPF_K": "syscall",
+ "syscall.BPF_LD": "syscall",
+ "syscall.BPF_LDX": "syscall",
+ "syscall.BPF_LEN": "syscall",
+ "syscall.BPF_LSH": "syscall",
+ "syscall.BPF_MAJOR_VERSION": "syscall",
+ "syscall.BPF_MAXBUFSIZE": "syscall",
+ "syscall.BPF_MAXINSNS": "syscall",
+ "syscall.BPF_MEM": "syscall",
+ "syscall.BPF_MEMWORDS": "syscall",
+ "syscall.BPF_MINBUFSIZE": "syscall",
+ "syscall.BPF_MINOR_VERSION": "syscall",
+ "syscall.BPF_MISC": "syscall",
+ "syscall.BPF_MSH": "syscall",
+ "syscall.BPF_MUL": "syscall",
+ "syscall.BPF_NEG": "syscall",
+ "syscall.BPF_OR": "syscall",
+ "syscall.BPF_RELEASE": "syscall",
+ "syscall.BPF_RET": "syscall",
+ "syscall.BPF_RSH": "syscall",
+ "syscall.BPF_ST": "syscall",
+ "syscall.BPF_STX": "syscall",
+ "syscall.BPF_SUB": "syscall",
+ "syscall.BPF_TAX": "syscall",
+ "syscall.BPF_TXA": "syscall",
+ "syscall.BPF_T_BINTIME": "syscall",
+ "syscall.BPF_T_BINTIME_FAST": "syscall",
+ "syscall.BPF_T_BINTIME_MONOTONIC": "syscall",
+ "syscall.BPF_T_BINTIME_MONOTONIC_FAST": "syscall",
+ "syscall.BPF_T_FAST": "syscall",
+ "syscall.BPF_T_FLAG_MASK": "syscall",
+ "syscall.BPF_T_FORMAT_MASK": "syscall",
+ "syscall.BPF_T_MICROTIME": "syscall",
+ "syscall.BPF_T_MICROTIME_FAST": "syscall",
+ "syscall.BPF_T_MICROTIME_MONOTONIC": "syscall",
+ "syscall.BPF_T_MICROTIME_MONOTONIC_FAST": "syscall",
+ "syscall.BPF_T_MONOTONIC": "syscall",
+ "syscall.BPF_T_MONOTONIC_FAST": "syscall",
+ "syscall.BPF_T_NANOTIME": "syscall",
+ "syscall.BPF_T_NANOTIME_FAST": "syscall",
+ "syscall.BPF_T_NANOTIME_MONOTONIC": "syscall",
+ "syscall.BPF_T_NANOTIME_MONOTONIC_FAST": "syscall",
+ "syscall.BPF_T_NONE": "syscall",
+ "syscall.BPF_T_NORMAL": "syscall",
+ "syscall.BPF_W": "syscall",
+ "syscall.BPF_X": "syscall",
+ "syscall.BRKINT": "syscall",
+ "syscall.Bind": "syscall",
+ "syscall.BindToDevice": "syscall",
+ "syscall.BpfBuflen": "syscall",
+ "syscall.BpfDatalink": "syscall",
+ "syscall.BpfHdr": "syscall",
+ "syscall.BpfHeadercmpl": "syscall",
+ "syscall.BpfInsn": "syscall",
+ "syscall.BpfInterface": "syscall",
+ "syscall.BpfJump": "syscall",
+ "syscall.BpfProgram": "syscall",
+ "syscall.BpfStat": "syscall",
+ "syscall.BpfStats": "syscall",
+ "syscall.BpfStmt": "syscall",
+ "syscall.BpfTimeout": "syscall",
+ "syscall.BpfTimeval": "syscall",
+ "syscall.BpfVersion": "syscall",
+ "syscall.BpfZbuf": "syscall",
+ "syscall.BpfZbufHeader": "syscall",
+ "syscall.ByHandleFileInformation": "syscall",
+ "syscall.BytePtrFromString": "syscall",
+ "syscall.ByteSliceFromString": "syscall",
+ "syscall.CCR0_FLUSH": "syscall",
+ "syscall.CERT_CHAIN_POLICY_AUTHENTICODE": "syscall",
+ "syscall.CERT_CHAIN_POLICY_AUTHENTICODE_TS": "syscall",
+ "syscall.CERT_CHAIN_POLICY_BASE": "syscall",
+ "syscall.CERT_CHAIN_POLICY_BASIC_CONSTRAINTS": "syscall",
+ "syscall.CERT_CHAIN_POLICY_EV": "syscall",
+ "syscall.CERT_CHAIN_POLICY_MICROSOFT_ROOT": "syscall",
+ "syscall.CERT_CHAIN_POLICY_NT_AUTH": "syscall",
+ "syscall.CERT_CHAIN_POLICY_SSL": "syscall",
+ "syscall.CERT_E_CN_NO_MATCH": "syscall",
+ "syscall.CERT_E_EXPIRED": "syscall",
+ "syscall.CERT_E_PURPOSE": "syscall",
+ "syscall.CERT_E_ROLE": "syscall",
+ "syscall.CERT_E_UNTRUSTEDROOT": "syscall",
+ "syscall.CERT_STORE_ADD_ALWAYS": "syscall",
+ "syscall.CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG": "syscall",
+ "syscall.CERT_STORE_PROV_MEMORY": "syscall",
+ "syscall.CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT": "syscall",
+ "syscall.CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT": "syscall",
+ "syscall.CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT": "syscall",
+ "syscall.CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT": "syscall",
+ "syscall.CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT": "syscall",
+ "syscall.CERT_TRUST_INVALID_BASIC_CONSTRAINTS": "syscall",
+ "syscall.CERT_TRUST_INVALID_EXTENSION": "syscall",
+ "syscall.CERT_TRUST_INVALID_NAME_CONSTRAINTS": "syscall",
+ "syscall.CERT_TRUST_INVALID_POLICY_CONSTRAINTS": "syscall",
+ "syscall.CERT_TRUST_IS_CYCLIC": "syscall",
+ "syscall.CERT_TRUST_IS_EXPLICIT_DISTRUST": "syscall",
+ "syscall.CERT_TRUST_IS_NOT_SIGNATURE_VALID": "syscall",
+ "syscall.CERT_TRUST_IS_NOT_TIME_VALID": "syscall",
+ "syscall.CERT_TRUST_IS_NOT_VALID_FOR_USAGE": "syscall",
+ "syscall.CERT_TRUST_IS_OFFLINE_REVOCATION": "syscall",
+ "syscall.CERT_TRUST_IS_REVOKED": "syscall",
+ "syscall.CERT_TRUST_IS_UNTRUSTED_ROOT": "syscall",
+ "syscall.CERT_TRUST_NO_ERROR": "syscall",
+ "syscall.CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY": "syscall",
+ "syscall.CERT_TRUST_REVOCATION_STATUS_UNKNOWN": "syscall",
+ "syscall.CFLUSH": "syscall",
+ "syscall.CLOCAL": "syscall",
+ "syscall.CLONE_CHILD_CLEARTID": "syscall",
+ "syscall.CLONE_CHILD_SETTID": "syscall",
+ "syscall.CLONE_DETACHED": "syscall",
+ "syscall.CLONE_FILES": "syscall",
+ "syscall.CLONE_FS": "syscall",
+ "syscall.CLONE_IO": "syscall",
+ "syscall.CLONE_NEWIPC": "syscall",
+ "syscall.CLONE_NEWNET": "syscall",
+ "syscall.CLONE_NEWNS": "syscall",
+ "syscall.CLONE_NEWPID": "syscall",
+ "syscall.CLONE_NEWUSER": "syscall",
+ "syscall.CLONE_NEWUTS": "syscall",
+ "syscall.CLONE_PARENT": "syscall",
+ "syscall.CLONE_PARENT_SETTID": "syscall",
+ "syscall.CLONE_PTRACE": "syscall",
+ "syscall.CLONE_SETTLS": "syscall",
+ "syscall.CLONE_SIGHAND": "syscall",
+ "syscall.CLONE_SYSVSEM": "syscall",
+ "syscall.CLONE_THREAD": "syscall",
+ "syscall.CLONE_UNTRACED": "syscall",
+ "syscall.CLONE_VFORK": "syscall",
+ "syscall.CLONE_VM": "syscall",
+ "syscall.CPUID_CFLUSH": "syscall",
+ "syscall.CREAD": "syscall",
+ "syscall.CREATE_ALWAYS": "syscall",
+ "syscall.CREATE_NEW": "syscall",
+ "syscall.CREATE_NEW_PROCESS_GROUP": "syscall",
+ "syscall.CREATE_UNICODE_ENVIRONMENT": "syscall",
+ "syscall.CRYPT_DEFAULT_CONTAINER_OPTIONAL": "syscall",
+ "syscall.CRYPT_DELETEKEYSET": "syscall",
+ "syscall.CRYPT_MACHINE_KEYSET": "syscall",
+ "syscall.CRYPT_NEWKEYSET": "syscall",
+ "syscall.CRYPT_SILENT": "syscall",
+ "syscall.CRYPT_VERIFYCONTEXT": "syscall",
+ "syscall.CS5": "syscall",
+ "syscall.CS6": "syscall",
+ "syscall.CS7": "syscall",
+ "syscall.CS8": "syscall",
+ "syscall.CSIZE": "syscall",
+ "syscall.CSTART": "syscall",
+ "syscall.CSTATUS": "syscall",
+ "syscall.CSTOP": "syscall",
+ "syscall.CSTOPB": "syscall",
+ "syscall.CSUSP": "syscall",
+ "syscall.CTL_MAXNAME": "syscall",
+ "syscall.CTL_NET": "syscall",
+ "syscall.CTL_QUERY": "syscall",
+ "syscall.CTRL_BREAK_EVENT": "syscall",
+ "syscall.CTRL_C_EVENT": "syscall",
+ "syscall.CancelIo": "syscall",
+ "syscall.CancelIoEx": "syscall",
+ "syscall.CertAddCertificateContextToStore": "syscall",
+ "syscall.CertChainContext": "syscall",
+ "syscall.CertChainElement": "syscall",
+ "syscall.CertChainPara": "syscall",
+ "syscall.CertChainPolicyPara": "syscall",
+ "syscall.CertChainPolicyStatus": "syscall",
+ "syscall.CertCloseStore": "syscall",
+ "syscall.CertContext": "syscall",
+ "syscall.CertCreateCertificateContext": "syscall",
+ "syscall.CertEnhKeyUsage": "syscall",
+ "syscall.CertEnumCertificatesInStore": "syscall",
+ "syscall.CertFreeCertificateChain": "syscall",
+ "syscall.CertFreeCertificateContext": "syscall",
+ "syscall.CertGetCertificateChain": "syscall",
+ "syscall.CertOpenStore": "syscall",
+ "syscall.CertOpenSystemStore": "syscall",
+ "syscall.CertRevocationInfo": "syscall",
+ "syscall.CertSimpleChain": "syscall",
+ "syscall.CertTrustStatus": "syscall",
+ "syscall.CertUsageMatch": "syscall",
+ "syscall.CertVerifyCertificateChainPolicy": "syscall",
+ "syscall.Chdir": "syscall",
+ "syscall.CheckBpfVersion": "syscall",
+ "syscall.Chflags": "syscall",
+ "syscall.Chmod": "syscall",
+ "syscall.Chown": "syscall",
+ "syscall.Chroot": "syscall",
+ "syscall.Clearenv": "syscall",
+ "syscall.Close": "syscall",
+ "syscall.CloseHandle": "syscall",
+ "syscall.CloseOnExec": "syscall",
+ "syscall.Closesocket": "syscall",
+ "syscall.CmsgLen": "syscall",
+ "syscall.CmsgSpace": "syscall",
+ "syscall.Cmsghdr": "syscall",
+ "syscall.CommandLineToArgv": "syscall",
+ "syscall.ComputerName": "syscall",
+ "syscall.Connect": "syscall",
+ "syscall.ConnectEx": "syscall",
+ "syscall.ConvertSidToStringSid": "syscall",
+ "syscall.ConvertStringSidToSid": "syscall",
+ "syscall.CopySid": "syscall",
+ "syscall.Creat": "syscall",
+ "syscall.CreateDirectory": "syscall",
+ "syscall.CreateFile": "syscall",
+ "syscall.CreateFileMapping": "syscall",
+ "syscall.CreateIoCompletionPort": "syscall",
+ "syscall.CreatePipe": "syscall",
+ "syscall.CreateProcess": "syscall",
+ "syscall.Credential": "syscall",
+ "syscall.CryptAcquireContext": "syscall",
+ "syscall.CryptGenRandom": "syscall",
+ "syscall.CryptReleaseContext": "syscall",
+ "syscall.DIOCBSFLUSH": "syscall",
+ "syscall.DIOCOSFPFLUSH": "syscall",
+ "syscall.DLL": "syscall",
+ "syscall.DLLError": "syscall",
+ "syscall.DLT_A429": "syscall",
+ "syscall.DLT_A653_ICM": "syscall",
+ "syscall.DLT_AIRONET_HEADER": "syscall",
+ "syscall.DLT_AOS": "syscall",
+ "syscall.DLT_APPLE_IP_OVER_IEEE1394": "syscall",
+ "syscall.DLT_ARCNET": "syscall",
+ "syscall.DLT_ARCNET_LINUX": "syscall",
+ "syscall.DLT_ATM_CLIP": "syscall",
+ "syscall.DLT_ATM_RFC1483": "syscall",
+ "syscall.DLT_AURORA": "syscall",
+ "syscall.DLT_AX25": "syscall",
+ "syscall.DLT_AX25_KISS": "syscall",
+ "syscall.DLT_BACNET_MS_TP": "syscall",
+ "syscall.DLT_BLUETOOTH_HCI_H4": "syscall",
+ "syscall.DLT_BLUETOOTH_HCI_H4_WITH_PHDR": "syscall",
+ "syscall.DLT_CAN20B": "syscall",
+ "syscall.DLT_CAN_SOCKETCAN": "syscall",
+ "syscall.DLT_CHAOS": "syscall",
+ "syscall.DLT_CHDLC": "syscall",
+ "syscall.DLT_CISCO_IOS": "syscall",
+ "syscall.DLT_C_HDLC": "syscall",
+ "syscall.DLT_C_HDLC_WITH_DIR": "syscall",
+ "syscall.DLT_DBUS": "syscall",
+ "syscall.DLT_DECT": "syscall",
+ "syscall.DLT_DOCSIS": "syscall",
+ "syscall.DLT_DVB_CI": "syscall",
+ "syscall.DLT_ECONET": "syscall",
+ "syscall.DLT_EN10MB": "syscall",
+ "syscall.DLT_EN3MB": "syscall",
+ "syscall.DLT_ENC": "syscall",
+ "syscall.DLT_ERF": "syscall",
+ "syscall.DLT_ERF_ETH": "syscall",
+ "syscall.DLT_ERF_POS": "syscall",
+ "syscall.DLT_FC_2": "syscall",
+ "syscall.DLT_FC_2_WITH_FRAME_DELIMS": "syscall",
+ "syscall.DLT_FDDI": "syscall",
+ "syscall.DLT_FLEXRAY": "syscall",
+ "syscall.DLT_FRELAY": "syscall",
+ "syscall.DLT_FRELAY_WITH_DIR": "syscall",
+ "syscall.DLT_GCOM_SERIAL": "syscall",
+ "syscall.DLT_GCOM_T1E1": "syscall",
+ "syscall.DLT_GPF_F": "syscall",
+ "syscall.DLT_GPF_T": "syscall",
+ "syscall.DLT_GPRS_LLC": "syscall",
+ "syscall.DLT_GSMTAP_ABIS": "syscall",
+ "syscall.DLT_GSMTAP_UM": "syscall",
+ "syscall.DLT_HDLC": "syscall",
+ "syscall.DLT_HHDLC": "syscall",
+ "syscall.DLT_HIPPI": "syscall",
+ "syscall.DLT_IBM_SN": "syscall",
+ "syscall.DLT_IBM_SP": "syscall",
+ "syscall.DLT_IEEE802": "syscall",
+ "syscall.DLT_IEEE802_11": "syscall",
+ "syscall.DLT_IEEE802_11_RADIO": "syscall",
+ "syscall.DLT_IEEE802_11_RADIO_AVS": "syscall",
+ "syscall.DLT_IEEE802_15_4": "syscall",
+ "syscall.DLT_IEEE802_15_4_LINUX": "syscall",
+ "syscall.DLT_IEEE802_15_4_NOFCS": "syscall",
+ "syscall.DLT_IEEE802_15_4_NONASK_PHY": "syscall",
+ "syscall.DLT_IEEE802_16_MAC_CPS": "syscall",
+ "syscall.DLT_IEEE802_16_MAC_CPS_RADIO": "syscall",
+ "syscall.DLT_IPFILTER": "syscall",
+ "syscall.DLT_IPMB": "syscall",
+ "syscall.DLT_IPMB_LINUX": "syscall",
+ "syscall.DLT_IPNET": "syscall",
+ "syscall.DLT_IPOIB": "syscall",
+ "syscall.DLT_IPV4": "syscall",
+ "syscall.DLT_IPV6": "syscall",
+ "syscall.DLT_IP_OVER_FC": "syscall",
+ "syscall.DLT_JUNIPER_ATM1": "syscall",
+ "syscall.DLT_JUNIPER_ATM2": "syscall",
+ "syscall.DLT_JUNIPER_ATM_CEMIC": "syscall",
+ "syscall.DLT_JUNIPER_CHDLC": "syscall",
+ "syscall.DLT_JUNIPER_ES": "syscall",
+ "syscall.DLT_JUNIPER_ETHER": "syscall",
+ "syscall.DLT_JUNIPER_FIBRECHANNEL": "syscall",
+ "syscall.DLT_JUNIPER_FRELAY": "syscall",
+ "syscall.DLT_JUNIPER_GGSN": "syscall",
+ "syscall.DLT_JUNIPER_ISM": "syscall",
+ "syscall.DLT_JUNIPER_MFR": "syscall",
+ "syscall.DLT_JUNIPER_MLFR": "syscall",
+ "syscall.DLT_JUNIPER_MLPPP": "syscall",
+ "syscall.DLT_JUNIPER_MONITOR": "syscall",
+ "syscall.DLT_JUNIPER_PIC_PEER": "syscall",
+ "syscall.DLT_JUNIPER_PPP": "syscall",
+ "syscall.DLT_JUNIPER_PPPOE": "syscall",
+ "syscall.DLT_JUNIPER_PPPOE_ATM": "syscall",
+ "syscall.DLT_JUNIPER_SERVICES": "syscall",
+ "syscall.DLT_JUNIPER_SRX_E2E": "syscall",
+ "syscall.DLT_JUNIPER_ST": "syscall",
+ "syscall.DLT_JUNIPER_VP": "syscall",
+ "syscall.DLT_JUNIPER_VS": "syscall",
+ "syscall.DLT_LAPB_WITH_DIR": "syscall",
+ "syscall.DLT_LAPD": "syscall",
+ "syscall.DLT_LIN": "syscall",
+ "syscall.DLT_LINUX_EVDEV": "syscall",
+ "syscall.DLT_LINUX_IRDA": "syscall",
+ "syscall.DLT_LINUX_LAPD": "syscall",
+ "syscall.DLT_LINUX_PPP_WITHDIRECTION": "syscall",
+ "syscall.DLT_LINUX_SLL": "syscall",
+ "syscall.DLT_LOOP": "syscall",
+ "syscall.DLT_LTALK": "syscall",
+ "syscall.DLT_MATCHING_MAX": "syscall",
+ "syscall.DLT_MATCHING_MIN": "syscall",
+ "syscall.DLT_MFR": "syscall",
+ "syscall.DLT_MOST": "syscall",
+ "syscall.DLT_MPEG_2_TS": "syscall",
+ "syscall.DLT_MPLS": "syscall",
+ "syscall.DLT_MTP2": "syscall",
+ "syscall.DLT_MTP2_WITH_PHDR": "syscall",
+ "syscall.DLT_MTP3": "syscall",
+ "syscall.DLT_MUX27010": "syscall",
+ "syscall.DLT_NETANALYZER": "syscall",
+ "syscall.DLT_NETANALYZER_TRANSPARENT": "syscall",
+ "syscall.DLT_NFC_LLCP": "syscall",
+ "syscall.DLT_NFLOG": "syscall",
+ "syscall.DLT_NG40": "syscall",
+ "syscall.DLT_NULL": "syscall",
+ "syscall.DLT_PCI_EXP": "syscall",
+ "syscall.DLT_PFLOG": "syscall",
+ "syscall.DLT_PFSYNC": "syscall",
+ "syscall.DLT_PPI": "syscall",
+ "syscall.DLT_PPP": "syscall",
+ "syscall.DLT_PPP_BSDOS": "syscall",
+ "syscall.DLT_PPP_ETHER": "syscall",
+ "syscall.DLT_PPP_PPPD": "syscall",
+ "syscall.DLT_PPP_SERIAL": "syscall",
+ "syscall.DLT_PPP_WITH_DIR": "syscall",
+ "syscall.DLT_PPP_WITH_DIRECTION": "syscall",
+ "syscall.DLT_PRISM_HEADER": "syscall",
+ "syscall.DLT_PRONET": "syscall",
+ "syscall.DLT_RAIF1": "syscall",
+ "syscall.DLT_RAW": "syscall",
+ "syscall.DLT_RAWAF_MASK": "syscall",
+ "syscall.DLT_RIO": "syscall",
+ "syscall.DLT_SCCP": "syscall",
+ "syscall.DLT_SITA": "syscall",
+ "syscall.DLT_SLIP": "syscall",
+ "syscall.DLT_SLIP_BSDOS": "syscall",
+ "syscall.DLT_STANAG_5066_D_PDU": "syscall",
+ "syscall.DLT_SUNATM": "syscall",
+ "syscall.DLT_SYMANTEC_FIREWALL": "syscall",
+ "syscall.DLT_TZSP": "syscall",
+ "syscall.DLT_USB": "syscall",
+ "syscall.DLT_USB_LINUX": "syscall",
+ "syscall.DLT_USB_LINUX_MMAPPED": "syscall",
+ "syscall.DLT_USER0": "syscall",
+ "syscall.DLT_USER1": "syscall",
+ "syscall.DLT_USER10": "syscall",
+ "syscall.DLT_USER11": "syscall",
+ "syscall.DLT_USER12": "syscall",
+ "syscall.DLT_USER13": "syscall",
+ "syscall.DLT_USER14": "syscall",
+ "syscall.DLT_USER15": "syscall",
+ "syscall.DLT_USER2": "syscall",
+ "syscall.DLT_USER3": "syscall",
+ "syscall.DLT_USER4": "syscall",
+ "syscall.DLT_USER5": "syscall",
+ "syscall.DLT_USER6": "syscall",
+ "syscall.DLT_USER7": "syscall",
+ "syscall.DLT_USER8": "syscall",
+ "syscall.DLT_USER9": "syscall",
+ "syscall.DLT_WIHART": "syscall",
+ "syscall.DLT_X2E_SERIAL": "syscall",
+ "syscall.DLT_X2E_XORAYA": "syscall",
+ "syscall.DNSMXData": "syscall",
+ "syscall.DNSPTRData": "syscall",
+ "syscall.DNSRecord": "syscall",
+ "syscall.DNSSRVData": "syscall",
+ "syscall.DNSTXTData": "syscall",
+ "syscall.DNS_TYPE_A": "syscall",
+ "syscall.DNS_TYPE_A6": "syscall",
+ "syscall.DNS_TYPE_AAAA": "syscall",
+ "syscall.DNS_TYPE_ADDRS": "syscall",
+ "syscall.DNS_TYPE_AFSDB": "syscall",
+ "syscall.DNS_TYPE_ALL": "syscall",
+ "syscall.DNS_TYPE_ANY": "syscall",
+ "syscall.DNS_TYPE_ATMA": "syscall",
+ "syscall.DNS_TYPE_AXFR": "syscall",
+ "syscall.DNS_TYPE_CERT": "syscall",
+ "syscall.DNS_TYPE_CNAME": "syscall",
+ "syscall.DNS_TYPE_DHCID": "syscall",
+ "syscall.DNS_TYPE_DNAME": "syscall",
+ "syscall.DNS_TYPE_DNSKEY": "syscall",
+ "syscall.DNS_TYPE_DS": "syscall",
+ "syscall.DNS_TYPE_EID": "syscall",
+ "syscall.DNS_TYPE_GID": "syscall",
+ "syscall.DNS_TYPE_GPOS": "syscall",
+ "syscall.DNS_TYPE_HINFO": "syscall",
+ "syscall.DNS_TYPE_ISDN": "syscall",
+ "syscall.DNS_TYPE_IXFR": "syscall",
+ "syscall.DNS_TYPE_KEY": "syscall",
+ "syscall.DNS_TYPE_KX": "syscall",
+ "syscall.DNS_TYPE_LOC": "syscall",
+ "syscall.DNS_TYPE_MAILA": "syscall",
+ "syscall.DNS_TYPE_MAILB": "syscall",
+ "syscall.DNS_TYPE_MB": "syscall",
+ "syscall.DNS_TYPE_MD": "syscall",
+ "syscall.DNS_TYPE_MF": "syscall",
+ "syscall.DNS_TYPE_MG": "syscall",
+ "syscall.DNS_TYPE_MINFO": "syscall",
+ "syscall.DNS_TYPE_MR": "syscall",
+ "syscall.DNS_TYPE_MX": "syscall",
+ "syscall.DNS_TYPE_NAPTR": "syscall",
+ "syscall.DNS_TYPE_NBSTAT": "syscall",
+ "syscall.DNS_TYPE_NIMLOC": "syscall",
+ "syscall.DNS_TYPE_NS": "syscall",
+ "syscall.DNS_TYPE_NSAP": "syscall",
+ "syscall.DNS_TYPE_NSAPPTR": "syscall",
+ "syscall.DNS_TYPE_NSEC": "syscall",
+ "syscall.DNS_TYPE_NULL": "syscall",
+ "syscall.DNS_TYPE_NXT": "syscall",
+ "syscall.DNS_TYPE_OPT": "syscall",
+ "syscall.DNS_TYPE_PTR": "syscall",
+ "syscall.DNS_TYPE_PX": "syscall",
+ "syscall.DNS_TYPE_RP": "syscall",
+ "syscall.DNS_TYPE_RRSIG": "syscall",
+ "syscall.DNS_TYPE_RT": "syscall",
+ "syscall.DNS_TYPE_SIG": "syscall",
+ "syscall.DNS_TYPE_SINK": "syscall",
+ "syscall.DNS_TYPE_SOA": "syscall",
+ "syscall.DNS_TYPE_SRV": "syscall",
+ "syscall.DNS_TYPE_TEXT": "syscall",
+ "syscall.DNS_TYPE_TKEY": "syscall",
+ "syscall.DNS_TYPE_TSIG": "syscall",
+ "syscall.DNS_TYPE_UID": "syscall",
+ "syscall.DNS_TYPE_UINFO": "syscall",
+ "syscall.DNS_TYPE_UNSPEC": "syscall",
+ "syscall.DNS_TYPE_WINS": "syscall",
+ "syscall.DNS_TYPE_WINSR": "syscall",
+ "syscall.DNS_TYPE_WKS": "syscall",
+ "syscall.DNS_TYPE_X25": "syscall",
+ "syscall.DT_BLK": "syscall",
+ "syscall.DT_CHR": "syscall",
+ "syscall.DT_DIR": "syscall",
+ "syscall.DT_FIFO": "syscall",
+ "syscall.DT_LNK": "syscall",
+ "syscall.DT_REG": "syscall",
+ "syscall.DT_SOCK": "syscall",
+ "syscall.DT_UNKNOWN": "syscall",
+ "syscall.DT_WHT": "syscall",
+ "syscall.DUPLICATE_CLOSE_SOURCE": "syscall",
+ "syscall.DUPLICATE_SAME_ACCESS": "syscall",
+ "syscall.DeleteFile": "syscall",
+ "syscall.DetachLsf": "syscall",
+ "syscall.Dirent": "syscall",
+ "syscall.DnsQuery": "syscall",
+ "syscall.DnsRecordListFree": "syscall",
+ "syscall.Dup": "syscall",
+ "syscall.Dup2": "syscall",
+ "syscall.Dup3": "syscall",
+ "syscall.DuplicateHandle": "syscall",
+ "syscall.E2BIG": "syscall",
+ "syscall.EACCES": "syscall",
+ "syscall.EADDRINUSE": "syscall",
+ "syscall.EADDRNOTAVAIL": "syscall",
+ "syscall.EADV": "syscall",
+ "syscall.EAFNOSUPPORT": "syscall",
+ "syscall.EAGAIN": "syscall",
+ "syscall.EALREADY": "syscall",
+ "syscall.EAUTH": "syscall",
+ "syscall.EBADARCH": "syscall",
+ "syscall.EBADE": "syscall",
+ "syscall.EBADEXEC": "syscall",
+ "syscall.EBADF": "syscall",
+ "syscall.EBADFD": "syscall",
+ "syscall.EBADMACHO": "syscall",
+ "syscall.EBADMSG": "syscall",
+ "syscall.EBADR": "syscall",
+ "syscall.EBADRPC": "syscall",
+ "syscall.EBADRQC": "syscall",
+ "syscall.EBADSLT": "syscall",
+ "syscall.EBFONT": "syscall",
+ "syscall.EBUSY": "syscall",
+ "syscall.ECANCELED": "syscall",
+ "syscall.ECAPMODE": "syscall",
+ "syscall.ECHILD": "syscall",
+ "syscall.ECHO": "syscall",
+ "syscall.ECHOCTL": "syscall",
+ "syscall.ECHOE": "syscall",
+ "syscall.ECHOK": "syscall",
+ "syscall.ECHOKE": "syscall",
+ "syscall.ECHONL": "syscall",
+ "syscall.ECHOPRT": "syscall",
+ "syscall.ECHRNG": "syscall",
+ "syscall.ECOMM": "syscall",
+ "syscall.ECONNABORTED": "syscall",
+ "syscall.ECONNREFUSED": "syscall",
+ "syscall.ECONNRESET": "syscall",
+ "syscall.EDEADLK": "syscall",
+ "syscall.EDEADLOCK": "syscall",
+ "syscall.EDESTADDRREQ": "syscall",
+ "syscall.EDEVERR": "syscall",
+ "syscall.EDOM": "syscall",
+ "syscall.EDOOFUS": "syscall",
+ "syscall.EDOTDOT": "syscall",
+ "syscall.EDQUOT": "syscall",
+ "syscall.EEXIST": "syscall",
+ "syscall.EFAULT": "syscall",
+ "syscall.EFBIG": "syscall",
+ "syscall.EFER_LMA": "syscall",
+ "syscall.EFER_LME": "syscall",
+ "syscall.EFER_NXE": "syscall",
+ "syscall.EFER_SCE": "syscall",
+ "syscall.EFTYPE": "syscall",
+ "syscall.EHOSTDOWN": "syscall",
+ "syscall.EHOSTUNREACH": "syscall",
+ "syscall.EHWPOISON": "syscall",
+ "syscall.EIDRM": "syscall",
+ "syscall.EILSEQ": "syscall",
+ "syscall.EINPROGRESS": "syscall",
+ "syscall.EINTR": "syscall",
+ "syscall.EINVAL": "syscall",
+ "syscall.EIO": "syscall",
+ "syscall.EIPSEC": "syscall",
+ "syscall.EISCONN": "syscall",
+ "syscall.EISDIR": "syscall",
+ "syscall.EISNAM": "syscall",
+ "syscall.EKEYEXPIRED": "syscall",
+ "syscall.EKEYREJECTED": "syscall",
+ "syscall.EKEYREVOKED": "syscall",
+ "syscall.EL2HLT": "syscall",
+ "syscall.EL2NSYNC": "syscall",
+ "syscall.EL3HLT": "syscall",
+ "syscall.EL3RST": "syscall",
+ "syscall.ELAST": "syscall",
+ "syscall.ELF_NGREG": "syscall",
+ "syscall.ELF_PRARGSZ": "syscall",
+ "syscall.ELIBACC": "syscall",
+ "syscall.ELIBBAD": "syscall",
+ "syscall.ELIBEXEC": "syscall",
+ "syscall.ELIBMAX": "syscall",
+ "syscall.ELIBSCN": "syscall",
+ "syscall.ELNRNG": "syscall",
+ "syscall.ELOOP": "syscall",
+ "syscall.EMEDIUMTYPE": "syscall",
+ "syscall.EMFILE": "syscall",
+ "syscall.EMLINK": "syscall",
+ "syscall.EMSGSIZE": "syscall",
+ "syscall.EMT_TAGOVF": "syscall",
+ "syscall.EMULTIHOP": "syscall",
+ "syscall.EMUL_ENABLED": "syscall",
+ "syscall.EMUL_LINUX": "syscall",
+ "syscall.EMUL_LINUX32": "syscall",
+ "syscall.EMUL_MAXID": "syscall",
+ "syscall.EMUL_NATIVE": "syscall",
+ "syscall.ENAMETOOLONG": "syscall",
+ "syscall.ENAVAIL": "syscall",
+ "syscall.ENDRUNDISC": "syscall",
+ "syscall.ENEEDAUTH": "syscall",
+ "syscall.ENETDOWN": "syscall",
+ "syscall.ENETRESET": "syscall",
+ "syscall.ENETUNREACH": "syscall",
+ "syscall.ENFILE": "syscall",
+ "syscall.ENOANO": "syscall",
+ "syscall.ENOATTR": "syscall",
+ "syscall.ENOBUFS": "syscall",
+ "syscall.ENOCSI": "syscall",
+ "syscall.ENODATA": "syscall",
+ "syscall.ENODEV": "syscall",
+ "syscall.ENOENT": "syscall",
+ "syscall.ENOEXEC": "syscall",
+ "syscall.ENOKEY": "syscall",
+ "syscall.ENOLCK": "syscall",
+ "syscall.ENOLINK": "syscall",
+ "syscall.ENOMEDIUM": "syscall",
+ "syscall.ENOMEM": "syscall",
+ "syscall.ENOMSG": "syscall",
+ "syscall.ENONET": "syscall",
+ "syscall.ENOPKG": "syscall",
+ "syscall.ENOPOLICY": "syscall",
+ "syscall.ENOPROTOOPT": "syscall",
+ "syscall.ENOSPC": "syscall",
+ "syscall.ENOSR": "syscall",
+ "syscall.ENOSTR": "syscall",
+ "syscall.ENOSYS": "syscall",
+ "syscall.ENOTBLK": "syscall",
+ "syscall.ENOTCAPABLE": "syscall",
+ "syscall.ENOTCONN": "syscall",
+ "syscall.ENOTDIR": "syscall",
+ "syscall.ENOTEMPTY": "syscall",
+ "syscall.ENOTNAM": "syscall",
+ "syscall.ENOTRECOVERABLE": "syscall",
+ "syscall.ENOTSOCK": "syscall",
+ "syscall.ENOTSUP": "syscall",
+ "syscall.ENOTTY": "syscall",
+ "syscall.ENOTUNIQ": "syscall",
+ "syscall.ENXIO": "syscall",
+ "syscall.EN_SW_CTL_INF": "syscall",
+ "syscall.EN_SW_CTL_PREC": "syscall",
+ "syscall.EN_SW_CTL_ROUND": "syscall",
+ "syscall.EN_SW_DATACHAIN": "syscall",
+ "syscall.EN_SW_DENORM": "syscall",
+ "syscall.EN_SW_INVOP": "syscall",
+ "syscall.EN_SW_OVERFLOW": "syscall",
+ "syscall.EN_SW_PRECLOSS": "syscall",
+ "syscall.EN_SW_UNDERFLOW": "syscall",
+ "syscall.EN_SW_ZERODIV": "syscall",
+ "syscall.EOPNOTSUPP": "syscall",
+ "syscall.EOVERFLOW": "syscall",
+ "syscall.EOWNERDEAD": "syscall",
+ "syscall.EPERM": "syscall",
+ "syscall.EPFNOSUPPORT": "syscall",
+ "syscall.EPIPE": "syscall",
+ "syscall.EPOLLERR": "syscall",
+ "syscall.EPOLLET": "syscall",
+ "syscall.EPOLLHUP": "syscall",
+ "syscall.EPOLLIN": "syscall",
+ "syscall.EPOLLMSG": "syscall",
+ "syscall.EPOLLONESHOT": "syscall",
+ "syscall.EPOLLOUT": "syscall",
+ "syscall.EPOLLPRI": "syscall",
+ "syscall.EPOLLRDBAND": "syscall",
+ "syscall.EPOLLRDHUP": "syscall",
+ "syscall.EPOLLRDNORM": "syscall",
+ "syscall.EPOLLWRBAND": "syscall",
+ "syscall.EPOLLWRNORM": "syscall",
+ "syscall.EPOLL_CLOEXEC": "syscall",
+ "syscall.EPOLL_CTL_ADD": "syscall",
+ "syscall.EPOLL_CTL_DEL": "syscall",
+ "syscall.EPOLL_CTL_MOD": "syscall",
+ "syscall.EPOLL_NONBLOCK": "syscall",
+ "syscall.EPROCLIM": "syscall",
+ "syscall.EPROCUNAVAIL": "syscall",
+ "syscall.EPROGMISMATCH": "syscall",
+ "syscall.EPROGUNAVAIL": "syscall",
+ "syscall.EPROTO": "syscall",
+ "syscall.EPROTONOSUPPORT": "syscall",
+ "syscall.EPROTOTYPE": "syscall",
+ "syscall.EPWROFF": "syscall",
+ "syscall.ERANGE": "syscall",
+ "syscall.EREMCHG": "syscall",
+ "syscall.EREMOTE": "syscall",
+ "syscall.EREMOTEIO": "syscall",
+ "syscall.ERESTART": "syscall",
+ "syscall.ERFKILL": "syscall",
+ "syscall.EROFS": "syscall",
+ "syscall.ERPCMISMATCH": "syscall",
+ "syscall.ERROR_ACCESS_DENIED": "syscall",
+ "syscall.ERROR_ALREADY_EXISTS": "syscall",
+ "syscall.ERROR_BROKEN_PIPE": "syscall",
+ "syscall.ERROR_BUFFER_OVERFLOW": "syscall",
+ "syscall.ERROR_ENVVAR_NOT_FOUND": "syscall",
+ "syscall.ERROR_FILE_EXISTS": "syscall",
+ "syscall.ERROR_FILE_NOT_FOUND": "syscall",
+ "syscall.ERROR_HANDLE_EOF": "syscall",
+ "syscall.ERROR_INSUFFICIENT_BUFFER": "syscall",
+ "syscall.ERROR_IO_PENDING": "syscall",
+ "syscall.ERROR_MOD_NOT_FOUND": "syscall",
+ "syscall.ERROR_NOT_FOUND": "syscall",
+ "syscall.ERROR_NO_MORE_FILES": "syscall",
+ "syscall.ERROR_OPERATION_ABORTED": "syscall",
+ "syscall.ERROR_PATH_NOT_FOUND": "syscall",
+ "syscall.ERROR_PROC_NOT_FOUND": "syscall",
+ "syscall.ESHLIBVERS": "syscall",
+ "syscall.ESHUTDOWN": "syscall",
+ "syscall.ESOCKTNOSUPPORT": "syscall",
+ "syscall.ESPIPE": "syscall",
+ "syscall.ESRCH": "syscall",
+ "syscall.ESRMNT": "syscall",
+ "syscall.ESTALE": "syscall",
+ "syscall.ESTRPIPE": "syscall",
+ "syscall.ETHERCAP_JUMBO_MTU": "syscall",
+ "syscall.ETHERCAP_VLAN_HWTAGGING": "syscall",
+ "syscall.ETHERCAP_VLAN_MTU": "syscall",
+ "syscall.ETHERMIN": "syscall",
+ "syscall.ETHERMTU": "syscall",
+ "syscall.ETHERMTU_JUMBO": "syscall",
+ "syscall.ETHERTYPE_8023": "syscall",
+ "syscall.ETHERTYPE_AARP": "syscall",
+ "syscall.ETHERTYPE_ACCTON": "syscall",
+ "syscall.ETHERTYPE_AEONIC": "syscall",
+ "syscall.ETHERTYPE_ALPHA": "syscall",
+ "syscall.ETHERTYPE_AMBER": "syscall",
+ "syscall.ETHERTYPE_AMOEBA": "syscall",
+ "syscall.ETHERTYPE_AOE": "syscall",
+ "syscall.ETHERTYPE_APOLLO": "syscall",
+ "syscall.ETHERTYPE_APOLLODOMAIN": "syscall",
+ "syscall.ETHERTYPE_APPLETALK": "syscall",
+ "syscall.ETHERTYPE_APPLITEK": "syscall",
+ "syscall.ETHERTYPE_ARGONAUT": "syscall",
+ "syscall.ETHERTYPE_ARP": "syscall",
+ "syscall.ETHERTYPE_AT": "syscall",
+ "syscall.ETHERTYPE_ATALK": "syscall",
+ "syscall.ETHERTYPE_ATOMIC": "syscall",
+ "syscall.ETHERTYPE_ATT": "syscall",
+ "syscall.ETHERTYPE_ATTSTANFORD": "syscall",
+ "syscall.ETHERTYPE_AUTOPHON": "syscall",
+ "syscall.ETHERTYPE_AXIS": "syscall",
+ "syscall.ETHERTYPE_BCLOOP": "syscall",
+ "syscall.ETHERTYPE_BOFL": "syscall",
+ "syscall.ETHERTYPE_CABLETRON": "syscall",
+ "syscall.ETHERTYPE_CHAOS": "syscall",
+ "syscall.ETHERTYPE_COMDESIGN": "syscall",
+ "syscall.ETHERTYPE_COMPUGRAPHIC": "syscall",
+ "syscall.ETHERTYPE_COUNTERPOINT": "syscall",
+ "syscall.ETHERTYPE_CRONUS": "syscall",
+ "syscall.ETHERTYPE_CRONUSVLN": "syscall",
+ "syscall.ETHERTYPE_DCA": "syscall",
+ "syscall.ETHERTYPE_DDE": "syscall",
+ "syscall.ETHERTYPE_DEBNI": "syscall",
+ "syscall.ETHERTYPE_DECAM": "syscall",
+ "syscall.ETHERTYPE_DECCUST": "syscall",
+ "syscall.ETHERTYPE_DECDIAG": "syscall",
+ "syscall.ETHERTYPE_DECDNS": "syscall",
+ "syscall.ETHERTYPE_DECDTS": "syscall",
+ "syscall.ETHERTYPE_DECEXPER": "syscall",
+ "syscall.ETHERTYPE_DECLAST": "syscall",
+ "syscall.ETHERTYPE_DECLTM": "syscall",
+ "syscall.ETHERTYPE_DECMUMPS": "syscall",
+ "syscall.ETHERTYPE_DECNETBIOS": "syscall",
+ "syscall.ETHERTYPE_DELTACON": "syscall",
+ "syscall.ETHERTYPE_DIDDLE": "syscall",
+ "syscall.ETHERTYPE_DLOG1": "syscall",
+ "syscall.ETHERTYPE_DLOG2": "syscall",
+ "syscall.ETHERTYPE_DN": "syscall",
+ "syscall.ETHERTYPE_DOGFIGHT": "syscall",
+ "syscall.ETHERTYPE_DSMD": "syscall",
+ "syscall.ETHERTYPE_ECMA": "syscall",
+ "syscall.ETHERTYPE_ENCRYPT": "syscall",
+ "syscall.ETHERTYPE_ES": "syscall",
+ "syscall.ETHERTYPE_EXCELAN": "syscall",
+ "syscall.ETHERTYPE_EXPERDATA": "syscall",
+ "syscall.ETHERTYPE_FLIP": "syscall",
+ "syscall.ETHERTYPE_FLOWCONTROL": "syscall",
+ "syscall.ETHERTYPE_FRARP": "syscall",
+ "syscall.ETHERTYPE_GENDYN": "syscall",
+ "syscall.ETHERTYPE_HAYES": "syscall",
+ "syscall.ETHERTYPE_HIPPI_FP": "syscall",
+ "syscall.ETHERTYPE_HITACHI": "syscall",
+ "syscall.ETHERTYPE_HP": "syscall",
+ "syscall.ETHERTYPE_IEEEPUP": "syscall",
+ "syscall.ETHERTYPE_IEEEPUPAT": "syscall",
+ "syscall.ETHERTYPE_IMLBL": "syscall",
+ "syscall.ETHERTYPE_IMLBLDIAG": "syscall",
+ "syscall.ETHERTYPE_IP": "syscall",
+ "syscall.ETHERTYPE_IPAS": "syscall",
+ "syscall.ETHERTYPE_IPV6": "syscall",
+ "syscall.ETHERTYPE_IPX": "syscall",
+ "syscall.ETHERTYPE_IPXNEW": "syscall",
+ "syscall.ETHERTYPE_KALPANA": "syscall",
+ "syscall.ETHERTYPE_LANBRIDGE": "syscall",
+ "syscall.ETHERTYPE_LANPROBE": "syscall",
+ "syscall.ETHERTYPE_LAT": "syscall",
+ "syscall.ETHERTYPE_LBACK": "syscall",
+ "syscall.ETHERTYPE_LITTLE": "syscall",
+ "syscall.ETHERTYPE_LLDP": "syscall",
+ "syscall.ETHERTYPE_LOGICRAFT": "syscall",
+ "syscall.ETHERTYPE_LOOPBACK": "syscall",
+ "syscall.ETHERTYPE_MATRA": "syscall",
+ "syscall.ETHERTYPE_MAX": "syscall",
+ "syscall.ETHERTYPE_MERIT": "syscall",
+ "syscall.ETHERTYPE_MICP": "syscall",
+ "syscall.ETHERTYPE_MOPDL": "syscall",
+ "syscall.ETHERTYPE_MOPRC": "syscall",
+ "syscall.ETHERTYPE_MOTOROLA": "syscall",
+ "syscall.ETHERTYPE_MPLS": "syscall",
+ "syscall.ETHERTYPE_MPLS_MCAST": "syscall",
+ "syscall.ETHERTYPE_MUMPS": "syscall",
+ "syscall.ETHERTYPE_NBPCC": "syscall",
+ "syscall.ETHERTYPE_NBPCLAIM": "syscall",
+ "syscall.ETHERTYPE_NBPCLREQ": "syscall",
+ "syscall.ETHERTYPE_NBPCLRSP": "syscall",
+ "syscall.ETHERTYPE_NBPCREQ": "syscall",
+ "syscall.ETHERTYPE_NBPCRSP": "syscall",
+ "syscall.ETHERTYPE_NBPDG": "syscall",
+ "syscall.ETHERTYPE_NBPDGB": "syscall",
+ "syscall.ETHERTYPE_NBPDLTE": "syscall",
+ "syscall.ETHERTYPE_NBPRAR": "syscall",
+ "syscall.ETHERTYPE_NBPRAS": "syscall",
+ "syscall.ETHERTYPE_NBPRST": "syscall",
+ "syscall.ETHERTYPE_NBPSCD": "syscall",
+ "syscall.ETHERTYPE_NBPVCD": "syscall",
+ "syscall.ETHERTYPE_NBS": "syscall",
+ "syscall.ETHERTYPE_NCD": "syscall",
+ "syscall.ETHERTYPE_NESTAR": "syscall",
+ "syscall.ETHERTYPE_NETBEUI": "syscall",
+ "syscall.ETHERTYPE_NOVELL": "syscall",
+ "syscall.ETHERTYPE_NS": "syscall",
+ "syscall.ETHERTYPE_NSAT": "syscall",
+ "syscall.ETHERTYPE_NSCOMPAT": "syscall",
+ "syscall.ETHERTYPE_NTRAILER": "syscall",
+ "syscall.ETHERTYPE_OS9": "syscall",
+ "syscall.ETHERTYPE_OS9NET": "syscall",
+ "syscall.ETHERTYPE_PACER": "syscall",
+ "syscall.ETHERTYPE_PAE": "syscall",
+ "syscall.ETHERTYPE_PCS": "syscall",
+ "syscall.ETHERTYPE_PLANNING": "syscall",
+ "syscall.ETHERTYPE_PPP": "syscall",
+ "syscall.ETHERTYPE_PPPOE": "syscall",
+ "syscall.ETHERTYPE_PPPOEDISC": "syscall",
+ "syscall.ETHERTYPE_PRIMENTS": "syscall",
+ "syscall.ETHERTYPE_PUP": "syscall",
+ "syscall.ETHERTYPE_PUPAT": "syscall",
+ "syscall.ETHERTYPE_QINQ": "syscall",
+ "syscall.ETHERTYPE_RACAL": "syscall",
+ "syscall.ETHERTYPE_RATIONAL": "syscall",
+ "syscall.ETHERTYPE_RAWFR": "syscall",
+ "syscall.ETHERTYPE_RCL": "syscall",
+ "syscall.ETHERTYPE_RDP": "syscall",
+ "syscall.ETHERTYPE_RETIX": "syscall",
+ "syscall.ETHERTYPE_REVARP": "syscall",
+ "syscall.ETHERTYPE_SCA": "syscall",
+ "syscall.ETHERTYPE_SECTRA": "syscall",
+ "syscall.ETHERTYPE_SECUREDATA": "syscall",
+ "syscall.ETHERTYPE_SGITW": "syscall",
+ "syscall.ETHERTYPE_SG_BOUNCE": "syscall",
+ "syscall.ETHERTYPE_SG_DIAG": "syscall",
+ "syscall.ETHERTYPE_SG_NETGAMES": "syscall",
+ "syscall.ETHERTYPE_SG_RESV": "syscall",
+ "syscall.ETHERTYPE_SIMNET": "syscall",
+ "syscall.ETHERTYPE_SLOW": "syscall",
+ "syscall.ETHERTYPE_SLOWPROTOCOLS": "syscall",
+ "syscall.ETHERTYPE_SNA": "syscall",
+ "syscall.ETHERTYPE_SNMP": "syscall",
+ "syscall.ETHERTYPE_SONIX": "syscall",
+ "syscall.ETHERTYPE_SPIDER": "syscall",
+ "syscall.ETHERTYPE_SPRITE": "syscall",
+ "syscall.ETHERTYPE_STP": "syscall",
+ "syscall.ETHERTYPE_TALARIS": "syscall",
+ "syscall.ETHERTYPE_TALARISMC": "syscall",
+ "syscall.ETHERTYPE_TCPCOMP": "syscall",
+ "syscall.ETHERTYPE_TCPSM": "syscall",
+ "syscall.ETHERTYPE_TEC": "syscall",
+ "syscall.ETHERTYPE_TIGAN": "syscall",
+ "syscall.ETHERTYPE_TRAIL": "syscall",
+ "syscall.ETHERTYPE_TRANSETHER": "syscall",
+ "syscall.ETHERTYPE_TYMSHARE": "syscall",
+ "syscall.ETHERTYPE_UBBST": "syscall",
+ "syscall.ETHERTYPE_UBDEBUG": "syscall",
+ "syscall.ETHERTYPE_UBDIAGLOOP": "syscall",
+ "syscall.ETHERTYPE_UBDL": "syscall",
+ "syscall.ETHERTYPE_UBNIU": "syscall",
+ "syscall.ETHERTYPE_UBNMC": "syscall",
+ "syscall.ETHERTYPE_VALID": "syscall",
+ "syscall.ETHERTYPE_VARIAN": "syscall",
+ "syscall.ETHERTYPE_VAXELN": "syscall",
+ "syscall.ETHERTYPE_VEECO": "syscall",
+ "syscall.ETHERTYPE_VEXP": "syscall",
+ "syscall.ETHERTYPE_VGLAB": "syscall",
+ "syscall.ETHERTYPE_VINES": "syscall",
+ "syscall.ETHERTYPE_VINESECHO": "syscall",
+ "syscall.ETHERTYPE_VINESLOOP": "syscall",
+ "syscall.ETHERTYPE_VITAL": "syscall",
+ "syscall.ETHERTYPE_VLAN": "syscall",
+ "syscall.ETHERTYPE_VLTLMAN": "syscall",
+ "syscall.ETHERTYPE_VPROD": "syscall",
+ "syscall.ETHERTYPE_VURESERVED": "syscall",
+ "syscall.ETHERTYPE_WATERLOO": "syscall",
+ "syscall.ETHERTYPE_WELLFLEET": "syscall",
+ "syscall.ETHERTYPE_X25": "syscall",
+ "syscall.ETHERTYPE_X75": "syscall",
+ "syscall.ETHERTYPE_XNSSM": "syscall",
+ "syscall.ETHERTYPE_XTP": "syscall",
+ "syscall.ETHER_ADDR_LEN": "syscall",
+ "syscall.ETHER_ALIGN": "syscall",
+ "syscall.ETHER_CRC_LEN": "syscall",
+ "syscall.ETHER_CRC_POLY_BE": "syscall",
+ "syscall.ETHER_CRC_POLY_LE": "syscall",
+ "syscall.ETHER_HDR_LEN": "syscall",
+ "syscall.ETHER_MAX_DIX_LEN": "syscall",
+ "syscall.ETHER_MAX_LEN": "syscall",
+ "syscall.ETHER_MAX_LEN_JUMBO": "syscall",
+ "syscall.ETHER_MIN_LEN": "syscall",
+ "syscall.ETHER_PPPOE_ENCAP_LEN": "syscall",
+ "syscall.ETHER_TYPE_LEN": "syscall",
+ "syscall.ETHER_VLAN_ENCAP_LEN": "syscall",
+ "syscall.ETH_P_1588": "syscall",
+ "syscall.ETH_P_8021Q": "syscall",
+ "syscall.ETH_P_802_2": "syscall",
+ "syscall.ETH_P_802_3": "syscall",
+ "syscall.ETH_P_AARP": "syscall",
+ "syscall.ETH_P_ALL": "syscall",
+ "syscall.ETH_P_AOE": "syscall",
+ "syscall.ETH_P_ARCNET": "syscall",
+ "syscall.ETH_P_ARP": "syscall",
+ "syscall.ETH_P_ATALK": "syscall",
+ "syscall.ETH_P_ATMFATE": "syscall",
+ "syscall.ETH_P_ATMMPOA": "syscall",
+ "syscall.ETH_P_AX25": "syscall",
+ "syscall.ETH_P_BPQ": "syscall",
+ "syscall.ETH_P_CAIF": "syscall",
+ "syscall.ETH_P_CAN": "syscall",
+ "syscall.ETH_P_CONTROL": "syscall",
+ "syscall.ETH_P_CUST": "syscall",
+ "syscall.ETH_P_DDCMP": "syscall",
+ "syscall.ETH_P_DEC": "syscall",
+ "syscall.ETH_P_DIAG": "syscall",
+ "syscall.ETH_P_DNA_DL": "syscall",
+ "syscall.ETH_P_DNA_RC": "syscall",
+ "syscall.ETH_P_DNA_RT": "syscall",
+ "syscall.ETH_P_DSA": "syscall",
+ "syscall.ETH_P_ECONET": "syscall",
+ "syscall.ETH_P_EDSA": "syscall",
+ "syscall.ETH_P_FCOE": "syscall",
+ "syscall.ETH_P_FIP": "syscall",
+ "syscall.ETH_P_HDLC": "syscall",
+ "syscall.ETH_P_IEEE802154": "syscall",
+ "syscall.ETH_P_IEEEPUP": "syscall",
+ "syscall.ETH_P_IEEEPUPAT": "syscall",
+ "syscall.ETH_P_IP": "syscall",
+ "syscall.ETH_P_IPV6": "syscall",
+ "syscall.ETH_P_IPX": "syscall",
+ "syscall.ETH_P_IRDA": "syscall",
+ "syscall.ETH_P_LAT": "syscall",
+ "syscall.ETH_P_LINK_CTL": "syscall",
+ "syscall.ETH_P_LOCALTALK": "syscall",
+ "syscall.ETH_P_LOOP": "syscall",
+ "syscall.ETH_P_MOBITEX": "syscall",
+ "syscall.ETH_P_MPLS_MC": "syscall",
+ "syscall.ETH_P_MPLS_UC": "syscall",
+ "syscall.ETH_P_PAE": "syscall",
+ "syscall.ETH_P_PAUSE": "syscall",
+ "syscall.ETH_P_PHONET": "syscall",
+ "syscall.ETH_P_PPPTALK": "syscall",
+ "syscall.ETH_P_PPP_DISC": "syscall",
+ "syscall.ETH_P_PPP_MP": "syscall",
+ "syscall.ETH_P_PPP_SES": "syscall",
+ "syscall.ETH_P_PUP": "syscall",
+ "syscall.ETH_P_PUPAT": "syscall",
+ "syscall.ETH_P_RARP": "syscall",
+ "syscall.ETH_P_SCA": "syscall",
+ "syscall.ETH_P_SLOW": "syscall",
+ "syscall.ETH_P_SNAP": "syscall",
+ "syscall.ETH_P_TEB": "syscall",
+ "syscall.ETH_P_TIPC": "syscall",
+ "syscall.ETH_P_TRAILER": "syscall",
+ "syscall.ETH_P_TR_802_2": "syscall",
+ "syscall.ETH_P_WAN_PPP": "syscall",
+ "syscall.ETH_P_WCCP": "syscall",
+ "syscall.ETH_P_X25": "syscall",
+ "syscall.ETIME": "syscall",
+ "syscall.ETIMEDOUT": "syscall",
+ "syscall.ETOOMANYREFS": "syscall",
+ "syscall.ETXTBSY": "syscall",
+ "syscall.EUCLEAN": "syscall",
+ "syscall.EUNATCH": "syscall",
+ "syscall.EUSERS": "syscall",
+ "syscall.EVFILT_AIO": "syscall",
+ "syscall.EVFILT_FS": "syscall",
+ "syscall.EVFILT_LIO": "syscall",
+ "syscall.EVFILT_MACHPORT": "syscall",
+ "syscall.EVFILT_PROC": "syscall",
+ "syscall.EVFILT_READ": "syscall",
+ "syscall.EVFILT_SIGNAL": "syscall",
+ "syscall.EVFILT_SYSCOUNT": "syscall",
+ "syscall.EVFILT_THREADMARKER": "syscall",
+ "syscall.EVFILT_TIMER": "syscall",
+ "syscall.EVFILT_USER": "syscall",
+ "syscall.EVFILT_VM": "syscall",
+ "syscall.EVFILT_VNODE": "syscall",
+ "syscall.EVFILT_WRITE": "syscall",
+ "syscall.EV_ADD": "syscall",
+ "syscall.EV_CLEAR": "syscall",
+ "syscall.EV_DELETE": "syscall",
+ "syscall.EV_DISABLE": "syscall",
+ "syscall.EV_DISPATCH": "syscall",
+ "syscall.EV_ENABLE": "syscall",
+ "syscall.EV_EOF": "syscall",
+ "syscall.EV_ERROR": "syscall",
+ "syscall.EV_FLAG0": "syscall",
+ "syscall.EV_FLAG1": "syscall",
+ "syscall.EV_ONESHOT": "syscall",
+ "syscall.EV_OOBAND": "syscall",
+ "syscall.EV_POLL": "syscall",
+ "syscall.EV_RECEIPT": "syscall",
+ "syscall.EV_SYSFLAGS": "syscall",
+ "syscall.EWINDOWS": "syscall",
+ "syscall.EWOULDBLOCK": "syscall",
+ "syscall.EXDEV": "syscall",
+ "syscall.EXFULL": "syscall",
+ "syscall.EXTA": "syscall",
+ "syscall.EXTB": "syscall",
+ "syscall.EXTPROC": "syscall",
+ "syscall.Environ": "syscall",
+ "syscall.EpollCreate": "syscall",
+ "syscall.EpollCreate1": "syscall",
+ "syscall.EpollCtl": "syscall",
+ "syscall.EpollEvent": "syscall",
+ "syscall.EpollWait": "syscall",
+ "syscall.Errno": "syscall",
+ "syscall.EscapeArg": "syscall",
+ "syscall.Exchangedata": "syscall",
+ "syscall.Exec": "syscall",
+ "syscall.Exit": "syscall",
+ "syscall.ExitProcess": "syscall",
+ "syscall.FD_CLOEXEC": "syscall",
+ "syscall.FD_SETSIZE": "syscall",
+ "syscall.FILE_ACTION_ADDED": "syscall",
+ "syscall.FILE_ACTION_MODIFIED": "syscall",
+ "syscall.FILE_ACTION_REMOVED": "syscall",
+ "syscall.FILE_ACTION_RENAMED_NEW_NAME": "syscall",
+ "syscall.FILE_ACTION_RENAMED_OLD_NAME": "syscall",
+ "syscall.FILE_APPEND_DATA": "syscall",
+ "syscall.FILE_ATTRIBUTE_ARCHIVE": "syscall",
+ "syscall.FILE_ATTRIBUTE_DIRECTORY": "syscall",
+ "syscall.FILE_ATTRIBUTE_HIDDEN": "syscall",
+ "syscall.FILE_ATTRIBUTE_NORMAL": "syscall",
+ "syscall.FILE_ATTRIBUTE_READONLY": "syscall",
+ "syscall.FILE_ATTRIBUTE_SYSTEM": "syscall",
+ "syscall.FILE_BEGIN": "syscall",
+ "syscall.FILE_CURRENT": "syscall",
+ "syscall.FILE_END": "syscall",
+ "syscall.FILE_FLAG_BACKUP_SEMANTICS": "syscall",
+ "syscall.FILE_FLAG_OVERLAPPED": "syscall",
+ "syscall.FILE_LIST_DIRECTORY": "syscall",
+ "syscall.FILE_MAP_COPY": "syscall",
+ "syscall.FILE_MAP_EXECUTE": "syscall",
+ "syscall.FILE_MAP_READ": "syscall",
+ "syscall.FILE_MAP_WRITE": "syscall",
+ "syscall.FILE_NOTIFY_CHANGE_ATTRIBUTES": "syscall",
+ "syscall.FILE_NOTIFY_CHANGE_CREATION": "syscall",
+ "syscall.FILE_NOTIFY_CHANGE_DIR_NAME": "syscall",
+ "syscall.FILE_NOTIFY_CHANGE_FILE_NAME": "syscall",
+ "syscall.FILE_NOTIFY_CHANGE_LAST_ACCESS": "syscall",
+ "syscall.FILE_NOTIFY_CHANGE_LAST_WRITE": "syscall",
+ "syscall.FILE_NOTIFY_CHANGE_SIZE": "syscall",
+ "syscall.FILE_SHARE_DELETE": "syscall",
+ "syscall.FILE_SHARE_READ": "syscall",
+ "syscall.FILE_SHARE_WRITE": "syscall",
+ "syscall.FILE_SKIP_COMPLETION_PORT_ON_SUCCESS": "syscall",
+ "syscall.FILE_SKIP_SET_EVENT_ON_HANDLE": "syscall",
+ "syscall.FILE_TYPE_CHAR": "syscall",
+ "syscall.FILE_TYPE_DISK": "syscall",
+ "syscall.FILE_TYPE_PIPE": "syscall",
+ "syscall.FILE_TYPE_REMOTE": "syscall",
+ "syscall.FILE_TYPE_UNKNOWN": "syscall",
+ "syscall.FILE_WRITE_ATTRIBUTES": "syscall",
+ "syscall.FLUSHO": "syscall",
+ "syscall.FORMAT_MESSAGE_ALLOCATE_BUFFER": "syscall",
+ "syscall.FORMAT_MESSAGE_ARGUMENT_ARRAY": "syscall",
+ "syscall.FORMAT_MESSAGE_FROM_HMODULE": "syscall",
+ "syscall.FORMAT_MESSAGE_FROM_STRING": "syscall",
+ "syscall.FORMAT_MESSAGE_FROM_SYSTEM": "syscall",
+ "syscall.FORMAT_MESSAGE_IGNORE_INSERTS": "syscall",
+ "syscall.FORMAT_MESSAGE_MAX_WIDTH_MASK": "syscall",
+ "syscall.F_ADDFILESIGS": "syscall",
+ "syscall.F_ADDSIGS": "syscall",
+ "syscall.F_ALLOCATEALL": "syscall",
+ "syscall.F_ALLOCATECONTIG": "syscall",
+ "syscall.F_CANCEL": "syscall",
+ "syscall.F_CHKCLEAN": "syscall",
+ "syscall.F_CLOSEM": "syscall",
+ "syscall.F_DUP2FD": "syscall",
+ "syscall.F_DUP2FD_CLOEXEC": "syscall",
+ "syscall.F_DUPFD": "syscall",
+ "syscall.F_DUPFD_CLOEXEC": "syscall",
+ "syscall.F_EXLCK": "syscall",
+ "syscall.F_FLUSH_DATA": "syscall",
+ "syscall.F_FREEZE_FS": "syscall",
+ "syscall.F_FSCTL": "syscall",
+ "syscall.F_FSDIRMASK": "syscall",
+ "syscall.F_FSIN": "syscall",
+ "syscall.F_FSINOUT": "syscall",
+ "syscall.F_FSOUT": "syscall",
+ "syscall.F_FSPRIV": "syscall",
+ "syscall.F_FSVOID": "syscall",
+ "syscall.F_FULLFSYNC": "syscall",
+ "syscall.F_GETFD": "syscall",
+ "syscall.F_GETFL": "syscall",
+ "syscall.F_GETLEASE": "syscall",
+ "syscall.F_GETLK": "syscall",
+ "syscall.F_GETLK64": "syscall",
+ "syscall.F_GETLKPID": "syscall",
+ "syscall.F_GETNOSIGPIPE": "syscall",
+ "syscall.F_GETOWN": "syscall",
+ "syscall.F_GETOWN_EX": "syscall",
+ "syscall.F_GETPATH": "syscall",
+ "syscall.F_GETPATH_MTMINFO": "syscall",
+ "syscall.F_GETPIPE_SZ": "syscall",
+ "syscall.F_GETPROTECTIONCLASS": "syscall",
+ "syscall.F_GETSIG": "syscall",
+ "syscall.F_GLOBAL_NOCACHE": "syscall",
+ "syscall.F_LOCK": "syscall",
+ "syscall.F_LOG2PHYS": "syscall",
+ "syscall.F_LOG2PHYS_EXT": "syscall",
+ "syscall.F_MARKDEPENDENCY": "syscall",
+ "syscall.F_MAXFD": "syscall",
+ "syscall.F_NOCACHE": "syscall",
+ "syscall.F_NODIRECT": "syscall",
+ "syscall.F_NOTIFY": "syscall",
+ "syscall.F_OGETLK": "syscall",
+ "syscall.F_OK": "syscall",
+ "syscall.F_OSETLK": "syscall",
+ "syscall.F_OSETLKW": "syscall",
+ "syscall.F_PARAM_MASK": "syscall",
+ "syscall.F_PARAM_MAX": "syscall",
+ "syscall.F_PATHPKG_CHECK": "syscall",
+ "syscall.F_PEOFPOSMODE": "syscall",
+ "syscall.F_PREALLOCATE": "syscall",
+ "syscall.F_RDADVISE": "syscall",
+ "syscall.F_RDAHEAD": "syscall",
+ "syscall.F_RDLCK": "syscall",
+ "syscall.F_READAHEAD": "syscall",
+ "syscall.F_READBOOTSTRAP": "syscall",
+ "syscall.F_SETBACKINGSTORE": "syscall",
+ "syscall.F_SETFD": "syscall",
+ "syscall.F_SETFL": "syscall",
+ "syscall.F_SETLEASE": "syscall",
+ "syscall.F_SETLK": "syscall",
+ "syscall.F_SETLK64": "syscall",
+ "syscall.F_SETLKW": "syscall",
+ "syscall.F_SETLKW64": "syscall",
+ "syscall.F_SETLK_REMOTE": "syscall",
+ "syscall.F_SETNOSIGPIPE": "syscall",
+ "syscall.F_SETOWN": "syscall",
+ "syscall.F_SETOWN_EX": "syscall",
+ "syscall.F_SETPIPE_SZ": "syscall",
+ "syscall.F_SETPROTECTIONCLASS": "syscall",
+ "syscall.F_SETSIG": "syscall",
+ "syscall.F_SETSIZE": "syscall",
+ "syscall.F_SHLCK": "syscall",
+ "syscall.F_TEST": "syscall",
+ "syscall.F_THAW_FS": "syscall",
+ "syscall.F_TLOCK": "syscall",
+ "syscall.F_ULOCK": "syscall",
+ "syscall.F_UNLCK": "syscall",
+ "syscall.F_UNLCKSYS": "syscall",
+ "syscall.F_VOLPOSMODE": "syscall",
+ "syscall.F_WRITEBOOTSTRAP": "syscall",
+ "syscall.F_WRLCK": "syscall",
+ "syscall.Faccessat": "syscall",
+ "syscall.Fallocate": "syscall",
+ "syscall.Fbootstraptransfer_t": "syscall",
+ "syscall.Fchdir": "syscall",
+ "syscall.Fchflags": "syscall",
+ "syscall.Fchmod": "syscall",
+ "syscall.Fchmodat": "syscall",
+ "syscall.Fchown": "syscall",
+ "syscall.Fchownat": "syscall",
+ "syscall.FdSet": "syscall",
+ "syscall.Fdatasync": "syscall",
+ "syscall.FileNotifyInformation": "syscall",
+ "syscall.Filetime": "syscall",
+ "syscall.FindClose": "syscall",
+ "syscall.FindFirstFile": "syscall",
+ "syscall.FindNextFile": "syscall",
+ "syscall.Flock": "syscall",
+ "syscall.Flock_t": "syscall",
+ "syscall.FlushBpf": "syscall",
+ "syscall.FlushFileBuffers": "syscall",
+ "syscall.FlushViewOfFile": "syscall",
+ "syscall.ForkExec": "syscall",
+ "syscall.ForkLock": "syscall",
+ "syscall.FormatMessage": "syscall",
+ "syscall.Fpathconf": "syscall",
+ "syscall.FreeAddrInfoW": "syscall",
+ "syscall.FreeEnvironmentStrings": "syscall",
+ "syscall.FreeLibrary": "syscall",
+ "syscall.Fsid": "syscall",
+ "syscall.Fstat": "syscall",
+ "syscall.Fstatfs": "syscall",
+ "syscall.Fstore_t": "syscall",
+ "syscall.Fsync": "syscall",
+ "syscall.Ftruncate": "syscall",
+ "syscall.Futimes": "syscall",
+ "syscall.Futimesat": "syscall",
+ "syscall.GENERIC_ALL": "syscall",
+ "syscall.GENERIC_EXECUTE": "syscall",
+ "syscall.GENERIC_READ": "syscall",
+ "syscall.GENERIC_WRITE": "syscall",
+ "syscall.GUID": "syscall",
+ "syscall.GetAcceptExSockaddrs": "syscall",
+ "syscall.GetAdaptersInfo": "syscall",
+ "syscall.GetAddrInfoW": "syscall",
+ "syscall.GetCommandLine": "syscall",
+ "syscall.GetComputerName": "syscall",
+ "syscall.GetConsoleMode": "syscall",
+ "syscall.GetCurrentDirectory": "syscall",
+ "syscall.GetCurrentProcess": "syscall",
+ "syscall.GetEnvironmentStrings": "syscall",
+ "syscall.GetEnvironmentVariable": "syscall",
+ "syscall.GetExitCodeProcess": "syscall",
+ "syscall.GetFileAttributes": "syscall",
+ "syscall.GetFileAttributesEx": "syscall",
+ "syscall.GetFileExInfoStandard": "syscall",
+ "syscall.GetFileExMaxInfoLevel": "syscall",
+ "syscall.GetFileInformationByHandle": "syscall",
+ "syscall.GetFileType": "syscall",
+ "syscall.GetFullPathName": "syscall",
+ "syscall.GetHostByName": "syscall",
+ "syscall.GetIfEntry": "syscall",
+ "syscall.GetLastError": "syscall",
+ "syscall.GetLengthSid": "syscall",
+ "syscall.GetLongPathName": "syscall",
+ "syscall.GetProcAddress": "syscall",
+ "syscall.GetProcessTimes": "syscall",
+ "syscall.GetProtoByName": "syscall",
+ "syscall.GetQueuedCompletionStatus": "syscall",
+ "syscall.GetServByName": "syscall",
+ "syscall.GetShortPathName": "syscall",
+ "syscall.GetStartupInfo": "syscall",
+ "syscall.GetStdHandle": "syscall",
+ "syscall.GetSystemTimeAsFileTime": "syscall",
+ "syscall.GetTempPath": "syscall",
+ "syscall.GetTimeZoneInformation": "syscall",
+ "syscall.GetTokenInformation": "syscall",
+ "syscall.GetUserNameEx": "syscall",
+ "syscall.GetUserProfileDirectory": "syscall",
+ "syscall.GetVersion": "syscall",
+ "syscall.Getcwd": "syscall",
+ "syscall.Getdents": "syscall",
+ "syscall.Getdirentries": "syscall",
+ "syscall.Getdtablesize": "syscall",
+ "syscall.Getegid": "syscall",
+ "syscall.Getenv": "syscall",
+ "syscall.Geteuid": "syscall",
+ "syscall.Getfsstat": "syscall",
+ "syscall.Getgid": "syscall",
+ "syscall.Getgroups": "syscall",
+ "syscall.Getpagesize": "syscall",
+ "syscall.Getpeername": "syscall",
+ "syscall.Getpgid": "syscall",
+ "syscall.Getpgrp": "syscall",
+ "syscall.Getpid": "syscall",
+ "syscall.Getppid": "syscall",
+ "syscall.Getpriority": "syscall",
+ "syscall.Getrlimit": "syscall",
+ "syscall.Getrusage": "syscall",
+ "syscall.Getsid": "syscall",
+ "syscall.Getsockname": "syscall",
+ "syscall.Getsockopt": "syscall",
+ "syscall.GetsockoptByte": "syscall",
+ "syscall.GetsockoptICMPv6Filter": "syscall",
+ "syscall.GetsockoptIPMreq": "syscall",
+ "syscall.GetsockoptIPMreqn": "syscall",
+ "syscall.GetsockoptIPv6MTUInfo": "syscall",
+ "syscall.GetsockoptIPv6Mreq": "syscall",
+ "syscall.GetsockoptInet4Addr": "syscall",
+ "syscall.GetsockoptInt": "syscall",
+ "syscall.GetsockoptUcred": "syscall",
+ "syscall.Gettid": "syscall",
+ "syscall.Gettimeofday": "syscall",
+ "syscall.Getuid": "syscall",
+ "syscall.Getwd": "syscall",
+ "syscall.Getxattr": "syscall",
+ "syscall.HANDLE_FLAG_INHERIT": "syscall",
+ "syscall.HKEY_CLASSES_ROOT": "syscall",
+ "syscall.HKEY_CURRENT_CONFIG": "syscall",
+ "syscall.HKEY_CURRENT_USER": "syscall",
+ "syscall.HKEY_DYN_DATA": "syscall",
+ "syscall.HKEY_LOCAL_MACHINE": "syscall",
+ "syscall.HKEY_PERFORMANCE_DATA": "syscall",
+ "syscall.HKEY_USERS": "syscall",
+ "syscall.HUPCL": "syscall",
+ "syscall.Handle": "syscall",
+ "syscall.Hostent": "syscall",
+ "syscall.ICANON": "syscall",
+ "syscall.ICMP6_FILTER": "syscall",
+ "syscall.ICMPV6_FILTER": "syscall",
+ "syscall.ICMPv6Filter": "syscall",
+ "syscall.ICRNL": "syscall",
+ "syscall.IEXTEN": "syscall",
+ "syscall.IFAN_ARRIVAL": "syscall",
+ "syscall.IFAN_DEPARTURE": "syscall",
+ "syscall.IFA_ADDRESS": "syscall",
+ "syscall.IFA_ANYCAST": "syscall",
+ "syscall.IFA_BROADCAST": "syscall",
+ "syscall.IFA_CACHEINFO": "syscall",
+ "syscall.IFA_F_DADFAILED": "syscall",
+ "syscall.IFA_F_DEPRECATED": "syscall",
+ "syscall.IFA_F_HOMEADDRESS": "syscall",
+ "syscall.IFA_F_NODAD": "syscall",
+ "syscall.IFA_F_OPTIMISTIC": "syscall",
+ "syscall.IFA_F_PERMANENT": "syscall",
+ "syscall.IFA_F_SECONDARY": "syscall",
+ "syscall.IFA_F_TEMPORARY": "syscall",
+ "syscall.IFA_F_TENTATIVE": "syscall",
+ "syscall.IFA_LABEL": "syscall",
+ "syscall.IFA_LOCAL": "syscall",
+ "syscall.IFA_MAX": "syscall",
+ "syscall.IFA_MULTICAST": "syscall",
+ "syscall.IFA_ROUTE": "syscall",
+ "syscall.IFA_UNSPEC": "syscall",
+ "syscall.IFF_ALLMULTI": "syscall",
+ "syscall.IFF_ALTPHYS": "syscall",
+ "syscall.IFF_AUTOMEDIA": "syscall",
+ "syscall.IFF_BROADCAST": "syscall",
+ "syscall.IFF_CANTCHANGE": "syscall",
+ "syscall.IFF_CANTCONFIG": "syscall",
+ "syscall.IFF_DEBUG": "syscall",
+ "syscall.IFF_DRV_OACTIVE": "syscall",
+ "syscall.IFF_DRV_RUNNING": "syscall",
+ "syscall.IFF_DYING": "syscall",
+ "syscall.IFF_DYNAMIC": "syscall",
+ "syscall.IFF_LINK0": "syscall",
+ "syscall.IFF_LINK1": "syscall",
+ "syscall.IFF_LINK2": "syscall",
+ "syscall.IFF_LOOPBACK": "syscall",
+ "syscall.IFF_MASTER": "syscall",
+ "syscall.IFF_MONITOR": "syscall",
+ "syscall.IFF_MULTICAST": "syscall",
+ "syscall.IFF_NOARP": "syscall",
+ "syscall.IFF_NOTRAILERS": "syscall",
+ "syscall.IFF_NO_PI": "syscall",
+ "syscall.IFF_OACTIVE": "syscall",
+ "syscall.IFF_ONE_QUEUE": "syscall",
+ "syscall.IFF_POINTOPOINT": "syscall",
+ "syscall.IFF_POINTTOPOINT": "syscall",
+ "syscall.IFF_PORTSEL": "syscall",
+ "syscall.IFF_PPROMISC": "syscall",
+ "syscall.IFF_PROMISC": "syscall",
+ "syscall.IFF_RENAMING": "syscall",
+ "syscall.IFF_RUNNING": "syscall",
+ "syscall.IFF_SIMPLEX": "syscall",
+ "syscall.IFF_SLAVE": "syscall",
+ "syscall.IFF_SMART": "syscall",
+ "syscall.IFF_STATICARP": "syscall",
+ "syscall.IFF_TAP": "syscall",
+ "syscall.IFF_TUN": "syscall",
+ "syscall.IFF_TUN_EXCL": "syscall",
+ "syscall.IFF_UP": "syscall",
+ "syscall.IFF_VNET_HDR": "syscall",
+ "syscall.IFLA_ADDRESS": "syscall",
+ "syscall.IFLA_BROADCAST": "syscall",
+ "syscall.IFLA_COST": "syscall",
+ "syscall.IFLA_IFALIAS": "syscall",
+ "syscall.IFLA_IFNAME": "syscall",
+ "syscall.IFLA_LINK": "syscall",
+ "syscall.IFLA_LINKINFO": "syscall",
+ "syscall.IFLA_LINKMODE": "syscall",
+ "syscall.IFLA_MAP": "syscall",
+ "syscall.IFLA_MASTER": "syscall",
+ "syscall.IFLA_MAX": "syscall",
+ "syscall.IFLA_MTU": "syscall",
+ "syscall.IFLA_NET_NS_PID": "syscall",
+ "syscall.IFLA_OPERSTATE": "syscall",
+ "syscall.IFLA_PRIORITY": "syscall",
+ "syscall.IFLA_PROTINFO": "syscall",
+ "syscall.IFLA_QDISC": "syscall",
+ "syscall.IFLA_STATS": "syscall",
+ "syscall.IFLA_TXQLEN": "syscall",
+ "syscall.IFLA_UNSPEC": "syscall",
+ "syscall.IFLA_WEIGHT": "syscall",
+ "syscall.IFLA_WIRELESS": "syscall",
+ "syscall.IFNAMSIZ": "syscall",
+ "syscall.IFT_1822": "syscall",
+ "syscall.IFT_A12MPPSWITCH": "syscall",
+ "syscall.IFT_AAL2": "syscall",
+ "syscall.IFT_AAL5": "syscall",
+ "syscall.IFT_ADSL": "syscall",
+ "syscall.IFT_AFLANE8023": "syscall",
+ "syscall.IFT_AFLANE8025": "syscall",
+ "syscall.IFT_ARAP": "syscall",
+ "syscall.IFT_ARCNET": "syscall",
+ "syscall.IFT_ARCNETPLUS": "syscall",
+ "syscall.IFT_ASYNC": "syscall",
+ "syscall.IFT_ATM": "syscall",
+ "syscall.IFT_ATMDXI": "syscall",
+ "syscall.IFT_ATMFUNI": "syscall",
+ "syscall.IFT_ATMIMA": "syscall",
+ "syscall.IFT_ATMLOGICAL": "syscall",
+ "syscall.IFT_ATMRADIO": "syscall",
+ "syscall.IFT_ATMSUBINTERFACE": "syscall",
+ "syscall.IFT_ATMVCIENDPT": "syscall",
+ "syscall.IFT_ATMVIRTUAL": "syscall",
+ "syscall.IFT_BGPPOLICYACCOUNTING": "syscall",
+ "syscall.IFT_BLUETOOTH": "syscall",
+ "syscall.IFT_BRIDGE": "syscall",
+ "syscall.IFT_BSC": "syscall",
+ "syscall.IFT_CARP": "syscall",
+ "syscall.IFT_CCTEMUL": "syscall",
+ "syscall.IFT_CELLULAR": "syscall",
+ "syscall.IFT_CEPT": "syscall",
+ "syscall.IFT_CES": "syscall",
+ "syscall.IFT_CHANNEL": "syscall",
+ "syscall.IFT_CNR": "syscall",
+ "syscall.IFT_COFFEE": "syscall",
+ "syscall.IFT_COMPOSITELINK": "syscall",
+ "syscall.IFT_DCN": "syscall",
+ "syscall.IFT_DIGITALPOWERLINE": "syscall",
+ "syscall.IFT_DIGITALWRAPPEROVERHEADCHANNEL": "syscall",
+ "syscall.IFT_DLSW": "syscall",
+ "syscall.IFT_DOCSCABLEDOWNSTREAM": "syscall",
+ "syscall.IFT_DOCSCABLEMACLAYER": "syscall",
+ "syscall.IFT_DOCSCABLEUPSTREAM": "syscall",
+ "syscall.IFT_DOCSCABLEUPSTREAMCHANNEL": "syscall",
+ "syscall.IFT_DS0": "syscall",
+ "syscall.IFT_DS0BUNDLE": "syscall",
+ "syscall.IFT_DS1FDL": "syscall",
+ "syscall.IFT_DS3": "syscall",
+ "syscall.IFT_DTM": "syscall",
+ "syscall.IFT_DUMMY": "syscall",
+ "syscall.IFT_DVBASILN": "syscall",
+ "syscall.IFT_DVBASIOUT": "syscall",
+ "syscall.IFT_DVBRCCDOWNSTREAM": "syscall",
+ "syscall.IFT_DVBRCCMACLAYER": "syscall",
+ "syscall.IFT_DVBRCCUPSTREAM": "syscall",
+ "syscall.IFT_ECONET": "syscall",
+ "syscall.IFT_ENC": "syscall",
+ "syscall.IFT_EON": "syscall",
+ "syscall.IFT_EPLRS": "syscall",
+ "syscall.IFT_ESCON": "syscall",
+ "syscall.IFT_ETHER": "syscall",
+ "syscall.IFT_FAITH": "syscall",
+ "syscall.IFT_FAST": "syscall",
+ "syscall.IFT_FASTETHER": "syscall",
+ "syscall.IFT_FASTETHERFX": "syscall",
+ "syscall.IFT_FDDI": "syscall",
+ "syscall.IFT_FIBRECHANNEL": "syscall",
+ "syscall.IFT_FRAMERELAYINTERCONNECT": "syscall",
+ "syscall.IFT_FRAMERELAYMPI": "syscall",
+ "syscall.IFT_FRDLCIENDPT": "syscall",
+ "syscall.IFT_FRELAY": "syscall",
+ "syscall.IFT_FRELAYDCE": "syscall",
+ "syscall.IFT_FRF16MFRBUNDLE": "syscall",
+ "syscall.IFT_FRFORWARD": "syscall",
+ "syscall.IFT_G703AT2MB": "syscall",
+ "syscall.IFT_G703AT64K": "syscall",
+ "syscall.IFT_GIF": "syscall",
+ "syscall.IFT_GIGABITETHERNET": "syscall",
+ "syscall.IFT_GR303IDT": "syscall",
+ "syscall.IFT_GR303RDT": "syscall",
+ "syscall.IFT_H323GATEKEEPER": "syscall",
+ "syscall.IFT_H323PROXY": "syscall",
+ "syscall.IFT_HDH1822": "syscall",
+ "syscall.IFT_HDLC": "syscall",
+ "syscall.IFT_HDSL2": "syscall",
+ "syscall.IFT_HIPERLAN2": "syscall",
+ "syscall.IFT_HIPPI": "syscall",
+ "syscall.IFT_HIPPIINTERFACE": "syscall",
+ "syscall.IFT_HOSTPAD": "syscall",
+ "syscall.IFT_HSSI": "syscall",
+ "syscall.IFT_HY": "syscall",
+ "syscall.IFT_IBM370PARCHAN": "syscall",
+ "syscall.IFT_IDSL": "syscall",
+ "syscall.IFT_IEEE1394": "syscall",
+ "syscall.IFT_IEEE80211": "syscall",
+ "syscall.IFT_IEEE80212": "syscall",
+ "syscall.IFT_IEEE8023ADLAG": "syscall",
+ "syscall.IFT_IFGSN": "syscall",
+ "syscall.IFT_IMT": "syscall",
+ "syscall.IFT_INFINIBAND": "syscall",
+ "syscall.IFT_INTERLEAVE": "syscall",
+ "syscall.IFT_IP": "syscall",
+ "syscall.IFT_IPFORWARD": "syscall",
+ "syscall.IFT_IPOVERATM": "syscall",
+ "syscall.IFT_IPOVERCDLC": "syscall",
+ "syscall.IFT_IPOVERCLAW": "syscall",
+ "syscall.IFT_IPSWITCH": "syscall",
+ "syscall.IFT_IPXIP": "syscall",
+ "syscall.IFT_ISDN": "syscall",
+ "syscall.IFT_ISDNBASIC": "syscall",
+ "syscall.IFT_ISDNPRIMARY": "syscall",
+ "syscall.IFT_ISDNS": "syscall",
+ "syscall.IFT_ISDNU": "syscall",
+ "syscall.IFT_ISO88022LLC": "syscall",
+ "syscall.IFT_ISO88023": "syscall",
+ "syscall.IFT_ISO88024": "syscall",
+ "syscall.IFT_ISO88025": "syscall",
+ "syscall.IFT_ISO88025CRFPINT": "syscall",
+ "syscall.IFT_ISO88025DTR": "syscall",
+ "syscall.IFT_ISO88025FIBER": "syscall",
+ "syscall.IFT_ISO88026": "syscall",
+ "syscall.IFT_ISUP": "syscall",
+ "syscall.IFT_L2VLAN": "syscall",
+ "syscall.IFT_L3IPVLAN": "syscall",
+ "syscall.IFT_L3IPXVLAN": "syscall",
+ "syscall.IFT_LAPB": "syscall",
+ "syscall.IFT_LAPD": "syscall",
+ "syscall.IFT_LAPF": "syscall",
+ "syscall.IFT_LINEGROUP": "syscall",
+ "syscall.IFT_LOCALTALK": "syscall",
+ "syscall.IFT_LOOP": "syscall",
+ "syscall.IFT_MEDIAMAILOVERIP": "syscall",
+ "syscall.IFT_MFSIGLINK": "syscall",
+ "syscall.IFT_MIOX25": "syscall",
+ "syscall.IFT_MODEM": "syscall",
+ "syscall.IFT_MPC": "syscall",
+ "syscall.IFT_MPLS": "syscall",
+ "syscall.IFT_MPLSTUNNEL": "syscall",
+ "syscall.IFT_MSDSL": "syscall",
+ "syscall.IFT_MVL": "syscall",
+ "syscall.IFT_MYRINET": "syscall",
+ "syscall.IFT_NFAS": "syscall",
+ "syscall.IFT_NSIP": "syscall",
+ "syscall.IFT_OPTICALCHANNEL": "syscall",
+ "syscall.IFT_OPTICALTRANSPORT": "syscall",
+ "syscall.IFT_OTHER": "syscall",
+ "syscall.IFT_P10": "syscall",
+ "syscall.IFT_P80": "syscall",
+ "syscall.IFT_PARA": "syscall",
+ "syscall.IFT_PDP": "syscall",
+ "syscall.IFT_PFLOG": "syscall",
+ "syscall.IFT_PFLOW": "syscall",
+ "syscall.IFT_PFSYNC": "syscall",
+ "syscall.IFT_PLC": "syscall",
+ "syscall.IFT_PON155": "syscall",
+ "syscall.IFT_PON622": "syscall",
+ "syscall.IFT_POS": "syscall",
+ "syscall.IFT_PPP": "syscall",
+ "syscall.IFT_PPPMULTILINKBUNDLE": "syscall",
+ "syscall.IFT_PROPATM": "syscall",
+ "syscall.IFT_PROPBWAP2MP": "syscall",
+ "syscall.IFT_PROPCNLS": "syscall",
+ "syscall.IFT_PROPDOCSWIRELESSDOWNSTREAM": "syscall",
+ "syscall.IFT_PROPDOCSWIRELESSMACLAYER": "syscall",
+ "syscall.IFT_PROPDOCSWIRELESSUPSTREAM": "syscall",
+ "syscall.IFT_PROPMUX": "syscall",
+ "syscall.IFT_PROPVIRTUAL": "syscall",
+ "syscall.IFT_PROPWIRELESSP2P": "syscall",
+ "syscall.IFT_PTPSERIAL": "syscall",
+ "syscall.IFT_PVC": "syscall",
+ "syscall.IFT_Q2931": "syscall",
+ "syscall.IFT_QLLC": "syscall",
+ "syscall.IFT_RADIOMAC": "syscall",
+ "syscall.IFT_RADSL": "syscall",
+ "syscall.IFT_REACHDSL": "syscall",
+ "syscall.IFT_RFC1483": "syscall",
+ "syscall.IFT_RS232": "syscall",
+ "syscall.IFT_RSRB": "syscall",
+ "syscall.IFT_SDLC": "syscall",
+ "syscall.IFT_SDSL": "syscall",
+ "syscall.IFT_SHDSL": "syscall",
+ "syscall.IFT_SIP": "syscall",
+ "syscall.IFT_SIPSIG": "syscall",
+ "syscall.IFT_SIPTG": "syscall",
+ "syscall.IFT_SLIP": "syscall",
+ "syscall.IFT_SMDSDXI": "syscall",
+ "syscall.IFT_SMDSICIP": "syscall",
+ "syscall.IFT_SONET": "syscall",
+ "syscall.IFT_SONETOVERHEADCHANNEL": "syscall",
+ "syscall.IFT_SONETPATH": "syscall",
+ "syscall.IFT_SONETVT": "syscall",
+ "syscall.IFT_SRP": "syscall",
+ "syscall.IFT_SS7SIGLINK": "syscall",
+ "syscall.IFT_STACKTOSTACK": "syscall",
+ "syscall.IFT_STARLAN": "syscall",
+ "syscall.IFT_STF": "syscall",
+ "syscall.IFT_T1": "syscall",
+ "syscall.IFT_TDLC": "syscall",
+ "syscall.IFT_TELINK": "syscall",
+ "syscall.IFT_TERMPAD": "syscall",
+ "syscall.IFT_TR008": "syscall",
+ "syscall.IFT_TRANSPHDLC": "syscall",
+ "syscall.IFT_TUNNEL": "syscall",
+ "syscall.IFT_ULTRA": "syscall",
+ "syscall.IFT_USB": "syscall",
+ "syscall.IFT_V11": "syscall",
+ "syscall.IFT_V35": "syscall",
+ "syscall.IFT_V36": "syscall",
+ "syscall.IFT_V37": "syscall",
+ "syscall.IFT_VDSL": "syscall",
+ "syscall.IFT_VIRTUALIPADDRESS": "syscall",
+ "syscall.IFT_VIRTUALTG": "syscall",
+ "syscall.IFT_VOICEDID": "syscall",
+ "syscall.IFT_VOICEEM": "syscall",
+ "syscall.IFT_VOICEEMFGD": "syscall",
+ "syscall.IFT_VOICEENCAP": "syscall",
+ "syscall.IFT_VOICEFGDEANA": "syscall",
+ "syscall.IFT_VOICEFXO": "syscall",
+ "syscall.IFT_VOICEFXS": "syscall",
+ "syscall.IFT_VOICEOVERATM": "syscall",
+ "syscall.IFT_VOICEOVERCABLE": "syscall",
+ "syscall.IFT_VOICEOVERFRAMERELAY": "syscall",
+ "syscall.IFT_VOICEOVERIP": "syscall",
+ "syscall.IFT_X213": "syscall",
+ "syscall.IFT_X25": "syscall",
+ "syscall.IFT_X25DDN": "syscall",
+ "syscall.IFT_X25HUNTGROUP": "syscall",
+ "syscall.IFT_X25MLP": "syscall",
+ "syscall.IFT_X25PLE": "syscall",
+ "syscall.IFT_XETHER": "syscall",
+ "syscall.IGNBRK": "syscall",
+ "syscall.IGNCR": "syscall",
+ "syscall.IGNORE": "syscall",
+ "syscall.IGNPAR": "syscall",
+ "syscall.IMAXBEL": "syscall",
+ "syscall.INFINITE": "syscall",
+ "syscall.INLCR": "syscall",
+ "syscall.INPCK": "syscall",
+ "syscall.INVALID_FILE_ATTRIBUTES": "syscall",
+ "syscall.IN_ACCESS": "syscall",
+ "syscall.IN_ALL_EVENTS": "syscall",
+ "syscall.IN_ATTRIB": "syscall",
+ "syscall.IN_CLASSA_HOST": "syscall",
+ "syscall.IN_CLASSA_MAX": "syscall",
+ "syscall.IN_CLASSA_NET": "syscall",
+ "syscall.IN_CLASSA_NSHIFT": "syscall",
+ "syscall.IN_CLASSB_HOST": "syscall",
+ "syscall.IN_CLASSB_MAX": "syscall",
+ "syscall.IN_CLASSB_NET": "syscall",
+ "syscall.IN_CLASSB_NSHIFT": "syscall",
+ "syscall.IN_CLASSC_HOST": "syscall",
+ "syscall.IN_CLASSC_NET": "syscall",
+ "syscall.IN_CLASSC_NSHIFT": "syscall",
+ "syscall.IN_CLASSD_HOST": "syscall",
+ "syscall.IN_CLASSD_NET": "syscall",
+ "syscall.IN_CLASSD_NSHIFT": "syscall",
+ "syscall.IN_CLOEXEC": "syscall",
+ "syscall.IN_CLOSE": "syscall",
+ "syscall.IN_CLOSE_NOWRITE": "syscall",
+ "syscall.IN_CLOSE_WRITE": "syscall",
+ "syscall.IN_CREATE": "syscall",
+ "syscall.IN_DELETE": "syscall",
+ "syscall.IN_DELETE_SELF": "syscall",
+ "syscall.IN_DONT_FOLLOW": "syscall",
+ "syscall.IN_EXCL_UNLINK": "syscall",
+ "syscall.IN_IGNORED": "syscall",
+ "syscall.IN_ISDIR": "syscall",
+ "syscall.IN_LINKLOCALNETNUM": "syscall",
+ "syscall.IN_LOOPBACKNET": "syscall",
+ "syscall.IN_MASK_ADD": "syscall",
+ "syscall.IN_MODIFY": "syscall",
+ "syscall.IN_MOVE": "syscall",
+ "syscall.IN_MOVED_FROM": "syscall",
+ "syscall.IN_MOVED_TO": "syscall",
+ "syscall.IN_MOVE_SELF": "syscall",
+ "syscall.IN_NONBLOCK": "syscall",
+ "syscall.IN_ONESHOT": "syscall",
+ "syscall.IN_ONLYDIR": "syscall",
+ "syscall.IN_OPEN": "syscall",
+ "syscall.IN_Q_OVERFLOW": "syscall",
+ "syscall.IN_RFC3021_HOST": "syscall",
+ "syscall.IN_RFC3021_MASK": "syscall",
+ "syscall.IN_RFC3021_NET": "syscall",
+ "syscall.IN_RFC3021_NSHIFT": "syscall",
+ "syscall.IN_UNMOUNT": "syscall",
+ "syscall.IOC_IN": "syscall",
+ "syscall.IOC_INOUT": "syscall",
+ "syscall.IOC_OUT": "syscall",
+ "syscall.IOC_WS2": "syscall",
+ "syscall.IPMreq": "syscall",
+ "syscall.IPMreqn": "syscall",
+ "syscall.IPPROTO_3PC": "syscall",
+ "syscall.IPPROTO_ADFS": "syscall",
+ "syscall.IPPROTO_AH": "syscall",
+ "syscall.IPPROTO_AHIP": "syscall",
+ "syscall.IPPROTO_APES": "syscall",
+ "syscall.IPPROTO_ARGUS": "syscall",
+ "syscall.IPPROTO_AX25": "syscall",
+ "syscall.IPPROTO_BHA": "syscall",
+ "syscall.IPPROTO_BLT": "syscall",
+ "syscall.IPPROTO_BRSATMON": "syscall",
+ "syscall.IPPROTO_CARP": "syscall",
+ "syscall.IPPROTO_CFTP": "syscall",
+ "syscall.IPPROTO_CHAOS": "syscall",
+ "syscall.IPPROTO_CMTP": "syscall",
+ "syscall.IPPROTO_COMP": "syscall",
+ "syscall.IPPROTO_CPHB": "syscall",
+ "syscall.IPPROTO_CPNX": "syscall",
+ "syscall.IPPROTO_DCCP": "syscall",
+ "syscall.IPPROTO_DDP": "syscall",
+ "syscall.IPPROTO_DGP": "syscall",
+ "syscall.IPPROTO_DIVERT": "syscall",
+ "syscall.IPPROTO_DONE": "syscall",
+ "syscall.IPPROTO_DSTOPTS": "syscall",
+ "syscall.IPPROTO_EGP": "syscall",
+ "syscall.IPPROTO_EMCON": "syscall",
+ "syscall.IPPROTO_ENCAP": "syscall",
+ "syscall.IPPROTO_EON": "syscall",
+ "syscall.IPPROTO_ESP": "syscall",
+ "syscall.IPPROTO_ETHERIP": "syscall",
+ "syscall.IPPROTO_FRAGMENT": "syscall",
+ "syscall.IPPROTO_GGP": "syscall",
+ "syscall.IPPROTO_GMTP": "syscall",
+ "syscall.IPPROTO_GRE": "syscall",
+ "syscall.IPPROTO_HELLO": "syscall",
+ "syscall.IPPROTO_HMP": "syscall",
+ "syscall.IPPROTO_HOPOPTS": "syscall",
+ "syscall.IPPROTO_ICMP": "syscall",
+ "syscall.IPPROTO_ICMPV6": "syscall",
+ "syscall.IPPROTO_IDP": "syscall",
+ "syscall.IPPROTO_IDPR": "syscall",
+ "syscall.IPPROTO_IDRP": "syscall",
+ "syscall.IPPROTO_IGMP": "syscall",
+ "syscall.IPPROTO_IGP": "syscall",
+ "syscall.IPPROTO_IGRP": "syscall",
+ "syscall.IPPROTO_IL": "syscall",
+ "syscall.IPPROTO_INLSP": "syscall",
+ "syscall.IPPROTO_INP": "syscall",
+ "syscall.IPPROTO_IP": "syscall",
+ "syscall.IPPROTO_IPCOMP": "syscall",
+ "syscall.IPPROTO_IPCV": "syscall",
+ "syscall.IPPROTO_IPEIP": "syscall",
+ "syscall.IPPROTO_IPIP": "syscall",
+ "syscall.IPPROTO_IPPC": "syscall",
+ "syscall.IPPROTO_IPV4": "syscall",
+ "syscall.IPPROTO_IPV6": "syscall",
+ "syscall.IPPROTO_IPV6_ICMP": "syscall",
+ "syscall.IPPROTO_IRTP": "syscall",
+ "syscall.IPPROTO_KRYPTOLAN": "syscall",
+ "syscall.IPPROTO_LARP": "syscall",
+ "syscall.IPPROTO_LEAF1": "syscall",
+ "syscall.IPPROTO_LEAF2": "syscall",
+ "syscall.IPPROTO_MAX": "syscall",
+ "syscall.IPPROTO_MAXID": "syscall",
+ "syscall.IPPROTO_MEAS": "syscall",
+ "syscall.IPPROTO_MH": "syscall",
+ "syscall.IPPROTO_MHRP": "syscall",
+ "syscall.IPPROTO_MICP": "syscall",
+ "syscall.IPPROTO_MOBILE": "syscall",
+ "syscall.IPPROTO_MPLS": "syscall",
+ "syscall.IPPROTO_MTP": "syscall",
+ "syscall.IPPROTO_MUX": "syscall",
+ "syscall.IPPROTO_ND": "syscall",
+ "syscall.IPPROTO_NHRP": "syscall",
+ "syscall.IPPROTO_NONE": "syscall",
+ "syscall.IPPROTO_NSP": "syscall",
+ "syscall.IPPROTO_NVPII": "syscall",
+ "syscall.IPPROTO_OLD_DIVERT": "syscall",
+ "syscall.IPPROTO_OSPFIGP": "syscall",
+ "syscall.IPPROTO_PFSYNC": "syscall",
+ "syscall.IPPROTO_PGM": "syscall",
+ "syscall.IPPROTO_PIGP": "syscall",
+ "syscall.IPPROTO_PIM": "syscall",
+ "syscall.IPPROTO_PRM": "syscall",
+ "syscall.IPPROTO_PUP": "syscall",
+ "syscall.IPPROTO_PVP": "syscall",
+ "syscall.IPPROTO_RAW": "syscall",
+ "syscall.IPPROTO_RCCMON": "syscall",
+ "syscall.IPPROTO_RDP": "syscall",
+ "syscall.IPPROTO_ROUTING": "syscall",
+ "syscall.IPPROTO_RSVP": "syscall",
+ "syscall.IPPROTO_RVD": "syscall",
+ "syscall.IPPROTO_SATEXPAK": "syscall",
+ "syscall.IPPROTO_SATMON": "syscall",
+ "syscall.IPPROTO_SCCSP": "syscall",
+ "syscall.IPPROTO_SCTP": "syscall",
+ "syscall.IPPROTO_SDRP": "syscall",
+ "syscall.IPPROTO_SEND": "syscall",
+ "syscall.IPPROTO_SEP": "syscall",
+ "syscall.IPPROTO_SKIP": "syscall",
+ "syscall.IPPROTO_SPACER": "syscall",
+ "syscall.IPPROTO_SRPC": "syscall",
+ "syscall.IPPROTO_ST": "syscall",
+ "syscall.IPPROTO_SVMTP": "syscall",
+ "syscall.IPPROTO_SWIPE": "syscall",
+ "syscall.IPPROTO_TCF": "syscall",
+ "syscall.IPPROTO_TCP": "syscall",
+ "syscall.IPPROTO_TLSP": "syscall",
+ "syscall.IPPROTO_TP": "syscall",
+ "syscall.IPPROTO_TPXX": "syscall",
+ "syscall.IPPROTO_TRUNK1": "syscall",
+ "syscall.IPPROTO_TRUNK2": "syscall",
+ "syscall.IPPROTO_TTP": "syscall",
+ "syscall.IPPROTO_UDP": "syscall",
+ "syscall.IPPROTO_UDPLITE": "syscall",
+ "syscall.IPPROTO_VINES": "syscall",
+ "syscall.IPPROTO_VISA": "syscall",
+ "syscall.IPPROTO_VMTP": "syscall",
+ "syscall.IPPROTO_VRRP": "syscall",
+ "syscall.IPPROTO_WBEXPAK": "syscall",
+ "syscall.IPPROTO_WBMON": "syscall",
+ "syscall.IPPROTO_WSN": "syscall",
+ "syscall.IPPROTO_XNET": "syscall",
+ "syscall.IPPROTO_XTP": "syscall",
+ "syscall.IPV6_2292DSTOPTS": "syscall",
+ "syscall.IPV6_2292HOPLIMIT": "syscall",
+ "syscall.IPV6_2292HOPOPTS": "syscall",
+ "syscall.IPV6_2292NEXTHOP": "syscall",
+ "syscall.IPV6_2292PKTINFO": "syscall",
+ "syscall.IPV6_2292PKTOPTIONS": "syscall",
+ "syscall.IPV6_2292RTHDR": "syscall",
+ "syscall.IPV6_ADDRFORM": "syscall",
+ "syscall.IPV6_ADD_MEMBERSHIP": "syscall",
+ "syscall.IPV6_AUTHHDR": "syscall",
+ "syscall.IPV6_AUTH_LEVEL": "syscall",
+ "syscall.IPV6_AUTOFLOWLABEL": "syscall",
+ "syscall.IPV6_BINDANY": "syscall",
+ "syscall.IPV6_BINDV6ONLY": "syscall",
+ "syscall.IPV6_BOUND_IF": "syscall",
+ "syscall.IPV6_CHECKSUM": "syscall",
+ "syscall.IPV6_DEFAULT_MULTICAST_HOPS": "syscall",
+ "syscall.IPV6_DEFAULT_MULTICAST_LOOP": "syscall",
+ "syscall.IPV6_DEFHLIM": "syscall",
+ "syscall.IPV6_DONTFRAG": "syscall",
+ "syscall.IPV6_DROP_MEMBERSHIP": "syscall",
+ "syscall.IPV6_DSTOPTS": "syscall",
+ "syscall.IPV6_ESP_NETWORK_LEVEL": "syscall",
+ "syscall.IPV6_ESP_TRANS_LEVEL": "syscall",
+ "syscall.IPV6_FAITH": "syscall",
+ "syscall.IPV6_FLOWINFO_MASK": "syscall",
+ "syscall.IPV6_FLOWLABEL_MASK": "syscall",
+ "syscall.IPV6_FRAGTTL": "syscall",
+ "syscall.IPV6_FW_ADD": "syscall",
+ "syscall.IPV6_FW_DEL": "syscall",
+ "syscall.IPV6_FW_FLUSH": "syscall",
+ "syscall.IPV6_FW_GET": "syscall",
+ "syscall.IPV6_FW_ZERO": "syscall",
+ "syscall.IPV6_HLIMDEC": "syscall",
+ "syscall.IPV6_HOPLIMIT": "syscall",
+ "syscall.IPV6_HOPOPTS": "syscall",
+ "syscall.IPV6_IPCOMP_LEVEL": "syscall",
+ "syscall.IPV6_IPSEC_POLICY": "syscall",
+ "syscall.IPV6_JOIN_ANYCAST": "syscall",
+ "syscall.IPV6_JOIN_GROUP": "syscall",
+ "syscall.IPV6_LEAVE_ANYCAST": "syscall",
+ "syscall.IPV6_LEAVE_GROUP": "syscall",
+ "syscall.IPV6_MAXHLIM": "syscall",
+ "syscall.IPV6_MAXOPTHDR": "syscall",
+ "syscall.IPV6_MAXPACKET": "syscall",
+ "syscall.IPV6_MAX_GROUP_SRC_FILTER": "syscall",
+ "syscall.IPV6_MAX_MEMBERSHIPS": "syscall",
+ "syscall.IPV6_MAX_SOCK_SRC_FILTER": "syscall",
+ "syscall.IPV6_MIN_MEMBERSHIPS": "syscall",
+ "syscall.IPV6_MMTU": "syscall",
+ "syscall.IPV6_MSFILTER": "syscall",
+ "syscall.IPV6_MTU": "syscall",
+ "syscall.IPV6_MTU_DISCOVER": "syscall",
+ "syscall.IPV6_MULTICAST_HOPS": "syscall",
+ "syscall.IPV6_MULTICAST_IF": "syscall",
+ "syscall.IPV6_MULTICAST_LOOP": "syscall",
+ "syscall.IPV6_NEXTHOP": "syscall",
+ "syscall.IPV6_OPTIONS": "syscall",
+ "syscall.IPV6_PATHMTU": "syscall",
+ "syscall.IPV6_PIPEX": "syscall",
+ "syscall.IPV6_PKTINFO": "syscall",
+ "syscall.IPV6_PMTUDISC_DO": "syscall",
+ "syscall.IPV6_PMTUDISC_DONT": "syscall",
+ "syscall.IPV6_PMTUDISC_PROBE": "syscall",
+ "syscall.IPV6_PMTUDISC_WANT": "syscall",
+ "syscall.IPV6_PORTRANGE": "syscall",
+ "syscall.IPV6_PORTRANGE_DEFAULT": "syscall",
+ "syscall.IPV6_PORTRANGE_HIGH": "syscall",
+ "syscall.IPV6_PORTRANGE_LOW": "syscall",
+ "syscall.IPV6_PREFER_TEMPADDR": "syscall",
+ "syscall.IPV6_RECVDSTOPTS": "syscall",
+ "syscall.IPV6_RECVERR": "syscall",
+ "syscall.IPV6_RECVHOPLIMIT": "syscall",
+ "syscall.IPV6_RECVHOPOPTS": "syscall",
+ "syscall.IPV6_RECVPATHMTU": "syscall",
+ "syscall.IPV6_RECVPKTINFO": "syscall",
+ "syscall.IPV6_RECVRTHDR": "syscall",
+ "syscall.IPV6_RECVTCLASS": "syscall",
+ "syscall.IPV6_ROUTER_ALERT": "syscall",
+ "syscall.IPV6_RTABLE": "syscall",
+ "syscall.IPV6_RTHDR": "syscall",
+ "syscall.IPV6_RTHDRDSTOPTS": "syscall",
+ "syscall.IPV6_RTHDR_LOOSE": "syscall",
+ "syscall.IPV6_RTHDR_STRICT": "syscall",
+ "syscall.IPV6_RTHDR_TYPE_0": "syscall",
+ "syscall.IPV6_RXDSTOPTS": "syscall",
+ "syscall.IPV6_RXHOPOPTS": "syscall",
+ "syscall.IPV6_SOCKOPT_RESERVED1": "syscall",
+ "syscall.IPV6_TCLASS": "syscall",
+ "syscall.IPV6_UNICAST_HOPS": "syscall",
+ "syscall.IPV6_USE_MIN_MTU": "syscall",
+ "syscall.IPV6_V6ONLY": "syscall",
+ "syscall.IPV6_VERSION": "syscall",
+ "syscall.IPV6_VERSION_MASK": "syscall",
+ "syscall.IPV6_XFRM_POLICY": "syscall",
+ "syscall.IP_ADD_MEMBERSHIP": "syscall",
+ "syscall.IP_ADD_SOURCE_MEMBERSHIP": "syscall",
+ "syscall.IP_AUTH_LEVEL": "syscall",
+ "syscall.IP_BINDANY": "syscall",
+ "syscall.IP_BLOCK_SOURCE": "syscall",
+ "syscall.IP_BOUND_IF": "syscall",
+ "syscall.IP_DEFAULT_MULTICAST_LOOP": "syscall",
+ "syscall.IP_DEFAULT_MULTICAST_TTL": "syscall",
+ "syscall.IP_DF": "syscall",
+ "syscall.IP_DONTFRAG": "syscall",
+ "syscall.IP_DROP_MEMBERSHIP": "syscall",
+ "syscall.IP_DROP_SOURCE_MEMBERSHIP": "syscall",
+ "syscall.IP_DUMMYNET3": "syscall",
+ "syscall.IP_DUMMYNET_CONFIGURE": "syscall",
+ "syscall.IP_DUMMYNET_DEL": "syscall",
+ "syscall.IP_DUMMYNET_FLUSH": "syscall",
+ "syscall.IP_DUMMYNET_GET": "syscall",
+ "syscall.IP_EF": "syscall",
+ "syscall.IP_ERRORMTU": "syscall",
+ "syscall.IP_ESP_NETWORK_LEVEL": "syscall",
+ "syscall.IP_ESP_TRANS_LEVEL": "syscall",
+ "syscall.IP_FAITH": "syscall",
+ "syscall.IP_FREEBIND": "syscall",
+ "syscall.IP_FW3": "syscall",
+ "syscall.IP_FW_ADD": "syscall",
+ "syscall.IP_FW_DEL": "syscall",
+ "syscall.IP_FW_FLUSH": "syscall",
+ "syscall.IP_FW_GET": "syscall",
+ "syscall.IP_FW_NAT_CFG": "syscall",
+ "syscall.IP_FW_NAT_DEL": "syscall",
+ "syscall.IP_FW_NAT_GET_CONFIG": "syscall",
+ "syscall.IP_FW_NAT_GET_LOG": "syscall",
+ "syscall.IP_FW_RESETLOG": "syscall",
+ "syscall.IP_FW_TABLE_ADD": "syscall",
+ "syscall.IP_FW_TABLE_DEL": "syscall",
+ "syscall.IP_FW_TABLE_FLUSH": "syscall",
+ "syscall.IP_FW_TABLE_GETSIZE": "syscall",
+ "syscall.IP_FW_TABLE_LIST": "syscall",
+ "syscall.IP_FW_ZERO": "syscall",
+ "syscall.IP_HDRINCL": "syscall",
+ "syscall.IP_IPCOMP_LEVEL": "syscall",
+ "syscall.IP_IPSECFLOWINFO": "syscall",
+ "syscall.IP_IPSEC_LOCAL_AUTH": "syscall",
+ "syscall.IP_IPSEC_LOCAL_CRED": "syscall",
+ "syscall.IP_IPSEC_LOCAL_ID": "syscall",
+ "syscall.IP_IPSEC_POLICY": "syscall",
+ "syscall.IP_IPSEC_REMOTE_AUTH": "syscall",
+ "syscall.IP_IPSEC_REMOTE_CRED": "syscall",
+ "syscall.IP_IPSEC_REMOTE_ID": "syscall",
+ "syscall.IP_MAXPACKET": "syscall",
+ "syscall.IP_MAX_GROUP_SRC_FILTER": "syscall",
+ "syscall.IP_MAX_MEMBERSHIPS": "syscall",
+ "syscall.IP_MAX_SOCK_MUTE_FILTER": "syscall",
+ "syscall.IP_MAX_SOCK_SRC_FILTER": "syscall",
+ "syscall.IP_MAX_SOURCE_FILTER": "syscall",
+ "syscall.IP_MF": "syscall",
+ "syscall.IP_MINFRAGSIZE": "syscall",
+ "syscall.IP_MINTTL": "syscall",
+ "syscall.IP_MIN_MEMBERSHIPS": "syscall",
+ "syscall.IP_MSFILTER": "syscall",
+ "syscall.IP_MSS": "syscall",
+ "syscall.IP_MTU": "syscall",
+ "syscall.IP_MTU_DISCOVER": "syscall",
+ "syscall.IP_MULTICAST_IF": "syscall",
+ "syscall.IP_MULTICAST_IFINDEX": "syscall",
+ "syscall.IP_MULTICAST_LOOP": "syscall",
+ "syscall.IP_MULTICAST_TTL": "syscall",
+ "syscall.IP_MULTICAST_VIF": "syscall",
+ "syscall.IP_NAT__XXX": "syscall",
+ "syscall.IP_OFFMASK": "syscall",
+ "syscall.IP_OLD_FW_ADD": "syscall",
+ "syscall.IP_OLD_FW_DEL": "syscall",
+ "syscall.IP_OLD_FW_FLUSH": "syscall",
+ "syscall.IP_OLD_FW_GET": "syscall",
+ "syscall.IP_OLD_FW_RESETLOG": "syscall",
+ "syscall.IP_OLD_FW_ZERO": "syscall",
+ "syscall.IP_ONESBCAST": "syscall",
+ "syscall.IP_OPTIONS": "syscall",
+ "syscall.IP_ORIGDSTADDR": "syscall",
+ "syscall.IP_PASSSEC": "syscall",
+ "syscall.IP_PIPEX": "syscall",
+ "syscall.IP_PKTINFO": "syscall",
+ "syscall.IP_PKTOPTIONS": "syscall",
+ "syscall.IP_PMTUDISC": "syscall",
+ "syscall.IP_PMTUDISC_DO": "syscall",
+ "syscall.IP_PMTUDISC_DONT": "syscall",
+ "syscall.IP_PMTUDISC_PROBE": "syscall",
+ "syscall.IP_PMTUDISC_WANT": "syscall",
+ "syscall.IP_PORTRANGE": "syscall",
+ "syscall.IP_PORTRANGE_DEFAULT": "syscall",
+ "syscall.IP_PORTRANGE_HIGH": "syscall",
+ "syscall.IP_PORTRANGE_LOW": "syscall",
+ "syscall.IP_RECVDSTADDR": "syscall",
+ "syscall.IP_RECVDSTPORT": "syscall",
+ "syscall.IP_RECVERR": "syscall",
+ "syscall.IP_RECVIF": "syscall",
+ "syscall.IP_RECVOPTS": "syscall",
+ "syscall.IP_RECVORIGDSTADDR": "syscall",
+ "syscall.IP_RECVPKTINFO": "syscall",
+ "syscall.IP_RECVRETOPTS": "syscall",
+ "syscall.IP_RECVRTABLE": "syscall",
+ "syscall.IP_RECVTOS": "syscall",
+ "syscall.IP_RECVTTL": "syscall",
+ "syscall.IP_RETOPTS": "syscall",
+ "syscall.IP_RF": "syscall",
+ "syscall.IP_ROUTER_ALERT": "syscall",
+ "syscall.IP_RSVP_OFF": "syscall",
+ "syscall.IP_RSVP_ON": "syscall",
+ "syscall.IP_RSVP_VIF_OFF": "syscall",
+ "syscall.IP_RSVP_VIF_ON": "syscall",
+ "syscall.IP_RTABLE": "syscall",
+ "syscall.IP_SENDSRCADDR": "syscall",
+ "syscall.IP_STRIPHDR": "syscall",
+ "syscall.IP_TOS": "syscall",
+ "syscall.IP_TRAFFIC_MGT_BACKGROUND": "syscall",
+ "syscall.IP_TRANSPARENT": "syscall",
+ "syscall.IP_TTL": "syscall",
+ "syscall.IP_UNBLOCK_SOURCE": "syscall",
+ "syscall.IP_XFRM_POLICY": "syscall",
+ "syscall.IPv6MTUInfo": "syscall",
+ "syscall.IPv6Mreq": "syscall",
+ "syscall.ISIG": "syscall",
+ "syscall.ISTRIP": "syscall",
+ "syscall.IUCLC": "syscall",
+ "syscall.IUTF8": "syscall",
+ "syscall.IXANY": "syscall",
+ "syscall.IXOFF": "syscall",
+ "syscall.IXON": "syscall",
+ "syscall.IfAddrmsg": "syscall",
+ "syscall.IfAnnounceMsghdr": "syscall",
+ "syscall.IfData": "syscall",
+ "syscall.IfInfomsg": "syscall",
+ "syscall.IfMsghdr": "syscall",
+ "syscall.IfaMsghdr": "syscall",
+ "syscall.IfmaMsghdr": "syscall",
+ "syscall.IfmaMsghdr2": "syscall",
+ "syscall.ImplementsGetwd": "syscall",
+ "syscall.Inet4Pktinfo": "syscall",
+ "syscall.Inet6Pktinfo": "syscall",
+ "syscall.InotifyAddWatch": "syscall",
+ "syscall.InotifyEvent": "syscall",
+ "syscall.InotifyInit": "syscall",
+ "syscall.InotifyInit1": "syscall",
+ "syscall.InotifyRmWatch": "syscall",
+ "syscall.InterfaceAddrMessage": "syscall",
+ "syscall.InterfaceAnnounceMessage": "syscall",
+ "syscall.InterfaceInfo": "syscall",
+ "syscall.InterfaceMessage": "syscall",
+ "syscall.InterfaceMulticastAddrMessage": "syscall",
+ "syscall.InvalidHandle": "syscall",
+ "syscall.Ioperm": "syscall",
+ "syscall.Iopl": "syscall",
+ "syscall.Iovec": "syscall",
+ "syscall.IpAdapterInfo": "syscall",
+ "syscall.IpAddrString": "syscall",
+ "syscall.IpAddressString": "syscall",
+ "syscall.IpMaskString": "syscall",
+ "syscall.Issetugid": "syscall",
+ "syscall.KEY_ALL_ACCESS": "syscall",
+ "syscall.KEY_CREATE_LINK": "syscall",
+ "syscall.KEY_CREATE_SUB_KEY": "syscall",
+ "syscall.KEY_ENUMERATE_SUB_KEYS": "syscall",
+ "syscall.KEY_EXECUTE": "syscall",
+ "syscall.KEY_NOTIFY": "syscall",
+ "syscall.KEY_QUERY_VALUE": "syscall",
+ "syscall.KEY_READ": "syscall",
+ "syscall.KEY_SET_VALUE": "syscall",
+ "syscall.KEY_WOW64_32KEY": "syscall",
+ "syscall.KEY_WOW64_64KEY": "syscall",
+ "syscall.KEY_WRITE": "syscall",
+ "syscall.Kevent": "syscall",
+ "syscall.Kevent_t": "syscall",
+ "syscall.Kill": "syscall",
+ "syscall.Klogctl": "syscall",
+ "syscall.Kqueue": "syscall",
+ "syscall.LANG_ENGLISH": "syscall",
+ "syscall.LAYERED_PROTOCOL": "syscall",
+ "syscall.LCNT_OVERLOAD_FLUSH": "syscall",
+ "syscall.LINUX_REBOOT_CMD_CAD_OFF": "syscall",
+ "syscall.LINUX_REBOOT_CMD_CAD_ON": "syscall",
+ "syscall.LINUX_REBOOT_CMD_HALT": "syscall",
+ "syscall.LINUX_REBOOT_CMD_KEXEC": "syscall",
+ "syscall.LINUX_REBOOT_CMD_POWER_OFF": "syscall",
+ "syscall.LINUX_REBOOT_CMD_RESTART": "syscall",
+ "syscall.LINUX_REBOOT_CMD_RESTART2": "syscall",
+ "syscall.LINUX_REBOOT_CMD_SW_SUSPEND": "syscall",
+ "syscall.LINUX_REBOOT_MAGIC1": "syscall",
+ "syscall.LINUX_REBOOT_MAGIC2": "syscall",
+ "syscall.LOCK_EX": "syscall",
+ "syscall.LOCK_NB": "syscall",
+ "syscall.LOCK_SH": "syscall",
+ "syscall.LOCK_UN": "syscall",
+ "syscall.LazyDLL": "syscall",
+ "syscall.LazyProc": "syscall",
+ "syscall.Lchown": "syscall",
+ "syscall.Linger": "syscall",
+ "syscall.Link": "syscall",
+ "syscall.Listen": "syscall",
+ "syscall.Listxattr": "syscall",
+ "syscall.LoadCancelIoEx": "syscall",
+ "syscall.LoadConnectEx": "syscall",
+ "syscall.LoadDLL": "syscall",
+ "syscall.LoadGetAddrInfo": "syscall",
+ "syscall.LoadLibrary": "syscall",
+ "syscall.LoadSetFileCompletionNotificationModes": "syscall",
+ "syscall.LocalFree": "syscall",
+ "syscall.Log2phys_t": "syscall",
+ "syscall.LookupAccountName": "syscall",
+ "syscall.LookupAccountSid": "syscall",
+ "syscall.LookupSID": "syscall",
+ "syscall.LsfJump": "syscall",
+ "syscall.LsfSocket": "syscall",
+ "syscall.LsfStmt": "syscall",
+ "syscall.Lstat": "syscall",
+ "syscall.MADV_AUTOSYNC": "syscall",
+ "syscall.MADV_CAN_REUSE": "syscall",
+ "syscall.MADV_CORE": "syscall",
+ "syscall.MADV_DOFORK": "syscall",
+ "syscall.MADV_DONTFORK": "syscall",
+ "syscall.MADV_DONTNEED": "syscall",
+ "syscall.MADV_FREE": "syscall",
+ "syscall.MADV_FREE_REUSABLE": "syscall",
+ "syscall.MADV_FREE_REUSE": "syscall",
+ "syscall.MADV_HUGEPAGE": "syscall",
+ "syscall.MADV_HWPOISON": "syscall",
+ "syscall.MADV_MERGEABLE": "syscall",
+ "syscall.MADV_NOCORE": "syscall",
+ "syscall.MADV_NOHUGEPAGE": "syscall",
+ "syscall.MADV_NORMAL": "syscall",
+ "syscall.MADV_NOSYNC": "syscall",
+ "syscall.MADV_PROTECT": "syscall",
+ "syscall.MADV_RANDOM": "syscall",
+ "syscall.MADV_REMOVE": "syscall",
+ "syscall.MADV_SEQUENTIAL": "syscall",
+ "syscall.MADV_UNMERGEABLE": "syscall",
+ "syscall.MADV_WILLNEED": "syscall",
+ "syscall.MADV_ZERO_WIRED_PAGES": "syscall",
+ "syscall.MAP_32BIT": "syscall",
+ "syscall.MAP_ANON": "syscall",
+ "syscall.MAP_ANONYMOUS": "syscall",
+ "syscall.MAP_COPY": "syscall",
+ "syscall.MAP_DENYWRITE": "syscall",
+ "syscall.MAP_EXECUTABLE": "syscall",
+ "syscall.MAP_FILE": "syscall",
+ "syscall.MAP_FIXED": "syscall",
+ "syscall.MAP_GROWSDOWN": "syscall",
+ "syscall.MAP_HASSEMAPHORE": "syscall",
+ "syscall.MAP_HUGETLB": "syscall",
+ "syscall.MAP_JIT": "syscall",
+ "syscall.MAP_LOCKED": "syscall",
+ "syscall.MAP_NOCACHE": "syscall",
+ "syscall.MAP_NOCORE": "syscall",
+ "syscall.MAP_NOEXTEND": "syscall",
+ "syscall.MAP_NONBLOCK": "syscall",
+ "syscall.MAP_NORESERVE": "syscall",
+ "syscall.MAP_NOSYNC": "syscall",
+ "syscall.MAP_POPULATE": "syscall",
+ "syscall.MAP_PREFAULT_READ": "syscall",
+ "syscall.MAP_PRIVATE": "syscall",
+ "syscall.MAP_RENAME": "syscall",
+ "syscall.MAP_RESERVED0080": "syscall",
+ "syscall.MAP_RESERVED0100": "syscall",
+ "syscall.MAP_SHARED": "syscall",
+ "syscall.MAP_STACK": "syscall",
+ "syscall.MAP_TYPE": "syscall",
+ "syscall.MAXLEN_IFDESCR": "syscall",
+ "syscall.MAXLEN_PHYSADDR": "syscall",
+ "syscall.MAX_ADAPTER_ADDRESS_LENGTH": "syscall",
+ "syscall.MAX_ADAPTER_DESCRIPTION_LENGTH": "syscall",
+ "syscall.MAX_ADAPTER_NAME_LENGTH": "syscall",
+ "syscall.MAX_COMPUTERNAME_LENGTH": "syscall",
+ "syscall.MAX_INTERFACE_NAME_LEN": "syscall",
+ "syscall.MAX_LONG_PATH": "syscall",
+ "syscall.MAX_PATH": "syscall",
+ "syscall.MAX_PROTOCOL_CHAIN": "syscall",
+ "syscall.MCL_CURRENT": "syscall",
+ "syscall.MCL_FUTURE": "syscall",
+ "syscall.MNT_DETACH": "syscall",
+ "syscall.MNT_EXPIRE": "syscall",
+ "syscall.MNT_FORCE": "syscall",
+ "syscall.MSG_BCAST": "syscall",
+ "syscall.MSG_CMSG_CLOEXEC": "syscall",
+ "syscall.MSG_COMPAT": "syscall",
+ "syscall.MSG_CONFIRM": "syscall",
+ "syscall.MSG_CONTROLMBUF": "syscall",
+ "syscall.MSG_CTRUNC": "syscall",
+ "syscall.MSG_DONTROUTE": "syscall",
+ "syscall.MSG_DONTWAIT": "syscall",
+ "syscall.MSG_EOF": "syscall",
+ "syscall.MSG_EOR": "syscall",
+ "syscall.MSG_ERRQUEUE": "syscall",
+ "syscall.MSG_FASTOPEN": "syscall",
+ "syscall.MSG_FIN": "syscall",
+ "syscall.MSG_FLUSH": "syscall",
+ "syscall.MSG_HAVEMORE": "syscall",
+ "syscall.MSG_HOLD": "syscall",
+ "syscall.MSG_IOVUSRSPACE": "syscall",
+ "syscall.MSG_LENUSRSPACE": "syscall",
+ "syscall.MSG_MCAST": "syscall",
+ "syscall.MSG_MORE": "syscall",
+ "syscall.MSG_NAMEMBUF": "syscall",
+ "syscall.MSG_NBIO": "syscall",
+ "syscall.MSG_NEEDSA": "syscall",
+ "syscall.MSG_NOSIGNAL": "syscall",
+ "syscall.MSG_NOTIFICATION": "syscall",
+ "syscall.MSG_OOB": "syscall",
+ "syscall.MSG_PEEK": "syscall",
+ "syscall.MSG_PROXY": "syscall",
+ "syscall.MSG_RCVMORE": "syscall",
+ "syscall.MSG_RST": "syscall",
+ "syscall.MSG_SEND": "syscall",
+ "syscall.MSG_SYN": "syscall",
+ "syscall.MSG_TRUNC": "syscall",
+ "syscall.MSG_TRYHARD": "syscall",
+ "syscall.MSG_USERFLAGS": "syscall",
+ "syscall.MSG_WAITALL": "syscall",
+ "syscall.MSG_WAITFORONE": "syscall",
+ "syscall.MSG_WAITSTREAM": "syscall",
+ "syscall.MS_ACTIVE": "syscall",
+ "syscall.MS_ASYNC": "syscall",
+ "syscall.MS_BIND": "syscall",
+ "syscall.MS_DEACTIVATE": "syscall",
+ "syscall.MS_DIRSYNC": "syscall",
+ "syscall.MS_INVALIDATE": "syscall",
+ "syscall.MS_I_VERSION": "syscall",
+ "syscall.MS_KERNMOUNT": "syscall",
+ "syscall.MS_KILLPAGES": "syscall",
+ "syscall.MS_MANDLOCK": "syscall",
+ "syscall.MS_MGC_MSK": "syscall",
+ "syscall.MS_MGC_VAL": "syscall",
+ "syscall.MS_MOVE": "syscall",
+ "syscall.MS_NOATIME": "syscall",
+ "syscall.MS_NODEV": "syscall",
+ "syscall.MS_NODIRATIME": "syscall",
+ "syscall.MS_NOEXEC": "syscall",
+ "syscall.MS_NOSUID": "syscall",
+ "syscall.MS_NOUSER": "syscall",
+ "syscall.MS_POSIXACL": "syscall",
+ "syscall.MS_PRIVATE": "syscall",
+ "syscall.MS_RDONLY": "syscall",
+ "syscall.MS_REC": "syscall",
+ "syscall.MS_RELATIME": "syscall",
+ "syscall.MS_REMOUNT": "syscall",
+ "syscall.MS_RMT_MASK": "syscall",
+ "syscall.MS_SHARED": "syscall",
+ "syscall.MS_SILENT": "syscall",
+ "syscall.MS_SLAVE": "syscall",
+ "syscall.MS_STRICTATIME": "syscall",
+ "syscall.MS_SYNC": "syscall",
+ "syscall.MS_SYNCHRONOUS": "syscall",
+ "syscall.MS_UNBINDABLE": "syscall",
+ "syscall.Madvise": "syscall",
+ "syscall.MapViewOfFile": "syscall",
+ "syscall.MaxTokenInfoClass": "syscall",
+ "syscall.Mclpool": "syscall",
+ "syscall.MibIfRow": "syscall",
+ "syscall.Mkdir": "syscall",
+ "syscall.Mkdirat": "syscall",
+ "syscall.Mkfifo": "syscall",
+ "syscall.Mknod": "syscall",
+ "syscall.Mknodat": "syscall",
+ "syscall.Mlock": "syscall",
+ "syscall.Mlockall": "syscall",
+ "syscall.Mmap": "syscall",
+ "syscall.Mount": "syscall",
+ "syscall.MoveFile": "syscall",
+ "syscall.Mprotect": "syscall",
+ "syscall.Msghdr": "syscall",
+ "syscall.Munlock": "syscall",
+ "syscall.Munlockall": "syscall",
+ "syscall.Munmap": "syscall",
+ "syscall.MustLoadDLL": "syscall",
+ "syscall.NAME_MAX": "syscall",
+ "syscall.NETLINK_ADD_MEMBERSHIP": "syscall",
+ "syscall.NETLINK_AUDIT": "syscall",
+ "syscall.NETLINK_BROADCAST_ERROR": "syscall",
+ "syscall.NETLINK_CONNECTOR": "syscall",
+ "syscall.NETLINK_DNRTMSG": "syscall",
+ "syscall.NETLINK_DROP_MEMBERSHIP": "syscall",
+ "syscall.NETLINK_ECRYPTFS": "syscall",
+ "syscall.NETLINK_FIB_LOOKUP": "syscall",
+ "syscall.NETLINK_FIREWALL": "syscall",
+ "syscall.NETLINK_GENERIC": "syscall",
+ "syscall.NETLINK_INET_DIAG": "syscall",
+ "syscall.NETLINK_IP6_FW": "syscall",
+ "syscall.NETLINK_ISCSI": "syscall",
+ "syscall.NETLINK_KOBJECT_UEVENT": "syscall",
+ "syscall.NETLINK_NETFILTER": "syscall",
+ "syscall.NETLINK_NFLOG": "syscall",
+ "syscall.NETLINK_NO_ENOBUFS": "syscall",
+ "syscall.NETLINK_PKTINFO": "syscall",
+ "syscall.NETLINK_RDMA": "syscall",
+ "syscall.NETLINK_ROUTE": "syscall",
+ "syscall.NETLINK_SCSITRANSPORT": "syscall",
+ "syscall.NETLINK_SELINUX": "syscall",
+ "syscall.NETLINK_UNUSED": "syscall",
+ "syscall.NETLINK_USERSOCK": "syscall",
+ "syscall.NETLINK_XFRM": "syscall",
+ "syscall.NET_RT_DUMP": "syscall",
+ "syscall.NET_RT_DUMP2": "syscall",
+ "syscall.NET_RT_FLAGS": "syscall",
+ "syscall.NET_RT_IFLIST": "syscall",
+ "syscall.NET_RT_IFLIST2": "syscall",
+ "syscall.NET_RT_IFLISTL": "syscall",
+ "syscall.NET_RT_IFMALIST": "syscall",
+ "syscall.NET_RT_MAXID": "syscall",
+ "syscall.NET_RT_OIFLIST": "syscall",
+ "syscall.NET_RT_OOIFLIST": "syscall",
+ "syscall.NET_RT_STAT": "syscall",
+ "syscall.NET_RT_STATS": "syscall",
+ "syscall.NET_RT_TABLE": "syscall",
+ "syscall.NET_RT_TRASH": "syscall",
+ "syscall.NLA_ALIGNTO": "syscall",
+ "syscall.NLA_F_NESTED": "syscall",
+ "syscall.NLA_F_NET_BYTEORDER": "syscall",
+ "syscall.NLA_HDRLEN": "syscall",
+ "syscall.NLMSG_ALIGNTO": "syscall",
+ "syscall.NLMSG_DONE": "syscall",
+ "syscall.NLMSG_ERROR": "syscall",
+ "syscall.NLMSG_HDRLEN": "syscall",
+ "syscall.NLMSG_MIN_TYPE": "syscall",
+ "syscall.NLMSG_NOOP": "syscall",
+ "syscall.NLMSG_OVERRUN": "syscall",
+ "syscall.NLM_F_ACK": "syscall",
+ "syscall.NLM_F_APPEND": "syscall",
+ "syscall.NLM_F_ATOMIC": "syscall",
+ "syscall.NLM_F_CREATE": "syscall",
+ "syscall.NLM_F_DUMP": "syscall",
+ "syscall.NLM_F_ECHO": "syscall",
+ "syscall.NLM_F_EXCL": "syscall",
+ "syscall.NLM_F_MATCH": "syscall",
+ "syscall.NLM_F_MULTI": "syscall",
+ "syscall.NLM_F_REPLACE": "syscall",
+ "syscall.NLM_F_REQUEST": "syscall",
+ "syscall.NLM_F_ROOT": "syscall",
+ "syscall.NOFLSH": "syscall",
+ "syscall.NOTE_ABSOLUTE": "syscall",
+ "syscall.NOTE_ATTRIB": "syscall",
+ "syscall.NOTE_CHILD": "syscall",
+ "syscall.NOTE_DELETE": "syscall",
+ "syscall.NOTE_EOF": "syscall",
+ "syscall.NOTE_EXEC": "syscall",
+ "syscall.NOTE_EXIT": "syscall",
+ "syscall.NOTE_EXITSTATUS": "syscall",
+ "syscall.NOTE_EXTEND": "syscall",
+ "syscall.NOTE_FFAND": "syscall",
+ "syscall.NOTE_FFCOPY": "syscall",
+ "syscall.NOTE_FFCTRLMASK": "syscall",
+ "syscall.NOTE_FFLAGSMASK": "syscall",
+ "syscall.NOTE_FFNOP": "syscall",
+ "syscall.NOTE_FFOR": "syscall",
+ "syscall.NOTE_FORK": "syscall",
+ "syscall.NOTE_LINK": "syscall",
+ "syscall.NOTE_LOWAT": "syscall",
+ "syscall.NOTE_NONE": "syscall",
+ "syscall.NOTE_NSECONDS": "syscall",
+ "syscall.NOTE_PCTRLMASK": "syscall",
+ "syscall.NOTE_PDATAMASK": "syscall",
+ "syscall.NOTE_REAP": "syscall",
+ "syscall.NOTE_RENAME": "syscall",
+ "syscall.NOTE_RESOURCEEND": "syscall",
+ "syscall.NOTE_REVOKE": "syscall",
+ "syscall.NOTE_SECONDS": "syscall",
+ "syscall.NOTE_SIGNAL": "syscall",
+ "syscall.NOTE_TRACK": "syscall",
+ "syscall.NOTE_TRACKERR": "syscall",
+ "syscall.NOTE_TRIGGER": "syscall",
+ "syscall.NOTE_TRUNCATE": "syscall",
+ "syscall.NOTE_USECONDS": "syscall",
+ "syscall.NOTE_VM_ERROR": "syscall",
+ "syscall.NOTE_VM_PRESSURE": "syscall",
+ "syscall.NOTE_VM_PRESSURE_SUDDEN_TERMINATE": "syscall",
+ "syscall.NOTE_VM_PRESSURE_TERMINATE": "syscall",
+ "syscall.NOTE_WRITE": "syscall",
+ "syscall.NameCanonical": "syscall",
+ "syscall.NameCanonicalEx": "syscall",
+ "syscall.NameDisplay": "syscall",
+ "syscall.NameDnsDomain": "syscall",
+ "syscall.NameFullyQualifiedDN": "syscall",
+ "syscall.NameSamCompatible": "syscall",
+ "syscall.NameServicePrincipal": "syscall",
+ "syscall.NameUniqueId": "syscall",
+ "syscall.NameUnknown": "syscall",
+ "syscall.NameUserPrincipal": "syscall",
+ "syscall.Nanosleep": "syscall",
+ "syscall.NetApiBufferFree": "syscall",
+ "syscall.NetGetJoinInformation": "syscall",
+ "syscall.NetSetupDomainName": "syscall",
+ "syscall.NetSetupUnjoined": "syscall",
+ "syscall.NetSetupUnknownStatus": "syscall",
+ "syscall.NetSetupWorkgroupName": "syscall",
+ "syscall.NetUserGetInfo": "syscall",
+ "syscall.NetlinkMessage": "syscall",
+ "syscall.NetlinkRIB": "syscall",
+ "syscall.NetlinkRouteAttr": "syscall",
+ "syscall.NetlinkRouteRequest": "syscall",
+ "syscall.NewCallback": "syscall",
+ "syscall.NewLazyDLL": "syscall",
+ "syscall.NlAttr": "syscall",
+ "syscall.NlMsgerr": "syscall",
+ "syscall.NlMsghdr": "syscall",
+ "syscall.NsecToFiletime": "syscall",
+ "syscall.NsecToTimespec": "syscall",
+ "syscall.NsecToTimeval": "syscall",
+ "syscall.Ntohs": "syscall",
+ "syscall.OCRNL": "syscall",
+ "syscall.OFDEL": "syscall",
+ "syscall.OFILL": "syscall",
+ "syscall.OFIOGETBMAP": "syscall",
+ "syscall.OID_PKIX_KP_SERVER_AUTH": "syscall",
+ "syscall.OID_SERVER_GATED_CRYPTO": "syscall",
+ "syscall.OID_SGC_NETSCAPE": "syscall",
+ "syscall.OLCUC": "syscall",
+ "syscall.ONLCR": "syscall",
+ "syscall.ONLRET": "syscall",
+ "syscall.ONOCR": "syscall",
+ "syscall.ONOEOT": "syscall",
+ "syscall.OPEN_ALWAYS": "syscall",
+ "syscall.OPEN_EXISTING": "syscall",
+ "syscall.OPOST": "syscall",
+ "syscall.O_ACCMODE": "syscall",
+ "syscall.O_ALERT": "syscall",
+ "syscall.O_ALT_IO": "syscall",
+ "syscall.O_APPEND": "syscall",
+ "syscall.O_ASYNC": "syscall",
+ "syscall.O_CLOEXEC": "syscall",
+ "syscall.O_CREAT": "syscall",
+ "syscall.O_DIRECT": "syscall",
+ "syscall.O_DIRECTORY": "syscall",
+ "syscall.O_DSYNC": "syscall",
+ "syscall.O_EVTONLY": "syscall",
+ "syscall.O_EXCL": "syscall",
+ "syscall.O_EXEC": "syscall",
+ "syscall.O_EXLOCK": "syscall",
+ "syscall.O_FSYNC": "syscall",
+ "syscall.O_LARGEFILE": "syscall",
+ "syscall.O_NDELAY": "syscall",
+ "syscall.O_NOATIME": "syscall",
+ "syscall.O_NOCTTY": "syscall",
+ "syscall.O_NOFOLLOW": "syscall",
+ "syscall.O_NONBLOCK": "syscall",
+ "syscall.O_NOSIGPIPE": "syscall",
+ "syscall.O_POPUP": "syscall",
+ "syscall.O_RDONLY": "syscall",
+ "syscall.O_RDWR": "syscall",
+ "syscall.O_RSYNC": "syscall",
+ "syscall.O_SHLOCK": "syscall",
+ "syscall.O_SYMLINK": "syscall",
+ "syscall.O_SYNC": "syscall",
+ "syscall.O_TRUNC": "syscall",
+ "syscall.O_TTY_INIT": "syscall",
+ "syscall.O_WRONLY": "syscall",
+ "syscall.Open": "syscall",
+ "syscall.OpenCurrentProcessToken": "syscall",
+ "syscall.OpenProcess": "syscall",
+ "syscall.OpenProcessToken": "syscall",
+ "syscall.Openat": "syscall",
+ "syscall.Overlapped": "syscall",
+ "syscall.PACKET_ADD_MEMBERSHIP": "syscall",
+ "syscall.PACKET_BROADCAST": "syscall",
+ "syscall.PACKET_DROP_MEMBERSHIP": "syscall",
+ "syscall.PACKET_FASTROUTE": "syscall",
+ "syscall.PACKET_HOST": "syscall",
+ "syscall.PACKET_LOOPBACK": "syscall",
+ "syscall.PACKET_MR_ALLMULTI": "syscall",
+ "syscall.PACKET_MR_MULTICAST": "syscall",
+ "syscall.PACKET_MR_PROMISC": "syscall",
+ "syscall.PACKET_MULTICAST": "syscall",
+ "syscall.PACKET_OTHERHOST": "syscall",
+ "syscall.PACKET_OUTGOING": "syscall",
+ "syscall.PACKET_RECV_OUTPUT": "syscall",
+ "syscall.PACKET_RX_RING": "syscall",
+ "syscall.PACKET_STATISTICS": "syscall",
+ "syscall.PAGE_EXECUTE_READ": "syscall",
+ "syscall.PAGE_EXECUTE_READWRITE": "syscall",
+ "syscall.PAGE_EXECUTE_WRITECOPY": "syscall",
+ "syscall.PAGE_READONLY": "syscall",
+ "syscall.PAGE_READWRITE": "syscall",
+ "syscall.PAGE_WRITECOPY": "syscall",
+ "syscall.PARENB": "syscall",
+ "syscall.PARMRK": "syscall",
+ "syscall.PARODD": "syscall",
+ "syscall.PENDIN": "syscall",
+ "syscall.PFL_HIDDEN": "syscall",
+ "syscall.PFL_MATCHES_PROTOCOL_ZERO": "syscall",
+ "syscall.PFL_MULTIPLE_PROTO_ENTRIES": "syscall",
+ "syscall.PFL_NETWORKDIRECT_PROVIDER": "syscall",
+ "syscall.PFL_RECOMMENDED_PROTO_ENTRY": "syscall",
+ "syscall.PF_FLUSH": "syscall",
+ "syscall.PKCS_7_ASN_ENCODING": "syscall",
+ "syscall.PMC5_PIPELINE_FLUSH": "syscall",
+ "syscall.PRIO_PGRP": "syscall",
+ "syscall.PRIO_PROCESS": "syscall",
+ "syscall.PRIO_USER": "syscall",
+ "syscall.PRI_IOFLUSH": "syscall",
+ "syscall.PROCESS_QUERY_INFORMATION": "syscall",
+ "syscall.PROCESS_TERMINATE": "syscall",
+ "syscall.PROT_EXEC": "syscall",
+ "syscall.PROT_GROWSDOWN": "syscall",
+ "syscall.PROT_GROWSUP": "syscall",
+ "syscall.PROT_NONE": "syscall",
+ "syscall.PROT_READ": "syscall",
+ "syscall.PROT_WRITE": "syscall",
+ "syscall.PROV_DH_SCHANNEL": "syscall",
+ "syscall.PROV_DSS": "syscall",
+ "syscall.PROV_DSS_DH": "syscall",
+ "syscall.PROV_EC_ECDSA_FULL": "syscall",
+ "syscall.PROV_EC_ECDSA_SIG": "syscall",
+ "syscall.PROV_EC_ECNRA_FULL": "syscall",
+ "syscall.PROV_EC_ECNRA_SIG": "syscall",
+ "syscall.PROV_FORTEZZA": "syscall",
+ "syscall.PROV_INTEL_SEC": "syscall",
+ "syscall.PROV_MS_EXCHANGE": "syscall",
+ "syscall.PROV_REPLACE_OWF": "syscall",
+ "syscall.PROV_RNG": "syscall",
+ "syscall.PROV_RSA_AES": "syscall",
+ "syscall.PROV_RSA_FULL": "syscall",
+ "syscall.PROV_RSA_SCHANNEL": "syscall",
+ "syscall.PROV_RSA_SIG": "syscall",
+ "syscall.PROV_SPYRUS_LYNKS": "syscall",
+ "syscall.PROV_SSL": "syscall",
+ "syscall.PR_CAPBSET_DROP": "syscall",
+ "syscall.PR_CAPBSET_READ": "syscall",
+ "syscall.PR_CLEAR_SECCOMP_FILTER": "syscall",
+ "syscall.PR_ENDIAN_BIG": "syscall",
+ "syscall.PR_ENDIAN_LITTLE": "syscall",
+ "syscall.PR_ENDIAN_PPC_LITTLE": "syscall",
+ "syscall.PR_FPEMU_NOPRINT": "syscall",
+ "syscall.PR_FPEMU_SIGFPE": "syscall",
+ "syscall.PR_FP_EXC_ASYNC": "syscall",
+ "syscall.PR_FP_EXC_DISABLED": "syscall",
+ "syscall.PR_FP_EXC_DIV": "syscall",
+ "syscall.PR_FP_EXC_INV": "syscall",
+ "syscall.PR_FP_EXC_NONRECOV": "syscall",
+ "syscall.PR_FP_EXC_OVF": "syscall",
+ "syscall.PR_FP_EXC_PRECISE": "syscall",
+ "syscall.PR_FP_EXC_RES": "syscall",
+ "syscall.PR_FP_EXC_SW_ENABLE": "syscall",
+ "syscall.PR_FP_EXC_UND": "syscall",
+ "syscall.PR_GET_DUMPABLE": "syscall",
+ "syscall.PR_GET_ENDIAN": "syscall",
+ "syscall.PR_GET_FPEMU": "syscall",
+ "syscall.PR_GET_FPEXC": "syscall",
+ "syscall.PR_GET_KEEPCAPS": "syscall",
+ "syscall.PR_GET_NAME": "syscall",
+ "syscall.PR_GET_PDEATHSIG": "syscall",
+ "syscall.PR_GET_SECCOMP": "syscall",
+ "syscall.PR_GET_SECCOMP_FILTER": "syscall",
+ "syscall.PR_GET_SECUREBITS": "syscall",
+ "syscall.PR_GET_TIMERSLACK": "syscall",
+ "syscall.PR_GET_TIMING": "syscall",
+ "syscall.PR_GET_TSC": "syscall",
+ "syscall.PR_GET_UNALIGN": "syscall",
+ "syscall.PR_MCE_KILL": "syscall",
+ "syscall.PR_MCE_KILL_CLEAR": "syscall",
+ "syscall.PR_MCE_KILL_DEFAULT": "syscall",
+ "syscall.PR_MCE_KILL_EARLY": "syscall",
+ "syscall.PR_MCE_KILL_GET": "syscall",
+ "syscall.PR_MCE_KILL_LATE": "syscall",
+ "syscall.PR_MCE_KILL_SET": "syscall",
+ "syscall.PR_SECCOMP_FILTER_EVENT": "syscall",
+ "syscall.PR_SECCOMP_FILTER_SYSCALL": "syscall",
+ "syscall.PR_SET_DUMPABLE": "syscall",
+ "syscall.PR_SET_ENDIAN": "syscall",
+ "syscall.PR_SET_FPEMU": "syscall",
+ "syscall.PR_SET_FPEXC": "syscall",
+ "syscall.PR_SET_KEEPCAPS": "syscall",
+ "syscall.PR_SET_NAME": "syscall",
+ "syscall.PR_SET_PDEATHSIG": "syscall",
+ "syscall.PR_SET_PTRACER": "syscall",
+ "syscall.PR_SET_SECCOMP": "syscall",
+ "syscall.PR_SET_SECCOMP_FILTER": "syscall",
+ "syscall.PR_SET_SECUREBITS": "syscall",
+ "syscall.PR_SET_TIMERSLACK": "syscall",
+ "syscall.PR_SET_TIMING": "syscall",
+ "syscall.PR_SET_TSC": "syscall",
+ "syscall.PR_SET_UNALIGN": "syscall",
+ "syscall.PR_TASK_PERF_EVENTS_DISABLE": "syscall",
+ "syscall.PR_TASK_PERF_EVENTS_ENABLE": "syscall",
+ "syscall.PR_TIMING_STATISTICAL": "syscall",
+ "syscall.PR_TIMING_TIMESTAMP": "syscall",
+ "syscall.PR_TSC_ENABLE": "syscall",
+ "syscall.PR_TSC_SIGSEGV": "syscall",
+ "syscall.PR_UNALIGN_NOPRINT": "syscall",
+ "syscall.PR_UNALIGN_SIGBUS": "syscall",
+ "syscall.PTRACE_ARCH_PRCTL": "syscall",
+ "syscall.PTRACE_ATTACH": "syscall",
+ "syscall.PTRACE_CONT": "syscall",
+ "syscall.PTRACE_DETACH": "syscall",
+ "syscall.PTRACE_EVENT_CLONE": "syscall",
+ "syscall.PTRACE_EVENT_EXEC": "syscall",
+ "syscall.PTRACE_EVENT_EXIT": "syscall",
+ "syscall.PTRACE_EVENT_FORK": "syscall",
+ "syscall.PTRACE_EVENT_VFORK": "syscall",
+ "syscall.PTRACE_EVENT_VFORK_DONE": "syscall",
+ "syscall.PTRACE_GETCRUNCHREGS": "syscall",
+ "syscall.PTRACE_GETEVENTMSG": "syscall",
+ "syscall.PTRACE_GETFPREGS": "syscall",
+ "syscall.PTRACE_GETFPXREGS": "syscall",
+ "syscall.PTRACE_GETHBPREGS": "syscall",
+ "syscall.PTRACE_GETREGS": "syscall",
+ "syscall.PTRACE_GETREGSET": "syscall",
+ "syscall.PTRACE_GETSIGINFO": "syscall",
+ "syscall.PTRACE_GETVFPREGS": "syscall",
+ "syscall.PTRACE_GETWMMXREGS": "syscall",
+ "syscall.PTRACE_GET_THREAD_AREA": "syscall",
+ "syscall.PTRACE_KILL": "syscall",
+ "syscall.PTRACE_OLDSETOPTIONS": "syscall",
+ "syscall.PTRACE_O_MASK": "syscall",
+ "syscall.PTRACE_O_TRACECLONE": "syscall",
+ "syscall.PTRACE_O_TRACEEXEC": "syscall",
+ "syscall.PTRACE_O_TRACEEXIT": "syscall",
+ "syscall.PTRACE_O_TRACEFORK": "syscall",
+ "syscall.PTRACE_O_TRACESYSGOOD": "syscall",
+ "syscall.PTRACE_O_TRACEVFORK": "syscall",
+ "syscall.PTRACE_O_TRACEVFORKDONE": "syscall",
+ "syscall.PTRACE_PEEKDATA": "syscall",
+ "syscall.PTRACE_PEEKTEXT": "syscall",
+ "syscall.PTRACE_PEEKUSR": "syscall",
+ "syscall.PTRACE_POKEDATA": "syscall",
+ "syscall.PTRACE_POKETEXT": "syscall",
+ "syscall.PTRACE_POKEUSR": "syscall",
+ "syscall.PTRACE_SETCRUNCHREGS": "syscall",
+ "syscall.PTRACE_SETFPREGS": "syscall",
+ "syscall.PTRACE_SETFPXREGS": "syscall",
+ "syscall.PTRACE_SETHBPREGS": "syscall",
+ "syscall.PTRACE_SETOPTIONS": "syscall",
+ "syscall.PTRACE_SETREGS": "syscall",
+ "syscall.PTRACE_SETREGSET": "syscall",
+ "syscall.PTRACE_SETSIGINFO": "syscall",
+ "syscall.PTRACE_SETVFPREGS": "syscall",
+ "syscall.PTRACE_SETWMMXREGS": "syscall",
+ "syscall.PTRACE_SET_SYSCALL": "syscall",
+ "syscall.PTRACE_SET_THREAD_AREA": "syscall",
+ "syscall.PTRACE_SINGLEBLOCK": "syscall",
+ "syscall.PTRACE_SINGLESTEP": "syscall",
+ "syscall.PTRACE_SYSCALL": "syscall",
+ "syscall.PTRACE_SYSEMU": "syscall",
+ "syscall.PTRACE_SYSEMU_SINGLESTEP": "syscall",
+ "syscall.PTRACE_TRACEME": "syscall",
+ "syscall.PT_ATTACH": "syscall",
+ "syscall.PT_ATTACHEXC": "syscall",
+ "syscall.PT_CONTINUE": "syscall",
+ "syscall.PT_DATA_ADDR": "syscall",
+ "syscall.PT_DENY_ATTACH": "syscall",
+ "syscall.PT_DETACH": "syscall",
+ "syscall.PT_FIRSTMACH": "syscall",
+ "syscall.PT_FORCEQUOTA": "syscall",
+ "syscall.PT_KILL": "syscall",
+ "syscall.PT_MASK": "syscall",
+ "syscall.PT_READ_D": "syscall",
+ "syscall.PT_READ_I": "syscall",
+ "syscall.PT_READ_U": "syscall",
+ "syscall.PT_SIGEXC": "syscall",
+ "syscall.PT_STEP": "syscall",
+ "syscall.PT_TEXT_ADDR": "syscall",
+ "syscall.PT_TEXT_END_ADDR": "syscall",
+ "syscall.PT_THUPDATE": "syscall",
+ "syscall.PT_TRACE_ME": "syscall",
+ "syscall.PT_WRITE_D": "syscall",
+ "syscall.PT_WRITE_I": "syscall",
+ "syscall.PT_WRITE_U": "syscall",
+ "syscall.ParseDirent": "syscall",
+ "syscall.ParseNetlinkMessage": "syscall",
+ "syscall.ParseNetlinkRouteAttr": "syscall",
+ "syscall.ParseRoutingMessage": "syscall",
+ "syscall.ParseRoutingSockaddr": "syscall",
+ "syscall.ParseSocketControlMessage": "syscall",
+ "syscall.ParseUnixCredentials": "syscall",
+ "syscall.ParseUnixRights": "syscall",
+ "syscall.PathMax": "syscall",
+ "syscall.Pathconf": "syscall",
+ "syscall.Pause": "syscall",
+ "syscall.Pipe": "syscall",
+ "syscall.Pipe2": "syscall",
+ "syscall.PivotRoot": "syscall",
+ "syscall.PostQueuedCompletionStatus": "syscall",
+ "syscall.Pread": "syscall",
+ "syscall.Proc": "syscall",
+ "syscall.ProcAttr": "syscall",
+ "syscall.ProcessInformation": "syscall",
+ "syscall.Protoent": "syscall",
+ "syscall.PtraceAttach": "syscall",
+ "syscall.PtraceCont": "syscall",
+ "syscall.PtraceDetach": "syscall",
+ "syscall.PtraceGetEventMsg": "syscall",
+ "syscall.PtraceGetRegs": "syscall",
+ "syscall.PtracePeekData": "syscall",
+ "syscall.PtracePeekText": "syscall",
+ "syscall.PtracePokeData": "syscall",
+ "syscall.PtracePokeText": "syscall",
+ "syscall.PtraceRegs": "syscall",
+ "syscall.PtraceSetOptions": "syscall",
+ "syscall.PtraceSetRegs": "syscall",
+ "syscall.PtraceSingleStep": "syscall",
+ "syscall.PtraceSyscall": "syscall",
+ "syscall.Pwrite": "syscall",
+ "syscall.REG_BINARY": "syscall",
+ "syscall.REG_DWORD": "syscall",
+ "syscall.REG_DWORD_BIG_ENDIAN": "syscall",
+ "syscall.REG_DWORD_LITTLE_ENDIAN": "syscall",
+ "syscall.REG_EXPAND_SZ": "syscall",
+ "syscall.REG_FULL_RESOURCE_DESCRIPTOR": "syscall",
+ "syscall.REG_LINK": "syscall",
+ "syscall.REG_MULTI_SZ": "syscall",
+ "syscall.REG_NONE": "syscall",
+ "syscall.REG_QWORD": "syscall",
+ "syscall.REG_QWORD_LITTLE_ENDIAN": "syscall",
+ "syscall.REG_RESOURCE_LIST": "syscall",
+ "syscall.REG_RESOURCE_REQUIREMENTS_LIST": "syscall",
+ "syscall.REG_SZ": "syscall",
+ "syscall.RLIMIT_AS": "syscall",
+ "syscall.RLIMIT_CORE": "syscall",
+ "syscall.RLIMIT_CPU": "syscall",
+ "syscall.RLIMIT_DATA": "syscall",
+ "syscall.RLIMIT_FSIZE": "syscall",
+ "syscall.RLIMIT_NOFILE": "syscall",
+ "syscall.RLIMIT_STACK": "syscall",
+ "syscall.RLIM_INFINITY": "syscall",
+ "syscall.RTAX_ADVMSS": "syscall",
+ "syscall.RTAX_AUTHOR": "syscall",
+ "syscall.RTAX_BRD": "syscall",
+ "syscall.RTAX_CWND": "syscall",
+ "syscall.RTAX_DST": "syscall",
+ "syscall.RTAX_FEATURES": "syscall",
+ "syscall.RTAX_FEATURE_ALLFRAG": "syscall",
+ "syscall.RTAX_FEATURE_ECN": "syscall",
+ "syscall.RTAX_FEATURE_SACK": "syscall",
+ "syscall.RTAX_FEATURE_TIMESTAMP": "syscall",
+ "syscall.RTAX_GATEWAY": "syscall",
+ "syscall.RTAX_GENMASK": "syscall",
+ "syscall.RTAX_HOPLIMIT": "syscall",
+ "syscall.RTAX_IFA": "syscall",
+ "syscall.RTAX_IFP": "syscall",
+ "syscall.RTAX_INITCWND": "syscall",
+ "syscall.RTAX_INITRWND": "syscall",
+ "syscall.RTAX_LABEL": "syscall",
+ "syscall.RTAX_LOCK": "syscall",
+ "syscall.RTAX_MAX": "syscall",
+ "syscall.RTAX_MTU": "syscall",
+ "syscall.RTAX_NETMASK": "syscall",
+ "syscall.RTAX_REORDERING": "syscall",
+ "syscall.RTAX_RTO_MIN": "syscall",
+ "syscall.RTAX_RTT": "syscall",
+ "syscall.RTAX_RTTVAR": "syscall",
+ "syscall.RTAX_SRC": "syscall",
+ "syscall.RTAX_SRCMASK": "syscall",
+ "syscall.RTAX_SSTHRESH": "syscall",
+ "syscall.RTAX_TAG": "syscall",
+ "syscall.RTAX_UNSPEC": "syscall",
+ "syscall.RTAX_WINDOW": "syscall",
+ "syscall.RTA_ALIGNTO": "syscall",
+ "syscall.RTA_AUTHOR": "syscall",
+ "syscall.RTA_BRD": "syscall",
+ "syscall.RTA_CACHEINFO": "syscall",
+ "syscall.RTA_DST": "syscall",
+ "syscall.RTA_FLOW": "syscall",
+ "syscall.RTA_GATEWAY": "syscall",
+ "syscall.RTA_GENMASK": "syscall",
+ "syscall.RTA_IFA": "syscall",
+ "syscall.RTA_IFP": "syscall",
+ "syscall.RTA_IIF": "syscall",
+ "syscall.RTA_LABEL": "syscall",
+ "syscall.RTA_MAX": "syscall",
+ "syscall.RTA_METRICS": "syscall",
+ "syscall.RTA_MULTIPATH": "syscall",
+ "syscall.RTA_NETMASK": "syscall",
+ "syscall.RTA_OIF": "syscall",
+ "syscall.RTA_PREFSRC": "syscall",
+ "syscall.RTA_PRIORITY": "syscall",
+ "syscall.RTA_SRC": "syscall",
+ "syscall.RTA_SRCMASK": "syscall",
+ "syscall.RTA_TABLE": "syscall",
+ "syscall.RTA_TAG": "syscall",
+ "syscall.RTA_UNSPEC": "syscall",
+ "syscall.RTCF_DIRECTSRC": "syscall",
+ "syscall.RTCF_DOREDIRECT": "syscall",
+ "syscall.RTCF_LOG": "syscall",
+ "syscall.RTCF_MASQ": "syscall",
+ "syscall.RTCF_NAT": "syscall",
+ "syscall.RTCF_VALVE": "syscall",
+ "syscall.RTF_ADDRCLASSMASK": "syscall",
+ "syscall.RTF_ADDRCONF": "syscall",
+ "syscall.RTF_ALLONLINK": "syscall",
+ "syscall.RTF_ANNOUNCE": "syscall",
+ "syscall.RTF_BLACKHOLE": "syscall",
+ "syscall.RTF_BROADCAST": "syscall",
+ "syscall.RTF_CACHE": "syscall",
+ "syscall.RTF_CLONED": "syscall",
+ "syscall.RTF_CLONING": "syscall",
+ "syscall.RTF_CONDEMNED": "syscall",
+ "syscall.RTF_DEFAULT": "syscall",
+ "syscall.RTF_DELCLONE": "syscall",
+ "syscall.RTF_DONE": "syscall",
+ "syscall.RTF_DYNAMIC": "syscall",
+ "syscall.RTF_FLOW": "syscall",
+ "syscall.RTF_FMASK": "syscall",
+ "syscall.RTF_GATEWAY": "syscall",
+ "syscall.RTF_HOST": "syscall",
+ "syscall.RTF_IFREF": "syscall",
+ "syscall.RTF_IFSCOPE": "syscall",
+ "syscall.RTF_INTERFACE": "syscall",
+ "syscall.RTF_IRTT": "syscall",
+ "syscall.RTF_LINKRT": "syscall",
+ "syscall.RTF_LLDATA": "syscall",
+ "syscall.RTF_LLINFO": "syscall",
+ "syscall.RTF_LOCAL": "syscall",
+ "syscall.RTF_MASK": "syscall",
+ "syscall.RTF_MODIFIED": "syscall",
+ "syscall.RTF_MPATH": "syscall",
+ "syscall.RTF_MPLS": "syscall",
+ "syscall.RTF_MSS": "syscall",
+ "syscall.RTF_MTU": "syscall",
+ "syscall.RTF_MULTICAST": "syscall",
+ "syscall.RTF_NAT": "syscall",
+ "syscall.RTF_NOFORWARD": "syscall",
+ "syscall.RTF_NONEXTHOP": "syscall",
+ "syscall.RTF_NOPMTUDISC": "syscall",
+ "syscall.RTF_PERMANENT_ARP": "syscall",
+ "syscall.RTF_PINNED": "syscall",
+ "syscall.RTF_POLICY": "syscall",
+ "syscall.RTF_PRCLONING": "syscall",
+ "syscall.RTF_PROTO1": "syscall",
+ "syscall.RTF_PROTO2": "syscall",
+ "syscall.RTF_PROTO3": "syscall",
+ "syscall.RTF_REINSTATE": "syscall",
+ "syscall.RTF_REJECT": "syscall",
+ "syscall.RTF_RNH_LOCKED": "syscall",
+ "syscall.RTF_SOURCE": "syscall",
+ "syscall.RTF_SRC": "syscall",
+ "syscall.RTF_STATIC": "syscall",
+ "syscall.RTF_STICKY": "syscall",
+ "syscall.RTF_THROW": "syscall",
+ "syscall.RTF_TUNNEL": "syscall",
+ "syscall.RTF_UP": "syscall",
+ "syscall.RTF_USETRAILERS": "syscall",
+ "syscall.RTF_WASCLONED": "syscall",
+ "syscall.RTF_WINDOW": "syscall",
+ "syscall.RTF_XRESOLVE": "syscall",
+ "syscall.RTM_ADD": "syscall",
+ "syscall.RTM_BASE": "syscall",
+ "syscall.RTM_CHANGE": "syscall",
+ "syscall.RTM_CHGADDR": "syscall",
+ "syscall.RTM_DELACTION": "syscall",
+ "syscall.RTM_DELADDR": "syscall",
+ "syscall.RTM_DELADDRLABEL": "syscall",
+ "syscall.RTM_DELETE": "syscall",
+ "syscall.RTM_DELLINK": "syscall",
+ "syscall.RTM_DELMADDR": "syscall",
+ "syscall.RTM_DELNEIGH": "syscall",
+ "syscall.RTM_DELQDISC": "syscall",
+ "syscall.RTM_DELROUTE": "syscall",
+ "syscall.RTM_DELRULE": "syscall",
+ "syscall.RTM_DELTCLASS": "syscall",
+ "syscall.RTM_DELTFILTER": "syscall",
+ "syscall.RTM_DESYNC": "syscall",
+ "syscall.RTM_F_CLONED": "syscall",
+ "syscall.RTM_F_EQUALIZE": "syscall",
+ "syscall.RTM_F_NOTIFY": "syscall",
+ "syscall.RTM_F_PREFIX": "syscall",
+ "syscall.RTM_GET": "syscall",
+ "syscall.RTM_GET2": "syscall",
+ "syscall.RTM_GETACTION": "syscall",
+ "syscall.RTM_GETADDR": "syscall",
+ "syscall.RTM_GETADDRLABEL": "syscall",
+ "syscall.RTM_GETANYCAST": "syscall",
+ "syscall.RTM_GETDCB": "syscall",
+ "syscall.RTM_GETLINK": "syscall",
+ "syscall.RTM_GETMULTICAST": "syscall",
+ "syscall.RTM_GETNEIGH": "syscall",
+ "syscall.RTM_GETNEIGHTBL": "syscall",
+ "syscall.RTM_GETQDISC": "syscall",
+ "syscall.RTM_GETROUTE": "syscall",
+ "syscall.RTM_GETRULE": "syscall",
+ "syscall.RTM_GETTCLASS": "syscall",
+ "syscall.RTM_GETTFILTER": "syscall",
+ "syscall.RTM_IEEE80211": "syscall",
+ "syscall.RTM_IFANNOUNCE": "syscall",
+ "syscall.RTM_IFINFO": "syscall",
+ "syscall.RTM_IFINFO2": "syscall",
+ "syscall.RTM_LLINFO_UPD": "syscall",
+ "syscall.RTM_LOCK": "syscall",
+ "syscall.RTM_LOSING": "syscall",
+ "syscall.RTM_MAX": "syscall",
+ "syscall.RTM_MAXSIZE": "syscall",
+ "syscall.RTM_MISS": "syscall",
+ "syscall.RTM_NEWACTION": "syscall",
+ "syscall.RTM_NEWADDR": "syscall",
+ "syscall.RTM_NEWADDRLABEL": "syscall",
+ "syscall.RTM_NEWLINK": "syscall",
+ "syscall.RTM_NEWMADDR": "syscall",
+ "syscall.RTM_NEWMADDR2": "syscall",
+ "syscall.RTM_NEWNDUSEROPT": "syscall",
+ "syscall.RTM_NEWNEIGH": "syscall",
+ "syscall.RTM_NEWNEIGHTBL": "syscall",
+ "syscall.RTM_NEWPREFIX": "syscall",
+ "syscall.RTM_NEWQDISC": "syscall",
+ "syscall.RTM_NEWROUTE": "syscall",
+ "syscall.RTM_NEWRULE": "syscall",
+ "syscall.RTM_NEWTCLASS": "syscall",
+ "syscall.RTM_NEWTFILTER": "syscall",
+ "syscall.RTM_NR_FAMILIES": "syscall",
+ "syscall.RTM_NR_MSGTYPES": "syscall",
+ "syscall.RTM_OIFINFO": "syscall",
+ "syscall.RTM_OLDADD": "syscall",
+ "syscall.RTM_OLDDEL": "syscall",
+ "syscall.RTM_OOIFINFO": "syscall",
+ "syscall.RTM_REDIRECT": "syscall",
+ "syscall.RTM_RESOLVE": "syscall",
+ "syscall.RTM_RTTUNIT": "syscall",
+ "syscall.RTM_SETDCB": "syscall",
+ "syscall.RTM_SETGATE": "syscall",
+ "syscall.RTM_SETLINK": "syscall",
+ "syscall.RTM_SETNEIGHTBL": "syscall",
+ "syscall.RTM_VERSION": "syscall",
+ "syscall.RTNH_ALIGNTO": "syscall",
+ "syscall.RTNH_F_DEAD": "syscall",
+ "syscall.RTNH_F_ONLINK": "syscall",
+ "syscall.RTNH_F_PERVASIVE": "syscall",
+ "syscall.RTNLGRP_IPV4_IFADDR": "syscall",
+ "syscall.RTNLGRP_IPV4_MROUTE": "syscall",
+ "syscall.RTNLGRP_IPV4_ROUTE": "syscall",
+ "syscall.RTNLGRP_IPV4_RULE": "syscall",
+ "syscall.RTNLGRP_IPV6_IFADDR": "syscall",
+ "syscall.RTNLGRP_IPV6_IFINFO": "syscall",
+ "syscall.RTNLGRP_IPV6_MROUTE": "syscall",
+ "syscall.RTNLGRP_IPV6_PREFIX": "syscall",
+ "syscall.RTNLGRP_IPV6_ROUTE": "syscall",
+ "syscall.RTNLGRP_IPV6_RULE": "syscall",
+ "syscall.RTNLGRP_LINK": "syscall",
+ "syscall.RTNLGRP_ND_USEROPT": "syscall",
+ "syscall.RTNLGRP_NEIGH": "syscall",
+ "syscall.RTNLGRP_NONE": "syscall",
+ "syscall.RTNLGRP_NOTIFY": "syscall",
+ "syscall.RTNLGRP_TC": "syscall",
+ "syscall.RTN_ANYCAST": "syscall",
+ "syscall.RTN_BLACKHOLE": "syscall",
+ "syscall.RTN_BROADCAST": "syscall",
+ "syscall.RTN_LOCAL": "syscall",
+ "syscall.RTN_MAX": "syscall",
+ "syscall.RTN_MULTICAST": "syscall",
+ "syscall.RTN_NAT": "syscall",
+ "syscall.RTN_PROHIBIT": "syscall",
+ "syscall.RTN_THROW": "syscall",
+ "syscall.RTN_UNICAST": "syscall",
+ "syscall.RTN_UNREACHABLE": "syscall",
+ "syscall.RTN_UNSPEC": "syscall",
+ "syscall.RTN_XRESOLVE": "syscall",
+ "syscall.RTPROT_BIRD": "syscall",
+ "syscall.RTPROT_BOOT": "syscall",
+ "syscall.RTPROT_DHCP": "syscall",
+ "syscall.RTPROT_DNROUTED": "syscall",
+ "syscall.RTPROT_GATED": "syscall",
+ "syscall.RTPROT_KERNEL": "syscall",
+ "syscall.RTPROT_MRT": "syscall",
+ "syscall.RTPROT_NTK": "syscall",
+ "syscall.RTPROT_RA": "syscall",
+ "syscall.RTPROT_REDIRECT": "syscall",
+ "syscall.RTPROT_STATIC": "syscall",
+ "syscall.RTPROT_UNSPEC": "syscall",
+ "syscall.RTPROT_XORP": "syscall",
+ "syscall.RTPROT_ZEBRA": "syscall",
+ "syscall.RTV_EXPIRE": "syscall",
+ "syscall.RTV_HOPCOUNT": "syscall",
+ "syscall.RTV_MTU": "syscall",
+ "syscall.RTV_RPIPE": "syscall",
+ "syscall.RTV_RTT": "syscall",
+ "syscall.RTV_RTTVAR": "syscall",
+ "syscall.RTV_SPIPE": "syscall",
+ "syscall.RTV_SSTHRESH": "syscall",
+ "syscall.RTV_WEIGHT": "syscall",
+ "syscall.RT_CACHING_CONTEXT": "syscall",
+ "syscall.RT_CLASS_DEFAULT": "syscall",
+ "syscall.RT_CLASS_LOCAL": "syscall",
+ "syscall.RT_CLASS_MAIN": "syscall",
+ "syscall.RT_CLASS_MAX": "syscall",
+ "syscall.RT_CLASS_UNSPEC": "syscall",
+ "syscall.RT_DEFAULT_FIB": "syscall",
+ "syscall.RT_NORTREF": "syscall",
+ "syscall.RT_SCOPE_HOST": "syscall",
+ "syscall.RT_SCOPE_LINK": "syscall",
+ "syscall.RT_SCOPE_NOWHERE": "syscall",
+ "syscall.RT_SCOPE_SITE": "syscall",
+ "syscall.RT_SCOPE_UNIVERSE": "syscall",
+ "syscall.RT_TABLEID_MAX": "syscall",
+ "syscall.RT_TABLE_COMPAT": "syscall",
+ "syscall.RT_TABLE_DEFAULT": "syscall",
+ "syscall.RT_TABLE_LOCAL": "syscall",
+ "syscall.RT_TABLE_MAIN": "syscall",
+ "syscall.RT_TABLE_MAX": "syscall",
+ "syscall.RT_TABLE_UNSPEC": "syscall",
+ "syscall.RUSAGE_CHILDREN": "syscall",
+ "syscall.RUSAGE_SELF": "syscall",
+ "syscall.RUSAGE_THREAD": "syscall",
+ "syscall.Radvisory_t": "syscall",
+ "syscall.RawSockaddr": "syscall",
+ "syscall.RawSockaddrAny": "syscall",
+ "syscall.RawSockaddrDatalink": "syscall",
+ "syscall.RawSockaddrInet4": "syscall",
+ "syscall.RawSockaddrInet6": "syscall",
+ "syscall.RawSockaddrLinklayer": "syscall",
+ "syscall.RawSockaddrNetlink": "syscall",
+ "syscall.RawSockaddrUnix": "syscall",
+ "syscall.RawSyscall": "syscall",
+ "syscall.RawSyscall6": "syscall",
+ "syscall.Read": "syscall",
+ "syscall.ReadConsole": "syscall",
+ "syscall.ReadDirectoryChanges": "syscall",
+ "syscall.ReadDirent": "syscall",
+ "syscall.ReadFile": "syscall",
+ "syscall.Readlink": "syscall",
+ "syscall.Reboot": "syscall",
+ "syscall.Recvfrom": "syscall",
+ "syscall.Recvmsg": "syscall",
+ "syscall.RegCloseKey": "syscall",
+ "syscall.RegEnumKeyEx": "syscall",
+ "syscall.RegOpenKeyEx": "syscall",
+ "syscall.RegQueryInfoKey": "syscall",
+ "syscall.RegQueryValueEx": "syscall",
+ "syscall.RemoveDirectory": "syscall",
+ "syscall.Removexattr": "syscall",
+ "syscall.Rename": "syscall",
+ "syscall.Renameat": "syscall",
+ "syscall.Revoke": "syscall",
+ "syscall.Rlimit": "syscall",
+ "syscall.Rmdir": "syscall",
+ "syscall.RouteMessage": "syscall",
+ "syscall.RouteRIB": "syscall",
+ "syscall.RtAttr": "syscall",
+ "syscall.RtGenmsg": "syscall",
+ "syscall.RtMetrics": "syscall",
+ "syscall.RtMsg": "syscall",
+ "syscall.RtMsghdr": "syscall",
+ "syscall.RtNexthop": "syscall",
+ "syscall.Rusage": "syscall",
+ "syscall.SCM_BINTIME": "syscall",
+ "syscall.SCM_CREDENTIALS": "syscall",
+ "syscall.SCM_CREDS": "syscall",
+ "syscall.SCM_RIGHTS": "syscall",
+ "syscall.SCM_TIMESTAMP": "syscall",
+ "syscall.SCM_TIMESTAMPING": "syscall",
+ "syscall.SCM_TIMESTAMPNS": "syscall",
+ "syscall.SCM_TIMESTAMP_MONOTONIC": "syscall",
+ "syscall.SHUT_RD": "syscall",
+ "syscall.SHUT_RDWR": "syscall",
+ "syscall.SHUT_WR": "syscall",
+ "syscall.SID": "syscall",
+ "syscall.SIDAndAttributes": "syscall",
+ "syscall.SIGABRT": "syscall",
+ "syscall.SIGALRM": "syscall",
+ "syscall.SIGBUS": "syscall",
+ "syscall.SIGCHLD": "syscall",
+ "syscall.SIGCLD": "syscall",
+ "syscall.SIGCONT": "syscall",
+ "syscall.SIGEMT": "syscall",
+ "syscall.SIGFPE": "syscall",
+ "syscall.SIGHUP": "syscall",
+ "syscall.SIGILL": "syscall",
+ "syscall.SIGINFO": "syscall",
+ "syscall.SIGINT": "syscall",
+ "syscall.SIGIO": "syscall",
+ "syscall.SIGIOT": "syscall",
+ "syscall.SIGKILL": "syscall",
+ "syscall.SIGLIBRT": "syscall",
+ "syscall.SIGLWP": "syscall",
+ "syscall.SIGPIPE": "syscall",
+ "syscall.SIGPOLL": "syscall",
+ "syscall.SIGPROF": "syscall",
+ "syscall.SIGPWR": "syscall",
+ "syscall.SIGQUIT": "syscall",
+ "syscall.SIGSEGV": "syscall",
+ "syscall.SIGSTKFLT": "syscall",
+ "syscall.SIGSTOP": "syscall",
+ "syscall.SIGSYS": "syscall",
+ "syscall.SIGTERM": "syscall",
+ "syscall.SIGTHR": "syscall",
+ "syscall.SIGTRAP": "syscall",
+ "syscall.SIGTSTP": "syscall",
+ "syscall.SIGTTIN": "syscall",
+ "syscall.SIGTTOU": "syscall",
+ "syscall.SIGUNUSED": "syscall",
+ "syscall.SIGURG": "syscall",
+ "syscall.SIGUSR1": "syscall",
+ "syscall.SIGUSR2": "syscall",
+ "syscall.SIGVTALRM": "syscall",
+ "syscall.SIGWINCH": "syscall",
+ "syscall.SIGXCPU": "syscall",
+ "syscall.SIGXFSZ": "syscall",
+ "syscall.SIOCADDDLCI": "syscall",
+ "syscall.SIOCADDMULTI": "syscall",
+ "syscall.SIOCADDRT": "syscall",
+ "syscall.SIOCAIFADDR": "syscall",
+ "syscall.SIOCAIFGROUP": "syscall",
+ "syscall.SIOCALIFADDR": "syscall",
+ "syscall.SIOCARPIPLL": "syscall",
+ "syscall.SIOCATMARK": "syscall",
+ "syscall.SIOCAUTOADDR": "syscall",
+ "syscall.SIOCAUTONETMASK": "syscall",
+ "syscall.SIOCBRDGADD": "syscall",
+ "syscall.SIOCBRDGADDS": "syscall",
+ "syscall.SIOCBRDGARL": "syscall",
+ "syscall.SIOCBRDGDADDR": "syscall",
+ "syscall.SIOCBRDGDEL": "syscall",
+ "syscall.SIOCBRDGDELS": "syscall",
+ "syscall.SIOCBRDGFLUSH": "syscall",
+ "syscall.SIOCBRDGFRL": "syscall",
+ "syscall.SIOCBRDGGCACHE": "syscall",
+ "syscall.SIOCBRDGGFD": "syscall",
+ "syscall.SIOCBRDGGHT": "syscall",
+ "syscall.SIOCBRDGGIFFLGS": "syscall",
+ "syscall.SIOCBRDGGMA": "syscall",
+ "syscall.SIOCBRDGGPARAM": "syscall",
+ "syscall.SIOCBRDGGPRI": "syscall",
+ "syscall.SIOCBRDGGRL": "syscall",
+ "syscall.SIOCBRDGGSIFS": "syscall",
+ "syscall.SIOCBRDGGTO": "syscall",
+ "syscall.SIOCBRDGIFS": "syscall",
+ "syscall.SIOCBRDGRTS": "syscall",
+ "syscall.SIOCBRDGSADDR": "syscall",
+ "syscall.SIOCBRDGSCACHE": "syscall",
+ "syscall.SIOCBRDGSFD": "syscall",
+ "syscall.SIOCBRDGSHT": "syscall",
+ "syscall.SIOCBRDGSIFCOST": "syscall",
+ "syscall.SIOCBRDGSIFFLGS": "syscall",
+ "syscall.SIOCBRDGSIFPRIO": "syscall",
+ "syscall.SIOCBRDGSMA": "syscall",
+ "syscall.SIOCBRDGSPRI": "syscall",
+ "syscall.SIOCBRDGSPROTO": "syscall",
+ "syscall.SIOCBRDGSTO": "syscall",
+ "syscall.SIOCBRDGSTXHC": "syscall",
+ "syscall.SIOCDARP": "syscall",
+ "syscall.SIOCDELDLCI": "syscall",
+ "syscall.SIOCDELMULTI": "syscall",
+ "syscall.SIOCDELRT": "syscall",
+ "syscall.SIOCDEVPRIVATE": "syscall",
+ "syscall.SIOCDIFADDR": "syscall",
+ "syscall.SIOCDIFGROUP": "syscall",
+ "syscall.SIOCDIFPHYADDR": "syscall",
+ "syscall.SIOCDLIFADDR": "syscall",
+ "syscall.SIOCDRARP": "syscall",
+ "syscall.SIOCGARP": "syscall",
+ "syscall.SIOCGDRVSPEC": "syscall",
+ "syscall.SIOCGETKALIVE": "syscall",
+ "syscall.SIOCGETLABEL": "syscall",
+ "syscall.SIOCGETPFLOW": "syscall",
+ "syscall.SIOCGETPFSYNC": "syscall",
+ "syscall.SIOCGETSGCNT": "syscall",
+ "syscall.SIOCGETVIFCNT": "syscall",
+ "syscall.SIOCGETVLAN": "syscall",
+ "syscall.SIOCGHIWAT": "syscall",
+ "syscall.SIOCGIFADDR": "syscall",
+ "syscall.SIOCGIFADDRPREF": "syscall",
+ "syscall.SIOCGIFALIAS": "syscall",
+ "syscall.SIOCGIFALTMTU": "syscall",
+ "syscall.SIOCGIFASYNCMAP": "syscall",
+ "syscall.SIOCGIFBOND": "syscall",
+ "syscall.SIOCGIFBR": "syscall",
+ "syscall.SIOCGIFBRDADDR": "syscall",
+ "syscall.SIOCGIFCAP": "syscall",
+ "syscall.SIOCGIFCONF": "syscall",
+ "syscall.SIOCGIFCOUNT": "syscall",
+ "syscall.SIOCGIFDATA": "syscall",
+ "syscall.SIOCGIFDESCR": "syscall",
+ "syscall.SIOCGIFDEVMTU": "syscall",
+ "syscall.SIOCGIFDLT": "syscall",
+ "syscall.SIOCGIFDSTADDR": "syscall",
+ "syscall.SIOCGIFENCAP": "syscall",
+ "syscall.SIOCGIFFIB": "syscall",
+ "syscall.SIOCGIFFLAGS": "syscall",
+ "syscall.SIOCGIFGATTR": "syscall",
+ "syscall.SIOCGIFGENERIC": "syscall",
+ "syscall.SIOCGIFGMEMB": "syscall",
+ "syscall.SIOCGIFGROUP": "syscall",
+ "syscall.SIOCGIFHWADDR": "syscall",
+ "syscall.SIOCGIFINDEX": "syscall",
+ "syscall.SIOCGIFKPI": "syscall",
+ "syscall.SIOCGIFMAC": "syscall",
+ "syscall.SIOCGIFMAP": "syscall",
+ "syscall.SIOCGIFMEDIA": "syscall",
+ "syscall.SIOCGIFMEM": "syscall",
+ "syscall.SIOCGIFMETRIC": "syscall",
+ "syscall.SIOCGIFMTU": "syscall",
+ "syscall.SIOCGIFNAME": "syscall",
+ "syscall.SIOCGIFNETMASK": "syscall",
+ "syscall.SIOCGIFPDSTADDR": "syscall",
+ "syscall.SIOCGIFPFLAGS": "syscall",
+ "syscall.SIOCGIFPHYS": "syscall",
+ "syscall.SIOCGIFPRIORITY": "syscall",
+ "syscall.SIOCGIFPSRCADDR": "syscall",
+ "syscall.SIOCGIFRDOMAIN": "syscall",
+ "syscall.SIOCGIFRTLABEL": "syscall",
+ "syscall.SIOCGIFSLAVE": "syscall",
+ "syscall.SIOCGIFSTATUS": "syscall",
+ "syscall.SIOCGIFTIMESLOT": "syscall",
+ "syscall.SIOCGIFTXQLEN": "syscall",
+ "syscall.SIOCGIFVLAN": "syscall",
+ "syscall.SIOCGIFWAKEFLAGS": "syscall",
+ "syscall.SIOCGIFXFLAGS": "syscall",
+ "syscall.SIOCGLIFADDR": "syscall",
+ "syscall.SIOCGLIFPHYADDR": "syscall",
+ "syscall.SIOCGLIFPHYRTABLE": "syscall",
+ "syscall.SIOCGLINKSTR": "syscall",
+ "syscall.SIOCGLOWAT": "syscall",
+ "syscall.SIOCGPGRP": "syscall",
+ "syscall.SIOCGPRIVATE_0": "syscall",
+ "syscall.SIOCGPRIVATE_1": "syscall",
+ "syscall.SIOCGRARP": "syscall",
+ "syscall.SIOCGSTAMP": "syscall",
+ "syscall.SIOCGSTAMPNS": "syscall",
+ "syscall.SIOCGVH": "syscall",
+ "syscall.SIOCIFCREATE": "syscall",
+ "syscall.SIOCIFCREATE2": "syscall",
+ "syscall.SIOCIFDESTROY": "syscall",
+ "syscall.SIOCIFGCLONERS": "syscall",
+ "syscall.SIOCINITIFADDR": "syscall",
+ "syscall.SIOCPROTOPRIVATE": "syscall",
+ "syscall.SIOCRSLVMULTI": "syscall",
+ "syscall.SIOCRTMSG": "syscall",
+ "syscall.SIOCSARP": "syscall",
+ "syscall.SIOCSDRVSPEC": "syscall",
+ "syscall.SIOCSETKALIVE": "syscall",
+ "syscall.SIOCSETLABEL": "syscall",
+ "syscall.SIOCSETPFLOW": "syscall",
+ "syscall.SIOCSETPFSYNC": "syscall",
+ "syscall.SIOCSETVLAN": "syscall",
+ "syscall.SIOCSHIWAT": "syscall",
+ "syscall.SIOCSIFADDR": "syscall",
+ "syscall.SIOCSIFADDRPREF": "syscall",
+ "syscall.SIOCSIFALTMTU": "syscall",
+ "syscall.SIOCSIFASYNCMAP": "syscall",
+ "syscall.SIOCSIFBOND": "syscall",
+ "syscall.SIOCSIFBR": "syscall",
+ "syscall.SIOCSIFBRDADDR": "syscall",
+ "syscall.SIOCSIFCAP": "syscall",
+ "syscall.SIOCSIFDESCR": "syscall",
+ "syscall.SIOCSIFDSTADDR": "syscall",
+ "syscall.SIOCSIFENCAP": "syscall",
+ "syscall.SIOCSIFFIB": "syscall",
+ "syscall.SIOCSIFFLAGS": "syscall",
+ "syscall.SIOCSIFGATTR": "syscall",
+ "syscall.SIOCSIFGENERIC": "syscall",
+ "syscall.SIOCSIFHWADDR": "syscall",
+ "syscall.SIOCSIFHWBROADCAST": "syscall",
+ "syscall.SIOCSIFKPI": "syscall",
+ "syscall.SIOCSIFLINK": "syscall",
+ "syscall.SIOCSIFLLADDR": "syscall",
+ "syscall.SIOCSIFMAC": "syscall",
+ "syscall.SIOCSIFMAP": "syscall",
+ "syscall.SIOCSIFMEDIA": "syscall",
+ "syscall.SIOCSIFMEM": "syscall",
+ "syscall.SIOCSIFMETRIC": "syscall",
+ "syscall.SIOCSIFMTU": "syscall",
+ "syscall.SIOCSIFNAME": "syscall",
+ "syscall.SIOCSIFNETMASK": "syscall",
+ "syscall.SIOCSIFPFLAGS": "syscall",
+ "syscall.SIOCSIFPHYADDR": "syscall",
+ "syscall.SIOCSIFPHYS": "syscall",
+ "syscall.SIOCSIFPRIORITY": "syscall",
+ "syscall.SIOCSIFRDOMAIN": "syscall",
+ "syscall.SIOCSIFRTLABEL": "syscall",
+ "syscall.SIOCSIFRVNET": "syscall",
+ "syscall.SIOCSIFSLAVE": "syscall",
+ "syscall.SIOCSIFTIMESLOT": "syscall",
+ "syscall.SIOCSIFTXQLEN": "syscall",
+ "syscall.SIOCSIFVLAN": "syscall",
+ "syscall.SIOCSIFVNET": "syscall",
+ "syscall.SIOCSIFXFLAGS": "syscall",
+ "syscall.SIOCSLIFPHYADDR": "syscall",
+ "syscall.SIOCSLIFPHYRTABLE": "syscall",
+ "syscall.SIOCSLINKSTR": "syscall",
+ "syscall.SIOCSLOWAT": "syscall",
+ "syscall.SIOCSPGRP": "syscall",
+ "syscall.SIOCSRARP": "syscall",
+ "syscall.SIOCSVH": "syscall",
+ "syscall.SIOCZIFDATA": "syscall",
+ "syscall.SIO_GET_EXTENSION_FUNCTION_POINTER": "syscall",
+ "syscall.SIO_GET_INTERFACE_LIST": "syscall",
+ "syscall.SOCK_CLOEXEC": "syscall",
+ "syscall.SOCK_DCCP": "syscall",
+ "syscall.SOCK_DGRAM": "syscall",
+ "syscall.SOCK_FLAGS_MASK": "syscall",
+ "syscall.SOCK_MAXADDRLEN": "syscall",
+ "syscall.SOCK_NONBLOCK": "syscall",
+ "syscall.SOCK_NOSIGPIPE": "syscall",
+ "syscall.SOCK_PACKET": "syscall",
+ "syscall.SOCK_RAW": "syscall",
+ "syscall.SOCK_RDM": "syscall",
+ "syscall.SOCK_SEQPACKET": "syscall",
+ "syscall.SOCK_STREAM": "syscall",
+ "syscall.SOL_AAL": "syscall",
+ "syscall.SOL_ATM": "syscall",
+ "syscall.SOL_DECNET": "syscall",
+ "syscall.SOL_ICMPV6": "syscall",
+ "syscall.SOL_IP": "syscall",
+ "syscall.SOL_IPV6": "syscall",
+ "syscall.SOL_IRDA": "syscall",
+ "syscall.SOL_PACKET": "syscall",
+ "syscall.SOL_RAW": "syscall",
+ "syscall.SOL_SOCKET": "syscall",
+ "syscall.SOL_TCP": "syscall",
+ "syscall.SOL_X25": "syscall",
+ "syscall.SOMAXCONN": "syscall",
+ "syscall.SO_ACCEPTCONN": "syscall",
+ "syscall.SO_ACCEPTFILTER": "syscall",
+ "syscall.SO_ATTACH_FILTER": "syscall",
+ "syscall.SO_BINDANY": "syscall",
+ "syscall.SO_BINDTODEVICE": "syscall",
+ "syscall.SO_BINTIME": "syscall",
+ "syscall.SO_BROADCAST": "syscall",
+ "syscall.SO_BSDCOMPAT": "syscall",
+ "syscall.SO_DEBUG": "syscall",
+ "syscall.SO_DETACH_FILTER": "syscall",
+ "syscall.SO_DOMAIN": "syscall",
+ "syscall.SO_DONTROUTE": "syscall",
+ "syscall.SO_DONTTRUNC": "syscall",
+ "syscall.SO_ERROR": "syscall",
+ "syscall.SO_KEEPALIVE": "syscall",
+ "syscall.SO_LABEL": "syscall",
+ "syscall.SO_LINGER": "syscall",
+ "syscall.SO_LINGER_SEC": "syscall",
+ "syscall.SO_LISTENINCQLEN": "syscall",
+ "syscall.SO_LISTENQLEN": "syscall",
+ "syscall.SO_LISTENQLIMIT": "syscall",
+ "syscall.SO_MARK": "syscall",
+ "syscall.SO_NETPROC": "syscall",
+ "syscall.SO_NKE": "syscall",
+ "syscall.SO_NOADDRERR": "syscall",
+ "syscall.SO_NOHEADER": "syscall",
+ "syscall.SO_NOSIGPIPE": "syscall",
+ "syscall.SO_NOTIFYCONFLICT": "syscall",
+ "syscall.SO_NO_CHECK": "syscall",
+ "syscall.SO_NO_DDP": "syscall",
+ "syscall.SO_NO_OFFLOAD": "syscall",
+ "syscall.SO_NP_EXTENSIONS": "syscall",
+ "syscall.SO_NREAD": "syscall",
+ "syscall.SO_NWRITE": "syscall",
+ "syscall.SO_OOBINLINE": "syscall",
+ "syscall.SO_OVERFLOWED": "syscall",
+ "syscall.SO_PASSCRED": "syscall",
+ "syscall.SO_PASSSEC": "syscall",
+ "syscall.SO_PEERCRED": "syscall",
+ "syscall.SO_PEERLABEL": "syscall",
+ "syscall.SO_PEERNAME": "syscall",
+ "syscall.SO_PEERSEC": "syscall",
+ "syscall.SO_PRIORITY": "syscall",
+ "syscall.SO_PROTOCOL": "syscall",
+ "syscall.SO_PROTOTYPE": "syscall",
+ "syscall.SO_RANDOMPORT": "syscall",
+ "syscall.SO_RCVBUF": "syscall",
+ "syscall.SO_RCVBUFFORCE": "syscall",
+ "syscall.SO_RCVLOWAT": "syscall",
+ "syscall.SO_RCVTIMEO": "syscall",
+ "syscall.SO_RESTRICTIONS": "syscall",
+ "syscall.SO_RESTRICT_DENYIN": "syscall",
+ "syscall.SO_RESTRICT_DENYOUT": "syscall",
+ "syscall.SO_RESTRICT_DENYSET": "syscall",
+ "syscall.SO_REUSEADDR": "syscall",
+ "syscall.SO_REUSEPORT": "syscall",
+ "syscall.SO_REUSESHAREUID": "syscall",
+ "syscall.SO_RTABLE": "syscall",
+ "syscall.SO_RXQ_OVFL": "syscall",
+ "syscall.SO_SECURITY_AUTHENTICATION": "syscall",
+ "syscall.SO_SECURITY_ENCRYPTION_NETWORK": "syscall",
+ "syscall.SO_SECURITY_ENCRYPTION_TRANSPORT": "syscall",
+ "syscall.SO_SETFIB": "syscall",
+ "syscall.SO_SNDBUF": "syscall",
+ "syscall.SO_SNDBUFFORCE": "syscall",
+ "syscall.SO_SNDLOWAT": "syscall",
+ "syscall.SO_SNDTIMEO": "syscall",
+ "syscall.SO_SPLICE": "syscall",
+ "syscall.SO_TIMESTAMP": "syscall",
+ "syscall.SO_TIMESTAMPING": "syscall",
+ "syscall.SO_TIMESTAMPNS": "syscall",
+ "syscall.SO_TIMESTAMP_MONOTONIC": "syscall",
+ "syscall.SO_TYPE": "syscall",
+ "syscall.SO_UPCALLCLOSEWAIT": "syscall",
+ "syscall.SO_UPDATE_ACCEPT_CONTEXT": "syscall",
+ "syscall.SO_UPDATE_CONNECT_CONTEXT": "syscall",
+ "syscall.SO_USELOOPBACK": "syscall",
+ "syscall.SO_USER_COOKIE": "syscall",
+ "syscall.SO_WANTMORE": "syscall",
+ "syscall.SO_WANTOOBFLAG": "syscall",
+ "syscall.SSLExtraCertChainPolicyPara": "syscall",
+ "syscall.STANDARD_RIGHTS_ALL": "syscall",
+ "syscall.STANDARD_RIGHTS_EXECUTE": "syscall",
+ "syscall.STANDARD_RIGHTS_READ": "syscall",
+ "syscall.STANDARD_RIGHTS_REQUIRED": "syscall",
+ "syscall.STANDARD_RIGHTS_WRITE": "syscall",
+ "syscall.STARTF_USESHOWWINDOW": "syscall",
+ "syscall.STARTF_USESTDHANDLES": "syscall",
+ "syscall.STD_ERROR_HANDLE": "syscall",
+ "syscall.STD_INPUT_HANDLE": "syscall",
+ "syscall.STD_OUTPUT_HANDLE": "syscall",
+ "syscall.SUBLANG_ENGLISH_US": "syscall",
+ "syscall.SW_FORCEMINIMIZE": "syscall",
+ "syscall.SW_HIDE": "syscall",
+ "syscall.SW_MAXIMIZE": "syscall",
+ "syscall.SW_MINIMIZE": "syscall",
+ "syscall.SW_NORMAL": "syscall",
+ "syscall.SW_RESTORE": "syscall",
+ "syscall.SW_SHOW": "syscall",
+ "syscall.SW_SHOWDEFAULT": "syscall",
+ "syscall.SW_SHOWMAXIMIZED": "syscall",
+ "syscall.SW_SHOWMINIMIZED": "syscall",
+ "syscall.SW_SHOWMINNOACTIVE": "syscall",
+ "syscall.SW_SHOWNA": "syscall",
+ "syscall.SW_SHOWNOACTIVATE": "syscall",
+ "syscall.SW_SHOWNORMAL": "syscall",
+ "syscall.SYNCHRONIZE": "syscall",
+ "syscall.SYSCTL_VERSION": "syscall",
+ "syscall.SYSCTL_VERS_0": "syscall",
+ "syscall.SYSCTL_VERS_1": "syscall",
+ "syscall.SYSCTL_VERS_MASK": "syscall",
+ "syscall.SYS_ABORT2": "syscall",
+ "syscall.SYS_ACCEPT": "syscall",
+ "syscall.SYS_ACCEPT4": "syscall",
+ "syscall.SYS_ACCEPT_NOCANCEL": "syscall",
+ "syscall.SYS_ACCESS": "syscall",
+ "syscall.SYS_ACCESS_EXTENDED": "syscall",
+ "syscall.SYS_ACCT": "syscall",
+ "syscall.SYS_ADD_KEY": "syscall",
+ "syscall.SYS_ADD_PROFIL": "syscall",
+ "syscall.SYS_ADJFREQ": "syscall",
+ "syscall.SYS_ADJTIME": "syscall",
+ "syscall.SYS_ADJTIMEX": "syscall",
+ "syscall.SYS_AFS_SYSCALL": "syscall",
+ "syscall.SYS_AIO_CANCEL": "syscall",
+ "syscall.SYS_AIO_ERROR": "syscall",
+ "syscall.SYS_AIO_FSYNC": "syscall",
+ "syscall.SYS_AIO_READ": "syscall",
+ "syscall.SYS_AIO_RETURN": "syscall",
+ "syscall.SYS_AIO_SUSPEND": "syscall",
+ "syscall.SYS_AIO_SUSPEND_NOCANCEL": "syscall",
+ "syscall.SYS_AIO_WRITE": "syscall",
+ "syscall.SYS_ALARM": "syscall",
+ "syscall.SYS_ARCH_PRCTL": "syscall",
+ "syscall.SYS_ARM_FADVISE64_64": "syscall",
+ "syscall.SYS_ARM_SYNC_FILE_RANGE": "syscall",
+ "syscall.SYS_ATGETMSG": "syscall",
+ "syscall.SYS_ATPGETREQ": "syscall",
+ "syscall.SYS_ATPGETRSP": "syscall",
+ "syscall.SYS_ATPSNDREQ": "syscall",
+ "syscall.SYS_ATPSNDRSP": "syscall",
+ "syscall.SYS_ATPUTMSG": "syscall",
+ "syscall.SYS_ATSOCKET": "syscall",
+ "syscall.SYS_AUDIT": "syscall",
+ "syscall.SYS_AUDITCTL": "syscall",
+ "syscall.SYS_AUDITON": "syscall",
+ "syscall.SYS_AUDIT_SESSION_JOIN": "syscall",
+ "syscall.SYS_AUDIT_SESSION_PORT": "syscall",
+ "syscall.SYS_AUDIT_SESSION_SELF": "syscall",
+ "syscall.SYS_BDFLUSH": "syscall",
+ "syscall.SYS_BIND": "syscall",
+ "syscall.SYS_BREAK": "syscall",
+ "syscall.SYS_BRK": "syscall",
+ "syscall.SYS_BSDTHREAD_CREATE": "syscall",
+ "syscall.SYS_BSDTHREAD_REGISTER": "syscall",
+ "syscall.SYS_BSDTHREAD_TERMINATE": "syscall",
+ "syscall.SYS_CAPGET": "syscall",
+ "syscall.SYS_CAPSET": "syscall",
+ "syscall.SYS_CAP_ENTER": "syscall",
+ "syscall.SYS_CAP_FCNTLS_GET": "syscall",
+ "syscall.SYS_CAP_FCNTLS_LIMIT": "syscall",
+ "syscall.SYS_CAP_GETMODE": "syscall",
+ "syscall.SYS_CAP_GETRIGHTS": "syscall",
+ "syscall.SYS_CAP_IOCTLS_GET": "syscall",
+ "syscall.SYS_CAP_IOCTLS_LIMIT": "syscall",
+ "syscall.SYS_CAP_NEW": "syscall",
+ "syscall.SYS_CAP_RIGHTS_GET": "syscall",
+ "syscall.SYS_CAP_RIGHTS_LIMIT": "syscall",
+ "syscall.SYS_CHDIR": "syscall",
+ "syscall.SYS_CHFLAGS": "syscall",
+ "syscall.SYS_CHMOD": "syscall",
+ "syscall.SYS_CHMOD_EXTENDED": "syscall",
+ "syscall.SYS_CHOWN": "syscall",
+ "syscall.SYS_CHOWN32": "syscall",
+ "syscall.SYS_CHROOT": "syscall",
+ "syscall.SYS_CHUD": "syscall",
+ "syscall.SYS_CLOCK_ADJTIME": "syscall",
+ "syscall.SYS_CLOCK_GETCPUCLOCKID2": "syscall",
+ "syscall.SYS_CLOCK_GETRES": "syscall",
+ "syscall.SYS_CLOCK_GETTIME": "syscall",
+ "syscall.SYS_CLOCK_NANOSLEEP": "syscall",
+ "syscall.SYS_CLOCK_SETTIME": "syscall",
+ "syscall.SYS_CLONE": "syscall",
+ "syscall.SYS_CLOSE": "syscall",
+ "syscall.SYS_CLOSEFROM": "syscall",
+ "syscall.SYS_CLOSE_NOCANCEL": "syscall",
+ "syscall.SYS_CONNECT": "syscall",
+ "syscall.SYS_CONNECT_NOCANCEL": "syscall",
+ "syscall.SYS_COPYFILE": "syscall",
+ "syscall.SYS_CPUSET": "syscall",
+ "syscall.SYS_CPUSET_GETAFFINITY": "syscall",
+ "syscall.SYS_CPUSET_GETID": "syscall",
+ "syscall.SYS_CPUSET_SETAFFINITY": "syscall",
+ "syscall.SYS_CPUSET_SETID": "syscall",
+ "syscall.SYS_CREAT": "syscall",
+ "syscall.SYS_CREATE_MODULE": "syscall",
+ "syscall.SYS_CSOPS": "syscall",
+ "syscall.SYS_DELETE": "syscall",
+ "syscall.SYS_DELETE_MODULE": "syscall",
+ "syscall.SYS_DUP": "syscall",
+ "syscall.SYS_DUP2": "syscall",
+ "syscall.SYS_DUP3": "syscall",
+ "syscall.SYS_EACCESS": "syscall",
+ "syscall.SYS_EPOLL_CREATE": "syscall",
+ "syscall.SYS_EPOLL_CREATE1": "syscall",
+ "syscall.SYS_EPOLL_CTL": "syscall",
+ "syscall.SYS_EPOLL_CTL_OLD": "syscall",
+ "syscall.SYS_EPOLL_PWAIT": "syscall",
+ "syscall.SYS_EPOLL_WAIT": "syscall",
+ "syscall.SYS_EPOLL_WAIT_OLD": "syscall",
+ "syscall.SYS_EVENTFD": "syscall",
+ "syscall.SYS_EVENTFD2": "syscall",
+ "syscall.SYS_EXCHANGEDATA": "syscall",
+ "syscall.SYS_EXECVE": "syscall",
+ "syscall.SYS_EXIT": "syscall",
+ "syscall.SYS_EXIT_GROUP": "syscall",
+ "syscall.SYS_EXTATTRCTL": "syscall",
+ "syscall.SYS_EXTATTR_DELETE_FD": "syscall",
+ "syscall.SYS_EXTATTR_DELETE_FILE": "syscall",
+ "syscall.SYS_EXTATTR_DELETE_LINK": "syscall",
+ "syscall.SYS_EXTATTR_GET_FD": "syscall",
+ "syscall.SYS_EXTATTR_GET_FILE": "syscall",
+ "syscall.SYS_EXTATTR_GET_LINK": "syscall",
+ "syscall.SYS_EXTATTR_LIST_FD": "syscall",
+ "syscall.SYS_EXTATTR_LIST_FILE": "syscall",
+ "syscall.SYS_EXTATTR_LIST_LINK": "syscall",
+ "syscall.SYS_EXTATTR_SET_FD": "syscall",
+ "syscall.SYS_EXTATTR_SET_FILE": "syscall",
+ "syscall.SYS_EXTATTR_SET_LINK": "syscall",
+ "syscall.SYS_FACCESSAT": "syscall",
+ "syscall.SYS_FADVISE64": "syscall",
+ "syscall.SYS_FADVISE64_64": "syscall",
+ "syscall.SYS_FALLOCATE": "syscall",
+ "syscall.SYS_FANOTIFY_INIT": "syscall",
+ "syscall.SYS_FANOTIFY_MARK": "syscall",
+ "syscall.SYS_FCHDIR": "syscall",
+ "syscall.SYS_FCHFLAGS": "syscall",
+ "syscall.SYS_FCHMOD": "syscall",
+ "syscall.SYS_FCHMODAT": "syscall",
+ "syscall.SYS_FCHMOD_EXTENDED": "syscall",
+ "syscall.SYS_FCHOWN": "syscall",
+ "syscall.SYS_FCHOWN32": "syscall",
+ "syscall.SYS_FCHOWNAT": "syscall",
+ "syscall.SYS_FCHROOT": "syscall",
+ "syscall.SYS_FCNTL": "syscall",
+ "syscall.SYS_FCNTL64": "syscall",
+ "syscall.SYS_FCNTL_NOCANCEL": "syscall",
+ "syscall.SYS_FDATASYNC": "syscall",
+ "syscall.SYS_FEXECVE": "syscall",
+ "syscall.SYS_FFCLOCK_GETCOUNTER": "syscall",
+ "syscall.SYS_FFCLOCK_GETESTIMATE": "syscall",
+ "syscall.SYS_FFCLOCK_SETESTIMATE": "syscall",
+ "syscall.SYS_FFSCTL": "syscall",
+ "syscall.SYS_FGETATTRLIST": "syscall",
+ "syscall.SYS_FGETXATTR": "syscall",
+ "syscall.SYS_FHOPEN": "syscall",
+ "syscall.SYS_FHSTAT": "syscall",
+ "syscall.SYS_FHSTATFS": "syscall",
+ "syscall.SYS_FILEPORT_MAKEFD": "syscall",
+ "syscall.SYS_FILEPORT_MAKEPORT": "syscall",
+ "syscall.SYS_FKTRACE": "syscall",
+ "syscall.SYS_FLISTXATTR": "syscall",
+ "syscall.SYS_FLOCK": "syscall",
+ "syscall.SYS_FORK": "syscall",
+ "syscall.SYS_FPATHCONF": "syscall",
+ "syscall.SYS_FREEBSD6_FTRUNCATE": "syscall",
+ "syscall.SYS_FREEBSD6_LSEEK": "syscall",
+ "syscall.SYS_FREEBSD6_MMAP": "syscall",
+ "syscall.SYS_FREEBSD6_PREAD": "syscall",
+ "syscall.SYS_FREEBSD6_PWRITE": "syscall",
+ "syscall.SYS_FREEBSD6_TRUNCATE": "syscall",
+ "syscall.SYS_FREMOVEXATTR": "syscall",
+ "syscall.SYS_FSCTL": "syscall",
+ "syscall.SYS_FSETATTRLIST": "syscall",
+ "syscall.SYS_FSETXATTR": "syscall",
+ "syscall.SYS_FSGETPATH": "syscall",
+ "syscall.SYS_FSTAT": "syscall",
+ "syscall.SYS_FSTAT64": "syscall",
+ "syscall.SYS_FSTAT64_EXTENDED": "syscall",
+ "syscall.SYS_FSTATAT": "syscall",
+ "syscall.SYS_FSTATAT64": "syscall",
+ "syscall.SYS_FSTATFS": "syscall",
+ "syscall.SYS_FSTATFS64": "syscall",
+ "syscall.SYS_FSTATV": "syscall",
+ "syscall.SYS_FSTATVFS1": "syscall",
+ "syscall.SYS_FSTAT_EXTENDED": "syscall",
+ "syscall.SYS_FSYNC": "syscall",
+ "syscall.SYS_FSYNC_NOCANCEL": "syscall",
+ "syscall.SYS_FSYNC_RANGE": "syscall",
+ "syscall.SYS_FTIME": "syscall",
+ "syscall.SYS_FTRUNCATE": "syscall",
+ "syscall.SYS_FTRUNCATE64": "syscall",
+ "syscall.SYS_FUTEX": "syscall",
+ "syscall.SYS_FUTIMENS": "syscall",
+ "syscall.SYS_FUTIMES": "syscall",
+ "syscall.SYS_FUTIMESAT": "syscall",
+ "syscall.SYS_GETATTRLIST": "syscall",
+ "syscall.SYS_GETAUDIT": "syscall",
+ "syscall.SYS_GETAUDIT_ADDR": "syscall",
+ "syscall.SYS_GETAUID": "syscall",
+ "syscall.SYS_GETCONTEXT": "syscall",
+ "syscall.SYS_GETCPU": "syscall",
+ "syscall.SYS_GETCWD": "syscall",
+ "syscall.SYS_GETDENTS": "syscall",
+ "syscall.SYS_GETDENTS64": "syscall",
+ "syscall.SYS_GETDIRENTRIES": "syscall",
+ "syscall.SYS_GETDIRENTRIES64": "syscall",
+ "syscall.SYS_GETDIRENTRIESATTR": "syscall",
+ "syscall.SYS_GETDTABLECOUNT": "syscall",
+ "syscall.SYS_GETDTABLESIZE": "syscall",
+ "syscall.SYS_GETEGID": "syscall",
+ "syscall.SYS_GETEGID32": "syscall",
+ "syscall.SYS_GETEUID": "syscall",
+ "syscall.SYS_GETEUID32": "syscall",
+ "syscall.SYS_GETFH": "syscall",
+ "syscall.SYS_GETFSSTAT": "syscall",
+ "syscall.SYS_GETFSSTAT64": "syscall",
+ "syscall.SYS_GETGID": "syscall",
+ "syscall.SYS_GETGID32": "syscall",
+ "syscall.SYS_GETGROUPS": "syscall",
+ "syscall.SYS_GETGROUPS32": "syscall",
+ "syscall.SYS_GETHOSTUUID": "syscall",
+ "syscall.SYS_GETITIMER": "syscall",
+ "syscall.SYS_GETLCID": "syscall",
+ "syscall.SYS_GETLOGIN": "syscall",
+ "syscall.SYS_GETLOGINCLASS": "syscall",
+ "syscall.SYS_GETPEERNAME": "syscall",
+ "syscall.SYS_GETPGID": "syscall",
+ "syscall.SYS_GETPGRP": "syscall",
+ "syscall.SYS_GETPID": "syscall",
+ "syscall.SYS_GETPMSG": "syscall",
+ "syscall.SYS_GETPPID": "syscall",
+ "syscall.SYS_GETPRIORITY": "syscall",
+ "syscall.SYS_GETRESGID": "syscall",
+ "syscall.SYS_GETRESGID32": "syscall",
+ "syscall.SYS_GETRESUID": "syscall",
+ "syscall.SYS_GETRESUID32": "syscall",
+ "syscall.SYS_GETRLIMIT": "syscall",
+ "syscall.SYS_GETRTABLE": "syscall",
+ "syscall.SYS_GETRUSAGE": "syscall",
+ "syscall.SYS_GETSGROUPS": "syscall",
+ "syscall.SYS_GETSID": "syscall",
+ "syscall.SYS_GETSOCKNAME": "syscall",
+ "syscall.SYS_GETSOCKOPT": "syscall",
+ "syscall.SYS_GETTHRID": "syscall",
+ "syscall.SYS_GETTID": "syscall",
+ "syscall.SYS_GETTIMEOFDAY": "syscall",
+ "syscall.SYS_GETUID": "syscall",
+ "syscall.SYS_GETUID32": "syscall",
+ "syscall.SYS_GETVFSSTAT": "syscall",
+ "syscall.SYS_GETWGROUPS": "syscall",
+ "syscall.SYS_GETXATTR": "syscall",
+ "syscall.SYS_GET_KERNEL_SYMS": "syscall",
+ "syscall.SYS_GET_MEMPOLICY": "syscall",
+ "syscall.SYS_GET_ROBUST_LIST": "syscall",
+ "syscall.SYS_GET_THREAD_AREA": "syscall",
+ "syscall.SYS_GTTY": "syscall",
+ "syscall.SYS_IDENTITYSVC": "syscall",
+ "syscall.SYS_IDLE": "syscall",
+ "syscall.SYS_INITGROUPS": "syscall",
+ "syscall.SYS_INIT_MODULE": "syscall",
+ "syscall.SYS_INOTIFY_ADD_WATCH": "syscall",
+ "syscall.SYS_INOTIFY_INIT": "syscall",
+ "syscall.SYS_INOTIFY_INIT1": "syscall",
+ "syscall.SYS_INOTIFY_RM_WATCH": "syscall",
+ "syscall.SYS_IOCTL": "syscall",
+ "syscall.SYS_IOPERM": "syscall",
+ "syscall.SYS_IOPL": "syscall",
+ "syscall.SYS_IOPOLICYSYS": "syscall",
+ "syscall.SYS_IOPRIO_GET": "syscall",
+ "syscall.SYS_IOPRIO_SET": "syscall",
+ "syscall.SYS_IO_CANCEL": "syscall",
+ "syscall.SYS_IO_DESTROY": "syscall",
+ "syscall.SYS_IO_GETEVENTS": "syscall",
+ "syscall.SYS_IO_SETUP": "syscall",
+ "syscall.SYS_IO_SUBMIT": "syscall",
+ "syscall.SYS_IPC": "syscall",
+ "syscall.SYS_ISSETUGID": "syscall",
+ "syscall.SYS_JAIL": "syscall",
+ "syscall.SYS_JAIL_ATTACH": "syscall",
+ "syscall.SYS_JAIL_GET": "syscall",
+ "syscall.SYS_JAIL_REMOVE": "syscall",
+ "syscall.SYS_JAIL_SET": "syscall",
+ "syscall.SYS_KDEBUG_TRACE": "syscall",
+ "syscall.SYS_KENV": "syscall",
+ "syscall.SYS_KEVENT": "syscall",
+ "syscall.SYS_KEVENT64": "syscall",
+ "syscall.SYS_KEXEC_LOAD": "syscall",
+ "syscall.SYS_KEYCTL": "syscall",
+ "syscall.SYS_KILL": "syscall",
+ "syscall.SYS_KLDFIND": "syscall",
+ "syscall.SYS_KLDFIRSTMOD": "syscall",
+ "syscall.SYS_KLDLOAD": "syscall",
+ "syscall.SYS_KLDNEXT": "syscall",
+ "syscall.SYS_KLDSTAT": "syscall",
+ "syscall.SYS_KLDSYM": "syscall",
+ "syscall.SYS_KLDUNLOAD": "syscall",
+ "syscall.SYS_KLDUNLOADF": "syscall",
+ "syscall.SYS_KQUEUE": "syscall",
+ "syscall.SYS_KQUEUE1": "syscall",
+ "syscall.SYS_KTIMER_CREATE": "syscall",
+ "syscall.SYS_KTIMER_DELETE": "syscall",
+ "syscall.SYS_KTIMER_GETOVERRUN": "syscall",
+ "syscall.SYS_KTIMER_GETTIME": "syscall",
+ "syscall.SYS_KTIMER_SETTIME": "syscall",
+ "syscall.SYS_KTRACE": "syscall",
+ "syscall.SYS_LCHFLAGS": "syscall",
+ "syscall.SYS_LCHMOD": "syscall",
+ "syscall.SYS_LCHOWN": "syscall",
+ "syscall.SYS_LCHOWN32": "syscall",
+ "syscall.SYS_LGETFH": "syscall",
+ "syscall.SYS_LGETXATTR": "syscall",
+ "syscall.SYS_LINK": "syscall",
+ "syscall.SYS_LINKAT": "syscall",
+ "syscall.SYS_LIO_LISTIO": "syscall",
+ "syscall.SYS_LISTEN": "syscall",
+ "syscall.SYS_LISTXATTR": "syscall",
+ "syscall.SYS_LLISTXATTR": "syscall",
+ "syscall.SYS_LOCK": "syscall",
+ "syscall.SYS_LOOKUP_DCOOKIE": "syscall",
+ "syscall.SYS_LPATHCONF": "syscall",
+ "syscall.SYS_LREMOVEXATTR": "syscall",
+ "syscall.SYS_LSEEK": "syscall",
+ "syscall.SYS_LSETXATTR": "syscall",
+ "syscall.SYS_LSTAT": "syscall",
+ "syscall.SYS_LSTAT64": "syscall",
+ "syscall.SYS_LSTAT64_EXTENDED": "syscall",
+ "syscall.SYS_LSTATV": "syscall",
+ "syscall.SYS_LSTAT_EXTENDED": "syscall",
+ "syscall.SYS_LUTIMES": "syscall",
+ "syscall.SYS_MAC_SYSCALL": "syscall",
+ "syscall.SYS_MADVISE": "syscall",
+ "syscall.SYS_MADVISE1": "syscall",
+ "syscall.SYS_MAXSYSCALL": "syscall",
+ "syscall.SYS_MBIND": "syscall",
+ "syscall.SYS_MIGRATE_PAGES": "syscall",
+ "syscall.SYS_MINCORE": "syscall",
+ "syscall.SYS_MINHERIT": "syscall",
+ "syscall.SYS_MKCOMPLEX": "syscall",
+ "syscall.SYS_MKDIR": "syscall",
+ "syscall.SYS_MKDIRAT": "syscall",
+ "syscall.SYS_MKDIR_EXTENDED": "syscall",
+ "syscall.SYS_MKFIFO": "syscall",
+ "syscall.SYS_MKFIFOAT": "syscall",
+ "syscall.SYS_MKFIFO_EXTENDED": "syscall",
+ "syscall.SYS_MKNOD": "syscall",
+ "syscall.SYS_MKNODAT": "syscall",
+ "syscall.SYS_MLOCK": "syscall",
+ "syscall.SYS_MLOCKALL": "syscall",
+ "syscall.SYS_MMAP": "syscall",
+ "syscall.SYS_MMAP2": "syscall",
+ "syscall.SYS_MODCTL": "syscall",
+ "syscall.SYS_MODFIND": "syscall",
+ "syscall.SYS_MODFNEXT": "syscall",
+ "syscall.SYS_MODIFY_LDT": "syscall",
+ "syscall.SYS_MODNEXT": "syscall",
+ "syscall.SYS_MODSTAT": "syscall",
+ "syscall.SYS_MODWATCH": "syscall",
+ "syscall.SYS_MOUNT": "syscall",
+ "syscall.SYS_MOVE_PAGES": "syscall",
+ "syscall.SYS_MPROTECT": "syscall",
+ "syscall.SYS_MPX": "syscall",
+ "syscall.SYS_MQUERY": "syscall",
+ "syscall.SYS_MQ_GETSETATTR": "syscall",
+ "syscall.SYS_MQ_NOTIFY": "syscall",
+ "syscall.SYS_MQ_OPEN": "syscall",
+ "syscall.SYS_MQ_TIMEDRECEIVE": "syscall",
+ "syscall.SYS_MQ_TIMEDSEND": "syscall",
+ "syscall.SYS_MQ_UNLINK": "syscall",
+ "syscall.SYS_MREMAP": "syscall",
+ "syscall.SYS_MSGCTL": "syscall",
+ "syscall.SYS_MSGGET": "syscall",
+ "syscall.SYS_MSGRCV": "syscall",
+ "syscall.SYS_MSGRCV_NOCANCEL": "syscall",
+ "syscall.SYS_MSGSND": "syscall",
+ "syscall.SYS_MSGSND_NOCANCEL": "syscall",
+ "syscall.SYS_MSGSYS": "syscall",
+ "syscall.SYS_MSYNC": "syscall",
+ "syscall.SYS_MSYNC_NOCANCEL": "syscall",
+ "syscall.SYS_MUNLOCK": "syscall",
+ "syscall.SYS_MUNLOCKALL": "syscall",
+ "syscall.SYS_MUNMAP": "syscall",
+ "syscall.SYS_NAME_TO_HANDLE_AT": "syscall",
+ "syscall.SYS_NANOSLEEP": "syscall",
+ "syscall.SYS_NEWFSTATAT": "syscall",
+ "syscall.SYS_NFSCLNT": "syscall",
+ "syscall.SYS_NFSSERVCTL": "syscall",
+ "syscall.SYS_NFSSVC": "syscall",
+ "syscall.SYS_NFSTAT": "syscall",
+ "syscall.SYS_NICE": "syscall",
+ "syscall.SYS_NLSTAT": "syscall",
+ "syscall.SYS_NMOUNT": "syscall",
+ "syscall.SYS_NSTAT": "syscall",
+ "syscall.SYS_NTP_ADJTIME": "syscall",
+ "syscall.SYS_NTP_GETTIME": "syscall",
+ "syscall.SYS_OABI_SYSCALL_BASE": "syscall",
+ "syscall.SYS_OBREAK": "syscall",
+ "syscall.SYS_OLDFSTAT": "syscall",
+ "syscall.SYS_OLDLSTAT": "syscall",
+ "syscall.SYS_OLDOLDUNAME": "syscall",
+ "syscall.SYS_OLDSTAT": "syscall",
+ "syscall.SYS_OLDUNAME": "syscall",
+ "syscall.SYS_OPEN": "syscall",
+ "syscall.SYS_OPENAT": "syscall",
+ "syscall.SYS_OPENBSD_POLL": "syscall",
+ "syscall.SYS_OPEN_BY_HANDLE_AT": "syscall",
+ "syscall.SYS_OPEN_EXTENDED": "syscall",
+ "syscall.SYS_OPEN_NOCANCEL": "syscall",
+ "syscall.SYS_OVADVISE": "syscall",
+ "syscall.SYS_PACCEPT": "syscall",
+ "syscall.SYS_PATHCONF": "syscall",
+ "syscall.SYS_PAUSE": "syscall",
+ "syscall.SYS_PCICONFIG_IOBASE": "syscall",
+ "syscall.SYS_PCICONFIG_READ": "syscall",
+ "syscall.SYS_PCICONFIG_WRITE": "syscall",
+ "syscall.SYS_PDFORK": "syscall",
+ "syscall.SYS_PDGETPID": "syscall",
+ "syscall.SYS_PDKILL": "syscall",
+ "syscall.SYS_PERF_EVENT_OPEN": "syscall",
+ "syscall.SYS_PERSONALITY": "syscall",
+ "syscall.SYS_PID_HIBERNATE": "syscall",
+ "syscall.SYS_PID_RESUME": "syscall",
+ "syscall.SYS_PID_SHUTDOWN_SOCKETS": "syscall",
+ "syscall.SYS_PID_SUSPEND": "syscall",
+ "syscall.SYS_PIPE": "syscall",
+ "syscall.SYS_PIPE2": "syscall",
+ "syscall.SYS_PIVOT_ROOT": "syscall",
+ "syscall.SYS_PMC_CONTROL": "syscall",
+ "syscall.SYS_PMC_GET_INFO": "syscall",
+ "syscall.SYS_POLL": "syscall",
+ "syscall.SYS_POLLTS": "syscall",
+ "syscall.SYS_POLL_NOCANCEL": "syscall",
+ "syscall.SYS_POSIX_FADVISE": "syscall",
+ "syscall.SYS_POSIX_FALLOCATE": "syscall",
+ "syscall.SYS_POSIX_OPENPT": "syscall",
+ "syscall.SYS_POSIX_SPAWN": "syscall",
+ "syscall.SYS_PPOLL": "syscall",
+ "syscall.SYS_PRCTL": "syscall",
+ "syscall.SYS_PREAD": "syscall",
+ "syscall.SYS_PREAD64": "syscall",
+ "syscall.SYS_PREADV": "syscall",
+ "syscall.SYS_PREAD_NOCANCEL": "syscall",
+ "syscall.SYS_PRLIMIT64": "syscall",
+ "syscall.SYS_PROCESS_POLICY": "syscall",
+ "syscall.SYS_PROCESS_VM_READV": "syscall",
+ "syscall.SYS_PROCESS_VM_WRITEV": "syscall",
+ "syscall.SYS_PROC_INFO": "syscall",
+ "syscall.SYS_PROF": "syscall",
+ "syscall.SYS_PROFIL": "syscall",
+ "syscall.SYS_PSELECT": "syscall",
+ "syscall.SYS_PSELECT6": "syscall",
+ "syscall.SYS_PSET_ASSIGN": "syscall",
+ "syscall.SYS_PSET_CREATE": "syscall",
+ "syscall.SYS_PSET_DESTROY": "syscall",
+ "syscall.SYS_PSYNCH_CVBROAD": "syscall",
+ "syscall.SYS_PSYNCH_CVCLRPREPOST": "syscall",
+ "syscall.SYS_PSYNCH_CVSIGNAL": "syscall",
+ "syscall.SYS_PSYNCH_CVWAIT": "syscall",
+ "syscall.SYS_PSYNCH_MUTEXDROP": "syscall",
+ "syscall.SYS_PSYNCH_MUTEXWAIT": "syscall",
+ "syscall.SYS_PSYNCH_RW_DOWNGRADE": "syscall",
+ "syscall.SYS_PSYNCH_RW_LONGRDLOCK": "syscall",
+ "syscall.SYS_PSYNCH_RW_RDLOCK": "syscall",
+ "syscall.SYS_PSYNCH_RW_UNLOCK": "syscall",
+ "syscall.SYS_PSYNCH_RW_UNLOCK2": "syscall",
+ "syscall.SYS_PSYNCH_RW_UPGRADE": "syscall",
+ "syscall.SYS_PSYNCH_RW_WRLOCK": "syscall",
+ "syscall.SYS_PSYNCH_RW_YIELDWRLOCK": "syscall",
+ "syscall.SYS_PTRACE": "syscall",
+ "syscall.SYS_PUTPMSG": "syscall",
+ "syscall.SYS_PWRITE": "syscall",
+ "syscall.SYS_PWRITE64": "syscall",
+ "syscall.SYS_PWRITEV": "syscall",
+ "syscall.SYS_PWRITE_NOCANCEL": "syscall",
+ "syscall.SYS_QUERY_MODULE": "syscall",
+ "syscall.SYS_QUOTACTL": "syscall",
+ "syscall.SYS_RASCTL": "syscall",
+ "syscall.SYS_RCTL_ADD_RULE": "syscall",
+ "syscall.SYS_RCTL_GET_LIMITS": "syscall",
+ "syscall.SYS_RCTL_GET_RACCT": "syscall",
+ "syscall.SYS_RCTL_GET_RULES": "syscall",
+ "syscall.SYS_RCTL_REMOVE_RULE": "syscall",
+ "syscall.SYS_READ": "syscall",
+ "syscall.SYS_READAHEAD": "syscall",
+ "syscall.SYS_READDIR": "syscall",
+ "syscall.SYS_READLINK": "syscall",
+ "syscall.SYS_READLINKAT": "syscall",
+ "syscall.SYS_READV": "syscall",
+ "syscall.SYS_READV_NOCANCEL": "syscall",
+ "syscall.SYS_READ_NOCANCEL": "syscall",
+ "syscall.SYS_REBOOT": "syscall",
+ "syscall.SYS_RECV": "syscall",
+ "syscall.SYS_RECVFROM": "syscall",
+ "syscall.SYS_RECVFROM_NOCANCEL": "syscall",
+ "syscall.SYS_RECVMMSG": "syscall",
+ "syscall.SYS_RECVMSG": "syscall",
+ "syscall.SYS_RECVMSG_NOCANCEL": "syscall",
+ "syscall.SYS_REMAP_FILE_PAGES": "syscall",
+ "syscall.SYS_REMOVEXATTR": "syscall",
+ "syscall.SYS_RENAME": "syscall",
+ "syscall.SYS_RENAMEAT": "syscall",
+ "syscall.SYS_REQUEST_KEY": "syscall",
+ "syscall.SYS_RESTART_SYSCALL": "syscall",
+ "syscall.SYS_REVOKE": "syscall",
+ "syscall.SYS_RFORK": "syscall",
+ "syscall.SYS_RMDIR": "syscall",
+ "syscall.SYS_RTPRIO": "syscall",
+ "syscall.SYS_RTPRIO_THREAD": "syscall",
+ "syscall.SYS_RT_SIGACTION": "syscall",
+ "syscall.SYS_RT_SIGPENDING": "syscall",
+ "syscall.SYS_RT_SIGPROCMASK": "syscall",
+ "syscall.SYS_RT_SIGQUEUEINFO": "syscall",
+ "syscall.SYS_RT_SIGRETURN": "syscall",
+ "syscall.SYS_RT_SIGSUSPEND": "syscall",
+ "syscall.SYS_RT_SIGTIMEDWAIT": "syscall",
+ "syscall.SYS_RT_TGSIGQUEUEINFO": "syscall",
+ "syscall.SYS_SBRK": "syscall",
+ "syscall.SYS_SCHED_GETAFFINITY": "syscall",
+ "syscall.SYS_SCHED_GETPARAM": "syscall",
+ "syscall.SYS_SCHED_GETSCHEDULER": "syscall",
+ "syscall.SYS_SCHED_GET_PRIORITY_MAX": "syscall",
+ "syscall.SYS_SCHED_GET_PRIORITY_MIN": "syscall",
+ "syscall.SYS_SCHED_RR_GET_INTERVAL": "syscall",
+ "syscall.SYS_SCHED_SETAFFINITY": "syscall",
+ "syscall.SYS_SCHED_SETPARAM": "syscall",
+ "syscall.SYS_SCHED_SETSCHEDULER": "syscall",
+ "syscall.SYS_SCHED_YIELD": "syscall",
+ "syscall.SYS_SCTP_GENERIC_RECVMSG": "syscall",
+ "syscall.SYS_SCTP_GENERIC_SENDMSG": "syscall",
+ "syscall.SYS_SCTP_GENERIC_SENDMSG_IOV": "syscall",
+ "syscall.SYS_SCTP_PEELOFF": "syscall",
+ "syscall.SYS_SEARCHFS": "syscall",
+ "syscall.SYS_SECURITY": "syscall",
+ "syscall.SYS_SELECT": "syscall",
+ "syscall.SYS_SELECT_NOCANCEL": "syscall",
+ "syscall.SYS_SEMCONFIG": "syscall",
+ "syscall.SYS_SEMCTL": "syscall",
+ "syscall.SYS_SEMGET": "syscall",
+ "syscall.SYS_SEMOP": "syscall",
+ "syscall.SYS_SEMSYS": "syscall",
+ "syscall.SYS_SEMTIMEDOP": "syscall",
+ "syscall.SYS_SEM_CLOSE": "syscall",
+ "syscall.SYS_SEM_DESTROY": "syscall",
+ "syscall.SYS_SEM_GETVALUE": "syscall",
+ "syscall.SYS_SEM_INIT": "syscall",
+ "syscall.SYS_SEM_OPEN": "syscall",
+ "syscall.SYS_SEM_POST": "syscall",
+ "syscall.SYS_SEM_TRYWAIT": "syscall",
+ "syscall.SYS_SEM_UNLINK": "syscall",
+ "syscall.SYS_SEM_WAIT": "syscall",
+ "syscall.SYS_SEM_WAIT_NOCANCEL": "syscall",
+ "syscall.SYS_SEND": "syscall",
+ "syscall.SYS_SENDFILE": "syscall",
+ "syscall.SYS_SENDFILE64": "syscall",
+ "syscall.SYS_SENDMMSG": "syscall",
+ "syscall.SYS_SENDMSG": "syscall",
+ "syscall.SYS_SENDMSG_NOCANCEL": "syscall",
+ "syscall.SYS_SENDTO": "syscall",
+ "syscall.SYS_SENDTO_NOCANCEL": "syscall",
+ "syscall.SYS_SETATTRLIST": "syscall",
+ "syscall.SYS_SETAUDIT": "syscall",
+ "syscall.SYS_SETAUDIT_ADDR": "syscall",
+ "syscall.SYS_SETAUID": "syscall",
+ "syscall.SYS_SETCONTEXT": "syscall",
+ "syscall.SYS_SETDOMAINNAME": "syscall",
+ "syscall.SYS_SETEGID": "syscall",
+ "syscall.SYS_SETEUID": "syscall",
+ "syscall.SYS_SETFIB": "syscall",
+ "syscall.SYS_SETFSGID": "syscall",
+ "syscall.SYS_SETFSGID32": "syscall",
+ "syscall.SYS_SETFSUID": "syscall",
+ "syscall.SYS_SETFSUID32": "syscall",
+ "syscall.SYS_SETGID": "syscall",
+ "syscall.SYS_SETGID32": "syscall",
+ "syscall.SYS_SETGROUPS": "syscall",
+ "syscall.SYS_SETGROUPS32": "syscall",
+ "syscall.SYS_SETHOSTNAME": "syscall",
+ "syscall.SYS_SETITIMER": "syscall",
+ "syscall.SYS_SETLCID": "syscall",
+ "syscall.SYS_SETLOGIN": "syscall",
+ "syscall.SYS_SETLOGINCLASS": "syscall",
+ "syscall.SYS_SETNS": "syscall",
+ "syscall.SYS_SETPGID": "syscall",
+ "syscall.SYS_SETPRIORITY": "syscall",
+ "syscall.SYS_SETPRIVEXEC": "syscall",
+ "syscall.SYS_SETREGID": "syscall",
+ "syscall.SYS_SETREGID32": "syscall",
+ "syscall.SYS_SETRESGID": "syscall",
+ "syscall.SYS_SETRESGID32": "syscall",
+ "syscall.SYS_SETRESUID": "syscall",
+ "syscall.SYS_SETRESUID32": "syscall",
+ "syscall.SYS_SETREUID": "syscall",
+ "syscall.SYS_SETREUID32": "syscall",
+ "syscall.SYS_SETRLIMIT": "syscall",
+ "syscall.SYS_SETRTABLE": "syscall",
+ "syscall.SYS_SETSGROUPS": "syscall",
+ "syscall.SYS_SETSID": "syscall",
+ "syscall.SYS_SETSOCKOPT": "syscall",
+ "syscall.SYS_SETTID": "syscall",
+ "syscall.SYS_SETTID_WITH_PID": "syscall",
+ "syscall.SYS_SETTIMEOFDAY": "syscall",
+ "syscall.SYS_SETUID": "syscall",
+ "syscall.SYS_SETUID32": "syscall",
+ "syscall.SYS_SETWGROUPS": "syscall",
+ "syscall.SYS_SETXATTR": "syscall",
+ "syscall.SYS_SET_MEMPOLICY": "syscall",
+ "syscall.SYS_SET_ROBUST_LIST": "syscall",
+ "syscall.SYS_SET_THREAD_AREA": "syscall",
+ "syscall.SYS_SET_TID_ADDRESS": "syscall",
+ "syscall.SYS_SGETMASK": "syscall",
+ "syscall.SYS_SHARED_REGION_CHECK_NP": "syscall",
+ "syscall.SYS_SHARED_REGION_MAP_AND_SLIDE_NP": "syscall",
+ "syscall.SYS_SHMAT": "syscall",
+ "syscall.SYS_SHMCTL": "syscall",
+ "syscall.SYS_SHMDT": "syscall",
+ "syscall.SYS_SHMGET": "syscall",
+ "syscall.SYS_SHMSYS": "syscall",
+ "syscall.SYS_SHM_OPEN": "syscall",
+ "syscall.SYS_SHM_UNLINK": "syscall",
+ "syscall.SYS_SHUTDOWN": "syscall",
+ "syscall.SYS_SIGACTION": "syscall",
+ "syscall.SYS_SIGALTSTACK": "syscall",
+ "syscall.SYS_SIGNAL": "syscall",
+ "syscall.SYS_SIGNALFD": "syscall",
+ "syscall.SYS_SIGNALFD4": "syscall",
+ "syscall.SYS_SIGPENDING": "syscall",
+ "syscall.SYS_SIGPROCMASK": "syscall",
+ "syscall.SYS_SIGQUEUE": "syscall",
+ "syscall.SYS_SIGQUEUEINFO": "syscall",
+ "syscall.SYS_SIGRETURN": "syscall",
+ "syscall.SYS_SIGSUSPEND": "syscall",
+ "syscall.SYS_SIGSUSPEND_NOCANCEL": "syscall",
+ "syscall.SYS_SIGTIMEDWAIT": "syscall",
+ "syscall.SYS_SIGWAIT": "syscall",
+ "syscall.SYS_SIGWAITINFO": "syscall",
+ "syscall.SYS_SOCKET": "syscall",
+ "syscall.SYS_SOCKETCALL": "syscall",
+ "syscall.SYS_SOCKETPAIR": "syscall",
+ "syscall.SYS_SPLICE": "syscall",
+ "syscall.SYS_SSETMASK": "syscall",
+ "syscall.SYS_SSTK": "syscall",
+ "syscall.SYS_STACK_SNAPSHOT": "syscall",
+ "syscall.SYS_STAT": "syscall",
+ "syscall.SYS_STAT64": "syscall",
+ "syscall.SYS_STAT64_EXTENDED": "syscall",
+ "syscall.SYS_STATFS": "syscall",
+ "syscall.SYS_STATFS64": "syscall",
+ "syscall.SYS_STATV": "syscall",
+ "syscall.SYS_STATVFS1": "syscall",
+ "syscall.SYS_STAT_EXTENDED": "syscall",
+ "syscall.SYS_STIME": "syscall",
+ "syscall.SYS_STTY": "syscall",
+ "syscall.SYS_SWAPCONTEXT": "syscall",
+ "syscall.SYS_SWAPCTL": "syscall",
+ "syscall.SYS_SWAPOFF": "syscall",
+ "syscall.SYS_SWAPON": "syscall",
+ "syscall.SYS_SYMLINK": "syscall",
+ "syscall.SYS_SYMLINKAT": "syscall",
+ "syscall.SYS_SYNC": "syscall",
+ "syscall.SYS_SYNCFS": "syscall",
+ "syscall.SYS_SYNC_FILE_RANGE": "syscall",
+ "syscall.SYS_SYSARCH": "syscall",
+ "syscall.SYS_SYSCALL": "syscall",
+ "syscall.SYS_SYSCALL_BASE": "syscall",
+ "syscall.SYS_SYSFS": "syscall",
+ "syscall.SYS_SYSINFO": "syscall",
+ "syscall.SYS_SYSLOG": "syscall",
+ "syscall.SYS_TEE": "syscall",
+ "syscall.SYS_TGKILL": "syscall",
+ "syscall.SYS_THREAD_SELFID": "syscall",
+ "syscall.SYS_THR_CREATE": "syscall",
+ "syscall.SYS_THR_EXIT": "syscall",
+ "syscall.SYS_THR_KILL": "syscall",
+ "syscall.SYS_THR_KILL2": "syscall",
+ "syscall.SYS_THR_NEW": "syscall",
+ "syscall.SYS_THR_SELF": "syscall",
+ "syscall.SYS_THR_SET_NAME": "syscall",
+ "syscall.SYS_THR_SUSPEND": "syscall",
+ "syscall.SYS_THR_WAKE": "syscall",
+ "syscall.SYS_TIME": "syscall",
+ "syscall.SYS_TIMERFD_CREATE": "syscall",
+ "syscall.SYS_TIMERFD_GETTIME": "syscall",
+ "syscall.SYS_TIMERFD_SETTIME": "syscall",
+ "syscall.SYS_TIMER_CREATE": "syscall",
+ "syscall.SYS_TIMER_DELETE": "syscall",
+ "syscall.SYS_TIMER_GETOVERRUN": "syscall",
+ "syscall.SYS_TIMER_GETTIME": "syscall",
+ "syscall.SYS_TIMER_SETTIME": "syscall",
+ "syscall.SYS_TIMES": "syscall",
+ "syscall.SYS_TKILL": "syscall",
+ "syscall.SYS_TRUNCATE": "syscall",
+ "syscall.SYS_TRUNCATE64": "syscall",
+ "syscall.SYS_TUXCALL": "syscall",
+ "syscall.SYS_UGETRLIMIT": "syscall",
+ "syscall.SYS_ULIMIT": "syscall",
+ "syscall.SYS_UMASK": "syscall",
+ "syscall.SYS_UMASK_EXTENDED": "syscall",
+ "syscall.SYS_UMOUNT": "syscall",
+ "syscall.SYS_UMOUNT2": "syscall",
+ "syscall.SYS_UNAME": "syscall",
+ "syscall.SYS_UNDELETE": "syscall",
+ "syscall.SYS_UNLINK": "syscall",
+ "syscall.SYS_UNLINKAT": "syscall",
+ "syscall.SYS_UNMOUNT": "syscall",
+ "syscall.SYS_UNSHARE": "syscall",
+ "syscall.SYS_USELIB": "syscall",
+ "syscall.SYS_USTAT": "syscall",
+ "syscall.SYS_UTIME": "syscall",
+ "syscall.SYS_UTIMENSAT": "syscall",
+ "syscall.SYS_UTIMES": "syscall",
+ "syscall.SYS_UTRACE": "syscall",
+ "syscall.SYS_UUIDGEN": "syscall",
+ "syscall.SYS_VADVISE": "syscall",
+ "syscall.SYS_VFORK": "syscall",
+ "syscall.SYS_VHANGUP": "syscall",
+ "syscall.SYS_VM86": "syscall",
+ "syscall.SYS_VM86OLD": "syscall",
+ "syscall.SYS_VMSPLICE": "syscall",
+ "syscall.SYS_VM_PRESSURE_MONITOR": "syscall",
+ "syscall.SYS_VSERVER": "syscall",
+ "syscall.SYS_WAIT4": "syscall",
+ "syscall.SYS_WAIT4_NOCANCEL": "syscall",
+ "syscall.SYS_WAIT6": "syscall",
+ "syscall.SYS_WAITEVENT": "syscall",
+ "syscall.SYS_WAITID": "syscall",
+ "syscall.SYS_WAITID_NOCANCEL": "syscall",
+ "syscall.SYS_WAITPID": "syscall",
+ "syscall.SYS_WATCHEVENT": "syscall",
+ "syscall.SYS_WORKQ_KERNRETURN": "syscall",
+ "syscall.SYS_WORKQ_OPEN": "syscall",
+ "syscall.SYS_WRITE": "syscall",
+ "syscall.SYS_WRITEV": "syscall",
+ "syscall.SYS_WRITEV_NOCANCEL": "syscall",
+ "syscall.SYS_WRITE_NOCANCEL": "syscall",
+ "syscall.SYS_YIELD": "syscall",
+ "syscall.SYS__LLSEEK": "syscall",
+ "syscall.SYS__LWP_CONTINUE": "syscall",
+ "syscall.SYS__LWP_CREATE": "syscall",
+ "syscall.SYS__LWP_CTL": "syscall",
+ "syscall.SYS__LWP_DETACH": "syscall",
+ "syscall.SYS__LWP_EXIT": "syscall",
+ "syscall.SYS__LWP_GETNAME": "syscall",
+ "syscall.SYS__LWP_GETPRIVATE": "syscall",
+ "syscall.SYS__LWP_KILL": "syscall",
+ "syscall.SYS__LWP_PARK": "syscall",
+ "syscall.SYS__LWP_SELF": "syscall",
+ "syscall.SYS__LWP_SETNAME": "syscall",
+ "syscall.SYS__LWP_SETPRIVATE": "syscall",
+ "syscall.SYS__LWP_SUSPEND": "syscall",
+ "syscall.SYS__LWP_UNPARK": "syscall",
+ "syscall.SYS__LWP_UNPARK_ALL": "syscall",
+ "syscall.SYS__LWP_WAIT": "syscall",
+ "syscall.SYS__LWP_WAKEUP": "syscall",
+ "syscall.SYS__NEWSELECT": "syscall",
+ "syscall.SYS__PSET_BIND": "syscall",
+ "syscall.SYS__SCHED_GETAFFINITY": "syscall",
+ "syscall.SYS__SCHED_GETPARAM": "syscall",
+ "syscall.SYS__SCHED_SETAFFINITY": "syscall",
+ "syscall.SYS__SCHED_SETPARAM": "syscall",
+ "syscall.SYS__SYSCTL": "syscall",
+ "syscall.SYS__UMTX_LOCK": "syscall",
+ "syscall.SYS__UMTX_OP": "syscall",
+ "syscall.SYS__UMTX_UNLOCK": "syscall",
+ "syscall.SYS___ACL_ACLCHECK_FD": "syscall",
+ "syscall.SYS___ACL_ACLCHECK_FILE": "syscall",
+ "syscall.SYS___ACL_ACLCHECK_LINK": "syscall",
+ "syscall.SYS___ACL_DELETE_FD": "syscall",
+ "syscall.SYS___ACL_DELETE_FILE": "syscall",
+ "syscall.SYS___ACL_DELETE_LINK": "syscall",
+ "syscall.SYS___ACL_GET_FD": "syscall",
+ "syscall.SYS___ACL_GET_FILE": "syscall",
+ "syscall.SYS___ACL_GET_LINK": "syscall",
+ "syscall.SYS___ACL_SET_FD": "syscall",
+ "syscall.SYS___ACL_SET_FILE": "syscall",
+ "syscall.SYS___ACL_SET_LINK": "syscall",
+ "syscall.SYS___CLONE": "syscall",
+ "syscall.SYS___DISABLE_THREADSIGNAL": "syscall",
+ "syscall.SYS___GETCWD": "syscall",
+ "syscall.SYS___GETLOGIN": "syscall",
+ "syscall.SYS___GET_TCB": "syscall",
+ "syscall.SYS___MAC_EXECVE": "syscall",
+ "syscall.SYS___MAC_GETFSSTAT": "syscall",
+ "syscall.SYS___MAC_GET_FD": "syscall",
+ "syscall.SYS___MAC_GET_FILE": "syscall",
+ "syscall.SYS___MAC_GET_LCID": "syscall",
+ "syscall.SYS___MAC_GET_LCTX": "syscall",
+ "syscall.SYS___MAC_GET_LINK": "syscall",
+ "syscall.SYS___MAC_GET_MOUNT": "syscall",
+ "syscall.SYS___MAC_GET_PID": "syscall",
+ "syscall.SYS___MAC_GET_PROC": "syscall",
+ "syscall.SYS___MAC_MOUNT": "syscall",
+ "syscall.SYS___MAC_SET_FD": "syscall",
+ "syscall.SYS___MAC_SET_FILE": "syscall",
+ "syscall.SYS___MAC_SET_LCTX": "syscall",
+ "syscall.SYS___MAC_SET_LINK": "syscall",
+ "syscall.SYS___MAC_SET_PROC": "syscall",
+ "syscall.SYS___MAC_SYSCALL": "syscall",
+ "syscall.SYS___OLD_SEMWAIT_SIGNAL": "syscall",
+ "syscall.SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL": "syscall",
+ "syscall.SYS___POSIX_CHOWN": "syscall",
+ "syscall.SYS___POSIX_FCHOWN": "syscall",
+ "syscall.SYS___POSIX_LCHOWN": "syscall",
+ "syscall.SYS___POSIX_RENAME": "syscall",
+ "syscall.SYS___PTHREAD_CANCELED": "syscall",
+ "syscall.SYS___PTHREAD_CHDIR": "syscall",
+ "syscall.SYS___PTHREAD_FCHDIR": "syscall",
+ "syscall.SYS___PTHREAD_KILL": "syscall",
+ "syscall.SYS___PTHREAD_MARKCANCEL": "syscall",
+ "syscall.SYS___PTHREAD_SIGMASK": "syscall",
+ "syscall.SYS___QUOTACTL": "syscall",
+ "syscall.SYS___SEMCTL": "syscall",
+ "syscall.SYS___SEMWAIT_SIGNAL": "syscall",
+ "syscall.SYS___SEMWAIT_SIGNAL_NOCANCEL": "syscall",
+ "syscall.SYS___SETLOGIN": "syscall",
+ "syscall.SYS___SETUGID": "syscall",
+ "syscall.SYS___SET_TCB": "syscall",
+ "syscall.SYS___SIGACTION_SIGTRAMP": "syscall",
+ "syscall.SYS___SIGTIMEDWAIT": "syscall",
+ "syscall.SYS___SIGWAIT": "syscall",
+ "syscall.SYS___SIGWAIT_NOCANCEL": "syscall",
+ "syscall.SYS___SYSCTL": "syscall",
+ "syscall.SYS___TFORK": "syscall",
+ "syscall.SYS___THREXIT": "syscall",
+ "syscall.SYS___THRSIGDIVERT": "syscall",
+ "syscall.SYS___THRSLEEP": "syscall",
+ "syscall.SYS___THRWAKEUP": "syscall",
+ "syscall.S_ARCH1": "syscall",
+ "syscall.S_ARCH2": "syscall",
+ "syscall.S_BLKSIZE": "syscall",
+ "syscall.S_IEXEC": "syscall",
+ "syscall.S_IFBLK": "syscall",
+ "syscall.S_IFCHR": "syscall",
+ "syscall.S_IFDIR": "syscall",
+ "syscall.S_IFIFO": "syscall",
+ "syscall.S_IFLNK": "syscall",
+ "syscall.S_IFMT": "syscall",
+ "syscall.S_IFREG": "syscall",
+ "syscall.S_IFSOCK": "syscall",
+ "syscall.S_IFWHT": "syscall",
+ "syscall.S_IREAD": "syscall",
+ "syscall.S_IRGRP": "syscall",
+ "syscall.S_IROTH": "syscall",
+ "syscall.S_IRUSR": "syscall",
+ "syscall.S_IRWXG": "syscall",
+ "syscall.S_IRWXO": "syscall",
+ "syscall.S_IRWXU": "syscall",
+ "syscall.S_ISGID": "syscall",
+ "syscall.S_ISTXT": "syscall",
+ "syscall.S_ISUID": "syscall",
+ "syscall.S_ISVTX": "syscall",
+ "syscall.S_IWGRP": "syscall",
+ "syscall.S_IWOTH": "syscall",
+ "syscall.S_IWRITE": "syscall",
+ "syscall.S_IWUSR": "syscall",
+ "syscall.S_IXGRP": "syscall",
+ "syscall.S_IXOTH": "syscall",
+ "syscall.S_IXUSR": "syscall",
+ "syscall.S_LOGIN_SET": "syscall",
+ "syscall.SecurityAttributes": "syscall",
+ "syscall.Seek": "syscall",
+ "syscall.Select": "syscall",
+ "syscall.Sendfile": "syscall",
+ "syscall.Sendmsg": "syscall",
+ "syscall.Sendto": "syscall",
+ "syscall.Servent": "syscall",
+ "syscall.SetBpf": "syscall",
+ "syscall.SetBpfBuflen": "syscall",
+ "syscall.SetBpfDatalink": "syscall",
+ "syscall.SetBpfHeadercmpl": "syscall",
+ "syscall.SetBpfImmediate": "syscall",
+ "syscall.SetBpfInterface": "syscall",
+ "syscall.SetBpfPromisc": "syscall",
+ "syscall.SetBpfTimeout": "syscall",
+ "syscall.SetCurrentDirectory": "syscall",
+ "syscall.SetEndOfFile": "syscall",
+ "syscall.SetEnvironmentVariable": "syscall",
+ "syscall.SetFileAttributes": "syscall",
+ "syscall.SetFileCompletionNotificationModes": "syscall",
+ "syscall.SetFilePointer": "syscall",
+ "syscall.SetFileTime": "syscall",
+ "syscall.SetHandleInformation": "syscall",
+ "syscall.SetKevent": "syscall",
+ "syscall.SetLsfPromisc": "syscall",
+ "syscall.SetNonblock": "syscall",
+ "syscall.Setdomainname": "syscall",
+ "syscall.Setegid": "syscall",
+ "syscall.Setenv": "syscall",
+ "syscall.Seteuid": "syscall",
+ "syscall.Setfsgid": "syscall",
+ "syscall.Setfsuid": "syscall",
+ "syscall.Setgid": "syscall",
+ "syscall.Setgroups": "syscall",
+ "syscall.Sethostname": "syscall",
+ "syscall.Setlogin": "syscall",
+ "syscall.Setpgid": "syscall",
+ "syscall.Setpriority": "syscall",
+ "syscall.Setprivexec": "syscall",
+ "syscall.Setregid": "syscall",
+ "syscall.Setresgid": "syscall",
+ "syscall.Setresuid": "syscall",
+ "syscall.Setreuid": "syscall",
+ "syscall.Setrlimit": "syscall",
+ "syscall.Setsid": "syscall",
+ "syscall.Setsockopt": "syscall",
+ "syscall.SetsockoptByte": "syscall",
+ "syscall.SetsockoptICMPv6Filter": "syscall",
+ "syscall.SetsockoptIPMreq": "syscall",
+ "syscall.SetsockoptIPMreqn": "syscall",
+ "syscall.SetsockoptIPv6Mreq": "syscall",
+ "syscall.SetsockoptInet4Addr": "syscall",
+ "syscall.SetsockoptInt": "syscall",
+ "syscall.SetsockoptLinger": "syscall",
+ "syscall.SetsockoptString": "syscall",
+ "syscall.SetsockoptTimeval": "syscall",
+ "syscall.Settimeofday": "syscall",
+ "syscall.Setuid": "syscall",
+ "syscall.Setxattr": "syscall",
+ "syscall.Shutdown": "syscall",
+ "syscall.SidTypeAlias": "syscall",
+ "syscall.SidTypeComputer": "syscall",
+ "syscall.SidTypeDeletedAccount": "syscall",
+ "syscall.SidTypeDomain": "syscall",
+ "syscall.SidTypeGroup": "syscall",
+ "syscall.SidTypeInvalid": "syscall",
+ "syscall.SidTypeLabel": "syscall",
+ "syscall.SidTypeUnknown": "syscall",
+ "syscall.SidTypeUser": "syscall",
+ "syscall.SidTypeWellKnownGroup": "syscall",
+ "syscall.Signal": "syscall",
+ "syscall.SizeofBpfHdr": "syscall",
+ "syscall.SizeofBpfInsn": "syscall",
+ "syscall.SizeofBpfProgram": "syscall",
+ "syscall.SizeofBpfStat": "syscall",
+ "syscall.SizeofBpfVersion": "syscall",
+ "syscall.SizeofBpfZbuf": "syscall",
+ "syscall.SizeofBpfZbufHeader": "syscall",
+ "syscall.SizeofCmsghdr": "syscall",
+ "syscall.SizeofICMPv6Filter": "syscall",
+ "syscall.SizeofIPMreq": "syscall",
+ "syscall.SizeofIPMreqn": "syscall",
+ "syscall.SizeofIPv6MTUInfo": "syscall",
+ "syscall.SizeofIPv6Mreq": "syscall",
+ "syscall.SizeofIfAddrmsg": "syscall",
+ "syscall.SizeofIfAnnounceMsghdr": "syscall",
+ "syscall.SizeofIfData": "syscall",
+ "syscall.SizeofIfInfomsg": "syscall",
+ "syscall.SizeofIfMsghdr": "syscall",
+ "syscall.SizeofIfaMsghdr": "syscall",
+ "syscall.SizeofIfmaMsghdr": "syscall",
+ "syscall.SizeofIfmaMsghdr2": "syscall",
+ "syscall.SizeofInet4Pktinfo": "syscall",
+ "syscall.SizeofInet6Pktinfo": "syscall",
+ "syscall.SizeofInotifyEvent": "syscall",
+ "syscall.SizeofLinger": "syscall",
+ "syscall.SizeofMsghdr": "syscall",
+ "syscall.SizeofNlAttr": "syscall",
+ "syscall.SizeofNlMsgerr": "syscall",
+ "syscall.SizeofNlMsghdr": "syscall",
+ "syscall.SizeofRtAttr": "syscall",
+ "syscall.SizeofRtGenmsg": "syscall",
+ "syscall.SizeofRtMetrics": "syscall",
+ "syscall.SizeofRtMsg": "syscall",
+ "syscall.SizeofRtMsghdr": "syscall",
+ "syscall.SizeofRtNexthop": "syscall",
+ "syscall.SizeofSockFilter": "syscall",
+ "syscall.SizeofSockFprog": "syscall",
+ "syscall.SizeofSockaddrAny": "syscall",
+ "syscall.SizeofSockaddrDatalink": "syscall",
+ "syscall.SizeofSockaddrInet4": "syscall",
+ "syscall.SizeofSockaddrInet6": "syscall",
+ "syscall.SizeofSockaddrLinklayer": "syscall",
+ "syscall.SizeofSockaddrNetlink": "syscall",
+ "syscall.SizeofSockaddrUnix": "syscall",
+ "syscall.SizeofTCPInfo": "syscall",
+ "syscall.SizeofUcred": "syscall",
+ "syscall.SlicePtrFromStrings": "syscall",
+ "syscall.SockFilter": "syscall",
+ "syscall.SockFprog": "syscall",
+ "syscall.SockaddrDatalink": "syscall",
+ "syscall.SockaddrGen": "syscall",
+ "syscall.SockaddrInet4": "syscall",
+ "syscall.SockaddrInet6": "syscall",
+ "syscall.SockaddrLinklayer": "syscall",
+ "syscall.SockaddrNetlink": "syscall",
+ "syscall.SockaddrUnix": "syscall",
+ "syscall.Socket": "syscall",
+ "syscall.SocketControlMessage": "syscall",
+ "syscall.SocketDisableIPv6": "syscall",
+ "syscall.Socketpair": "syscall",
+ "syscall.Splice": "syscall",
+ "syscall.StartProcess": "syscall",
+ "syscall.StartupInfo": "syscall",
+ "syscall.Stat": "syscall",
+ "syscall.Stat_t": "syscall",
+ "syscall.Statfs": "syscall",
+ "syscall.Statfs_t": "syscall",
+ "syscall.Stderr": "syscall",
+ "syscall.Stdin": "syscall",
+ "syscall.Stdout": "syscall",
+ "syscall.StringBytePtr": "syscall",
+ "syscall.StringByteSlice": "syscall",
+ "syscall.StringSlicePtr": "syscall",
+ "syscall.StringToSid": "syscall",
+ "syscall.StringToUTF16": "syscall",
+ "syscall.StringToUTF16Ptr": "syscall",
+ "syscall.Symlink": "syscall",
+ "syscall.Sync": "syscall",
+ "syscall.SyncFileRange": "syscall",
+ "syscall.SysProcAttr": "syscall",
+ "syscall.Syscall": "syscall",
+ "syscall.Syscall12": "syscall",
+ "syscall.Syscall15": "syscall",
+ "syscall.Syscall6": "syscall",
+ "syscall.Syscall9": "syscall",
+ "syscall.Sysctl": "syscall",
+ "syscall.SysctlUint32": "syscall",
+ "syscall.Sysctlnode": "syscall",
+ "syscall.Sysinfo": "syscall",
+ "syscall.Sysinfo_t": "syscall",
+ "syscall.Systemtime": "syscall",
+ "syscall.TCGETS": "syscall",
+ "syscall.TCIFLUSH": "syscall",
+ "syscall.TCIOFLUSH": "syscall",
+ "syscall.TCOFLUSH": "syscall",
+ "syscall.TCPInfo": "syscall",
+ "syscall.TCP_CA_NAME_MAX": "syscall",
+ "syscall.TCP_CONGCTL": "syscall",
+ "syscall.TCP_CONGESTION": "syscall",
+ "syscall.TCP_CONNECTIONTIMEOUT": "syscall",
+ "syscall.TCP_CORK": "syscall",
+ "syscall.TCP_DEFER_ACCEPT": "syscall",
+ "syscall.TCP_INFO": "syscall",
+ "syscall.TCP_KEEPALIVE": "syscall",
+ "syscall.TCP_KEEPCNT": "syscall",
+ "syscall.TCP_KEEPIDLE": "syscall",
+ "syscall.TCP_KEEPINIT": "syscall",
+ "syscall.TCP_KEEPINTVL": "syscall",
+ "syscall.TCP_LINGER2": "syscall",
+ "syscall.TCP_MAXBURST": "syscall",
+ "syscall.TCP_MAXHLEN": "syscall",
+ "syscall.TCP_MAXOLEN": "syscall",
+ "syscall.TCP_MAXSEG": "syscall",
+ "syscall.TCP_MAXWIN": "syscall",
+ "syscall.TCP_MAX_SACK": "syscall",
+ "syscall.TCP_MAX_WINSHIFT": "syscall",
+ "syscall.TCP_MD5SIG": "syscall",
+ "syscall.TCP_MD5SIG_MAXKEYLEN": "syscall",
+ "syscall.TCP_MINMSS": "syscall",
+ "syscall.TCP_MINMSSOVERLOAD": "syscall",
+ "syscall.TCP_MSS": "syscall",
+ "syscall.TCP_NODELAY": "syscall",
+ "syscall.TCP_NOOPT": "syscall",
+ "syscall.TCP_NOPUSH": "syscall",
+ "syscall.TCP_NSTATES": "syscall",
+ "syscall.TCP_QUICKACK": "syscall",
+ "syscall.TCP_RXT_CONNDROPTIME": "syscall",
+ "syscall.TCP_RXT_FINDROP": "syscall",
+ "syscall.TCP_SACK_ENABLE": "syscall",
+ "syscall.TCP_SYNCNT": "syscall",
+ "syscall.TCP_WINDOW_CLAMP": "syscall",
+ "syscall.TCSAFLUSH": "syscall",
+ "syscall.TCSETS": "syscall",
+ "syscall.TF_DISCONNECT": "syscall",
+ "syscall.TF_REUSE_SOCKET": "syscall",
+ "syscall.TF_USE_DEFAULT_WORKER": "syscall",
+ "syscall.TF_USE_KERNEL_APC": "syscall",
+ "syscall.TF_USE_SYSTEM_THREAD": "syscall",
+ "syscall.TF_WRITE_BEHIND": "syscall",
+ "syscall.TIME_ZONE_ID_DAYLIGHT": "syscall",
+ "syscall.TIME_ZONE_ID_STANDARD": "syscall",
+ "syscall.TIME_ZONE_ID_UNKNOWN": "syscall",
+ "syscall.TIOCCBRK": "syscall",
+ "syscall.TIOCCDTR": "syscall",
+ "syscall.TIOCCONS": "syscall",
+ "syscall.TIOCDCDTIMESTAMP": "syscall",
+ "syscall.TIOCDRAIN": "syscall",
+ "syscall.TIOCDSIMICROCODE": "syscall",
+ "syscall.TIOCEXCL": "syscall",
+ "syscall.TIOCEXT": "syscall",
+ "syscall.TIOCFLAG_CDTRCTS": "syscall",
+ "syscall.TIOCFLAG_CLOCAL": "syscall",
+ "syscall.TIOCFLAG_CRTSCTS": "syscall",
+ "syscall.TIOCFLAG_MDMBUF": "syscall",
+ "syscall.TIOCFLAG_PPS": "syscall",
+ "syscall.TIOCFLAG_SOFTCAR": "syscall",
+ "syscall.TIOCFLUSH": "syscall",
+ "syscall.TIOCGDEV": "syscall",
+ "syscall.TIOCGDRAINWAIT": "syscall",
+ "syscall.TIOCGETA": "syscall",
+ "syscall.TIOCGETD": "syscall",
+ "syscall.TIOCGFLAGS": "syscall",
+ "syscall.TIOCGICOUNT": "syscall",
+ "syscall.TIOCGLCKTRMIOS": "syscall",
+ "syscall.TIOCGLINED": "syscall",
+ "syscall.TIOCGPGRP": "syscall",
+ "syscall.TIOCGPTN": "syscall",
+ "syscall.TIOCGQSIZE": "syscall",
+ "syscall.TIOCGRANTPT": "syscall",
+ "syscall.TIOCGRS485": "syscall",
+ "syscall.TIOCGSERIAL": "syscall",
+ "syscall.TIOCGSID": "syscall",
+ "syscall.TIOCGSIZE": "syscall",
+ "syscall.TIOCGSOFTCAR": "syscall",
+ "syscall.TIOCGTSTAMP": "syscall",
+ "syscall.TIOCGWINSZ": "syscall",
+ "syscall.TIOCINQ": "syscall",
+ "syscall.TIOCIXOFF": "syscall",
+ "syscall.TIOCIXON": "syscall",
+ "syscall.TIOCLINUX": "syscall",
+ "syscall.TIOCMBIC": "syscall",
+ "syscall.TIOCMBIS": "syscall",
+ "syscall.TIOCMGDTRWAIT": "syscall",
+ "syscall.TIOCMGET": "syscall",
+ "syscall.TIOCMIWAIT": "syscall",
+ "syscall.TIOCMODG": "syscall",
+ "syscall.TIOCMODS": "syscall",
+ "syscall.TIOCMSDTRWAIT": "syscall",
+ "syscall.TIOCMSET": "syscall",
+ "syscall.TIOCM_CAR": "syscall",
+ "syscall.TIOCM_CD": "syscall",
+ "syscall.TIOCM_CTS": "syscall",
+ "syscall.TIOCM_DCD": "syscall",
+ "syscall.TIOCM_DSR": "syscall",
+ "syscall.TIOCM_DTR": "syscall",
+ "syscall.TIOCM_LE": "syscall",
+ "syscall.TIOCM_RI": "syscall",
+ "syscall.TIOCM_RNG": "syscall",
+ "syscall.TIOCM_RTS": "syscall",
+ "syscall.TIOCM_SR": "syscall",
+ "syscall.TIOCM_ST": "syscall",
+ "syscall.TIOCNOTTY": "syscall",
+ "syscall.TIOCNXCL": "syscall",
+ "syscall.TIOCOUTQ": "syscall",
+ "syscall.TIOCPKT": "syscall",
+ "syscall.TIOCPKT_DATA": "syscall",
+ "syscall.TIOCPKT_DOSTOP": "syscall",
+ "syscall.TIOCPKT_FLUSHREAD": "syscall",
+ "syscall.TIOCPKT_FLUSHWRITE": "syscall",
+ "syscall.TIOCPKT_IOCTL": "syscall",
+ "syscall.TIOCPKT_NOSTOP": "syscall",
+ "syscall.TIOCPKT_START": "syscall",
+ "syscall.TIOCPKT_STOP": "syscall",
+ "syscall.TIOCPTMASTER": "syscall",
+ "syscall.TIOCPTMGET": "syscall",
+ "syscall.TIOCPTSNAME": "syscall",
+ "syscall.TIOCPTYGNAME": "syscall",
+ "syscall.TIOCPTYGRANT": "syscall",
+ "syscall.TIOCPTYUNLK": "syscall",
+ "syscall.TIOCRCVFRAME": "syscall",
+ "syscall.TIOCREMOTE": "syscall",
+ "syscall.TIOCSBRK": "syscall",
+ "syscall.TIOCSCONS": "syscall",
+ "syscall.TIOCSCTTY": "syscall",
+ "syscall.TIOCSDRAINWAIT": "syscall",
+ "syscall.TIOCSDTR": "syscall",
+ "syscall.TIOCSERCONFIG": "syscall",
+ "syscall.TIOCSERGETLSR": "syscall",
+ "syscall.TIOCSERGETMULTI": "syscall",
+ "syscall.TIOCSERGSTRUCT": "syscall",
+ "syscall.TIOCSERGWILD": "syscall",
+ "syscall.TIOCSERSETMULTI": "syscall",
+ "syscall.TIOCSERSWILD": "syscall",
+ "syscall.TIOCSER_TEMT": "syscall",
+ "syscall.TIOCSETA": "syscall",
+ "syscall.TIOCSETAF": "syscall",
+ "syscall.TIOCSETAW": "syscall",
+ "syscall.TIOCSETD": "syscall",
+ "syscall.TIOCSFLAGS": "syscall",
+ "syscall.TIOCSIG": "syscall",
+ "syscall.TIOCSLCKTRMIOS": "syscall",
+ "syscall.TIOCSLINED": "syscall",
+ "syscall.TIOCSPGRP": "syscall",
+ "syscall.TIOCSPTLCK": "syscall",
+ "syscall.TIOCSQSIZE": "syscall",
+ "syscall.TIOCSRS485": "syscall",
+ "syscall.TIOCSSERIAL": "syscall",
+ "syscall.TIOCSSIZE": "syscall",
+ "syscall.TIOCSSOFTCAR": "syscall",
+ "syscall.TIOCSTART": "syscall",
+ "syscall.TIOCSTAT": "syscall",
+ "syscall.TIOCSTI": "syscall",
+ "syscall.TIOCSTOP": "syscall",
+ "syscall.TIOCSTSTAMP": "syscall",
+ "syscall.TIOCSWINSZ": "syscall",
+ "syscall.TIOCTIMESTAMP": "syscall",
+ "syscall.TIOCUCNTL": "syscall",
+ "syscall.TIOCVHANGUP": "syscall",
+ "syscall.TIOCXMTFRAME": "syscall",
+ "syscall.TOKEN_ADJUST_DEFAULT": "syscall",
+ "syscall.TOKEN_ADJUST_GROUPS": "syscall",
+ "syscall.TOKEN_ADJUST_PRIVILEGES": "syscall",
+ "syscall.TOKEN_ALL_ACCESS": "syscall",
+ "syscall.TOKEN_ASSIGN_PRIMARY": "syscall",
+ "syscall.TOKEN_DUPLICATE": "syscall",
+ "syscall.TOKEN_EXECUTE": "syscall",
+ "syscall.TOKEN_IMPERSONATE": "syscall",
+ "syscall.TOKEN_QUERY": "syscall",
+ "syscall.TOKEN_QUERY_SOURCE": "syscall",
+ "syscall.TOKEN_READ": "syscall",
+ "syscall.TOKEN_WRITE": "syscall",
+ "syscall.TOSTOP": "syscall",
+ "syscall.TRUNCATE_EXISTING": "syscall",
+ "syscall.TUNATTACHFILTER": "syscall",
+ "syscall.TUNDETACHFILTER": "syscall",
+ "syscall.TUNGETFEATURES": "syscall",
+ "syscall.TUNGETIFF": "syscall",
+ "syscall.TUNGETSNDBUF": "syscall",
+ "syscall.TUNGETVNETHDRSZ": "syscall",
+ "syscall.TUNSETDEBUG": "syscall",
+ "syscall.TUNSETGROUP": "syscall",
+ "syscall.TUNSETIFF": "syscall",
+ "syscall.TUNSETLINK": "syscall",
+ "syscall.TUNSETNOCSUM": "syscall",
+ "syscall.TUNSETOFFLOAD": "syscall",
+ "syscall.TUNSETOWNER": "syscall",
+ "syscall.TUNSETPERSIST": "syscall",
+ "syscall.TUNSETSNDBUF": "syscall",
+ "syscall.TUNSETTXFILTER": "syscall",
+ "syscall.TUNSETVNETHDRSZ": "syscall",
+ "syscall.Tee": "syscall",
+ "syscall.TerminateProcess": "syscall",
+ "syscall.Termios": "syscall",
+ "syscall.Tgkill": "syscall",
+ "syscall.Time": "syscall",
+ "syscall.Time_t": "syscall",
+ "syscall.Times": "syscall",
+ "syscall.Timespec": "syscall",
+ "syscall.TimespecToNsec": "syscall",
+ "syscall.Timeval": "syscall",
+ "syscall.Timeval32": "syscall",
+ "syscall.TimevalToNsec": "syscall",
+ "syscall.Timex": "syscall",
+ "syscall.Timezoneinformation": "syscall",
+ "syscall.Tms": "syscall",
+ "syscall.Token": "syscall",
+ "syscall.TokenAccessInformation": "syscall",
+ "syscall.TokenAuditPolicy": "syscall",
+ "syscall.TokenDefaultDacl": "syscall",
+ "syscall.TokenElevation": "syscall",
+ "syscall.TokenElevationType": "syscall",
+ "syscall.TokenGroups": "syscall",
+ "syscall.TokenGroupsAndPrivileges": "syscall",
+ "syscall.TokenHasRestrictions": "syscall",
+ "syscall.TokenImpersonationLevel": "syscall",
+ "syscall.TokenIntegrityLevel": "syscall",
+ "syscall.TokenLinkedToken": "syscall",
+ "syscall.TokenLogonSid": "syscall",
+ "syscall.TokenMandatoryPolicy": "syscall",
+ "syscall.TokenOrigin": "syscall",
+ "syscall.TokenOwner": "syscall",
+ "syscall.TokenPrimaryGroup": "syscall",
+ "syscall.TokenPrivileges": "syscall",
+ "syscall.TokenRestrictedSids": "syscall",
+ "syscall.TokenSandBoxInert": "syscall",
+ "syscall.TokenSessionId": "syscall",
+ "syscall.TokenSessionReference": "syscall",
+ "syscall.TokenSource": "syscall",
+ "syscall.TokenStatistics": "syscall",
+ "syscall.TokenType": "syscall",
+ "syscall.TokenUIAccess": "syscall",
+ "syscall.TokenUser": "syscall",
+ "syscall.TokenVirtualizationAllowed": "syscall",
+ "syscall.TokenVirtualizationEnabled": "syscall",
+ "syscall.Tokenprimarygroup": "syscall",
+ "syscall.Tokenuser": "syscall",
+ "syscall.TranslateAccountName": "syscall",
+ "syscall.TranslateName": "syscall",
+ "syscall.TransmitFile": "syscall",
+ "syscall.TransmitFileBuffers": "syscall",
+ "syscall.Truncate": "syscall",
+ "syscall.USAGE_MATCH_TYPE_AND": "syscall",
+ "syscall.USAGE_MATCH_TYPE_OR": "syscall",
+ "syscall.UTF16FromString": "syscall",
+ "syscall.UTF16PtrFromString": "syscall",
+ "syscall.UTF16ToString": "syscall",
+ "syscall.Ucred": "syscall",
+ "syscall.Umask": "syscall",
+ "syscall.Uname": "syscall",
+ "syscall.Undelete": "syscall",
+ "syscall.UnixCredentials": "syscall",
+ "syscall.UnixRights": "syscall",
+ "syscall.Unlink": "syscall",
+ "syscall.Unlinkat": "syscall",
+ "syscall.UnmapViewOfFile": "syscall",
+ "syscall.Unmount": "syscall",
+ "syscall.Unshare": "syscall",
+ "syscall.UserInfo10": "syscall",
+ "syscall.Ustat": "syscall",
+ "syscall.Ustat_t": "syscall",
+ "syscall.Utimbuf": "syscall",
+ "syscall.Utime": "syscall",
+ "syscall.Utimes": "syscall",
+ "syscall.UtimesNano": "syscall",
+ "syscall.Utsname": "syscall",
+ "syscall.VDISCARD": "syscall",
+ "syscall.VDSUSP": "syscall",
+ "syscall.VEOF": "syscall",
+ "syscall.VEOL": "syscall",
+ "syscall.VEOL2": "syscall",
+ "syscall.VERASE": "syscall",
+ "syscall.VERASE2": "syscall",
+ "syscall.VINTR": "syscall",
+ "syscall.VKILL": "syscall",
+ "syscall.VLNEXT": "syscall",
+ "syscall.VMIN": "syscall",
+ "syscall.VQUIT": "syscall",
+ "syscall.VREPRINT": "syscall",
+ "syscall.VSTART": "syscall",
+ "syscall.VSTATUS": "syscall",
+ "syscall.VSTOP": "syscall",
+ "syscall.VSUSP": "syscall",
+ "syscall.VSWTC": "syscall",
+ "syscall.VT0": "syscall",
+ "syscall.VT1": "syscall",
+ "syscall.VTDLY": "syscall",
+ "syscall.VTIME": "syscall",
+ "syscall.VWERASE": "syscall",
+ "syscall.VirtualLock": "syscall",
+ "syscall.VirtualUnlock": "syscall",
+ "syscall.WAIT_ABANDONED": "syscall",
+ "syscall.WAIT_FAILED": "syscall",
+ "syscall.WAIT_OBJECT_0": "syscall",
+ "syscall.WAIT_TIMEOUT": "syscall",
+ "syscall.WALL": "syscall",
+ "syscall.WALLSIG": "syscall",
+ "syscall.WALTSIG": "syscall",
+ "syscall.WCLONE": "syscall",
+ "syscall.WCONTINUED": "syscall",
+ "syscall.WCOREFLAG": "syscall",
+ "syscall.WEXITED": "syscall",
+ "syscall.WLINUXCLONE": "syscall",
+ "syscall.WNOHANG": "syscall",
+ "syscall.WNOTHREAD": "syscall",
+ "syscall.WNOWAIT": "syscall",
+ "syscall.WNOZOMBIE": "syscall",
+ "syscall.WOPTSCHECKED": "syscall",
+ "syscall.WORDSIZE": "syscall",
+ "syscall.WSABuf": "syscall",
+ "syscall.WSACleanup": "syscall",
+ "syscall.WSADESCRIPTION_LEN": "syscall",
+ "syscall.WSAData": "syscall",
+ "syscall.WSAEACCES": "syscall",
+ "syscall.WSAEnumProtocols": "syscall",
+ "syscall.WSAID_CONNECTEX": "syscall",
+ "syscall.WSAIoctl": "syscall",
+ "syscall.WSAPROTOCOL_LEN": "syscall",
+ "syscall.WSAProtocolChain": "syscall",
+ "syscall.WSAProtocolInfo": "syscall",
+ "syscall.WSARecv": "syscall",
+ "syscall.WSARecvFrom": "syscall",
+ "syscall.WSASYS_STATUS_LEN": "syscall",
+ "syscall.WSASend": "syscall",
+ "syscall.WSASendTo": "syscall",
+ "syscall.WSASendto": "syscall",
+ "syscall.WSAStartup": "syscall",
+ "syscall.WSTOPPED": "syscall",
+ "syscall.WTRAPPED": "syscall",
+ "syscall.WUNTRACED": "syscall",
+ "syscall.Wait4": "syscall",
+ "syscall.WaitForSingleObject": "syscall",
+ "syscall.WaitStatus": "syscall",
+ "syscall.Win32FileAttributeData": "syscall",
+ "syscall.Win32finddata": "syscall",
+ "syscall.Write": "syscall",
+ "syscall.WriteConsole": "syscall",
+ "syscall.WriteFile": "syscall",
+ "syscall.X509_ASN_ENCODING": "syscall",
+ "syscall.XCASE": "syscall",
+ "syscall.XP1_CONNECTIONLESS": "syscall",
+ "syscall.XP1_CONNECT_DATA": "syscall",
+ "syscall.XP1_DISCONNECT_DATA": "syscall",
+ "syscall.XP1_EXPEDITED_DATA": "syscall",
+ "syscall.XP1_GRACEFUL_CLOSE": "syscall",
+ "syscall.XP1_GUARANTEED_DELIVERY": "syscall",
+ "syscall.XP1_GUARANTEED_ORDER": "syscall",
+ "syscall.XP1_IFS_HANDLES": "syscall",
+ "syscall.XP1_MESSAGE_ORIENTED": "syscall",
+ "syscall.XP1_MULTIPOINT_CONTROL_PLANE": "syscall",
+ "syscall.XP1_MULTIPOINT_DATA_PLANE": "syscall",
+ "syscall.XP1_PARTIAL_MESSAGE": "syscall",
+ "syscall.XP1_PSEUDO_STREAM": "syscall",
+ "syscall.XP1_QOS_SUPPORTED": "syscall",
+ "syscall.XP1_SAN_SUPPORT_SDP": "syscall",
+ "syscall.XP1_SUPPORT_BROADCAST": "syscall",
+ "syscall.XP1_SUPPORT_MULTIPOINT": "syscall",
+ "syscall.XP1_UNI_RECV": "syscall",
+ "syscall.XP1_UNI_SEND": "syscall",
+ "syslog.Dial": "log/syslog",
+ "syslog.LOG_ALERT": "log/syslog",
+ "syslog.LOG_AUTH": "log/syslog",
+ "syslog.LOG_AUTHPRIV": "log/syslog",
+ "syslog.LOG_CRIT": "log/syslog",
+ "syslog.LOG_CRON": "log/syslog",
+ "syslog.LOG_DAEMON": "log/syslog",
+ "syslog.LOG_DEBUG": "log/syslog",
+ "syslog.LOG_EMERG": "log/syslog",
+ "syslog.LOG_ERR": "log/syslog",
+ "syslog.LOG_FTP": "log/syslog",
+ "syslog.LOG_INFO": "log/syslog",
+ "syslog.LOG_KERN": "log/syslog",
+ "syslog.LOG_LOCAL0": "log/syslog",
+ "syslog.LOG_LOCAL1": "log/syslog",
+ "syslog.LOG_LOCAL2": "log/syslog",
+ "syslog.LOG_LOCAL3": "log/syslog",
+ "syslog.LOG_LOCAL4": "log/syslog",
+ "syslog.LOG_LOCAL5": "log/syslog",
+ "syslog.LOG_LOCAL6": "log/syslog",
+ "syslog.LOG_LOCAL7": "log/syslog",
+ "syslog.LOG_LPR": "log/syslog",
+ "syslog.LOG_MAIL": "log/syslog",
+ "syslog.LOG_NEWS": "log/syslog",
+ "syslog.LOG_NOTICE": "log/syslog",
+ "syslog.LOG_SYSLOG": "log/syslog",
+ "syslog.LOG_USER": "log/syslog",
+ "syslog.LOG_UUCP": "log/syslog",
+ "syslog.LOG_WARNING": "log/syslog",
+ "syslog.New": "log/syslog",
+ "syslog.NewLogger": "log/syslog",
+ "syslog.Priority": "log/syslog",
+ "syslog.Writer": "log/syslog",
+ "tabwriter.AlignRight": "text/tabwriter",
+ "tabwriter.Debug": "text/tabwriter",
+ "tabwriter.DiscardEmptyColumns": "text/tabwriter",
+ "tabwriter.Escape": "text/tabwriter",
+ "tabwriter.FilterHTML": "text/tabwriter",
+ "tabwriter.NewWriter": "text/tabwriter",
+ "tabwriter.StripEscape": "text/tabwriter",
+ "tabwriter.TabIndent": "text/tabwriter",
+ "tabwriter.Writer": "text/tabwriter",
+ "tar.ErrFieldTooLong": "archive/tar",
+ "tar.ErrHeader": "archive/tar",
+ "tar.ErrWriteAfterClose": "archive/tar",
+ "tar.ErrWriteTooLong": "archive/tar",
+ "tar.FileInfoHeader": "archive/tar",
+ "tar.Header": "archive/tar",
+ "tar.NewReader": "archive/tar",
+ "tar.NewWriter": "archive/tar",
+ "tar.Reader": "archive/tar",
+ "tar.TypeBlock": "archive/tar",
+ "tar.TypeChar": "archive/tar",
+ "tar.TypeCont": "archive/tar",
+ "tar.TypeDir": "archive/tar",
+ "tar.TypeFifo": "archive/tar",
+ "tar.TypeGNULongLink": "archive/tar",
+ "tar.TypeGNULongName": "archive/tar",
+ "tar.TypeLink": "archive/tar",
+ "tar.TypeReg": "archive/tar",
+ "tar.TypeRegA": "archive/tar",
+ "tar.TypeSymlink": "archive/tar",
+ "tar.TypeXGlobalHeader": "archive/tar",
+ "tar.TypeXHeader": "archive/tar",
+ "tar.Writer": "archive/tar",
+ "template.CSS": "html/template",
+ "template.ErrAmbigContext": "html/template",
+ "template.ErrBadHTML": "html/template",
+ "template.ErrBranchEnd": "html/template",
+ "template.ErrEndContext": "html/template",
+ "template.ErrNoSuchTemplate": "html/template",
+ "template.ErrOutputContext": "html/template",
+ "template.ErrPartialCharset": "html/template",
+ "template.ErrPartialEscape": "html/template",
+ "template.ErrRangeLoopReentry": "html/template",
+ "template.ErrSlashAmbig": "html/template",
+ "template.Error": "html/template",
+ "template.ErrorCode": "html/template",
+ // "template.FuncMap" is ambiguous
+ "template.HTML": "html/template",
+ "template.HTMLAttr": "html/template",
+ // "template.HTMLEscape" is ambiguous
+ // "template.HTMLEscapeString" is ambiguous
+ // "template.HTMLEscaper" is ambiguous
+ "template.JS": "html/template",
+ // "template.JSEscape" is ambiguous
+ // "template.JSEscapeString" is ambiguous
+ // "template.JSEscaper" is ambiguous
+ "template.JSStr": "html/template",
+ // "template.Must" is ambiguous
+ // "template.New" is ambiguous
+ "template.OK": "html/template",
+ // "template.ParseFiles" is ambiguous
+ // "template.ParseGlob" is ambiguous
+ // "template.Template" is ambiguous
+ "template.URL": "html/template",
+ // "template.URLQueryEscaper" is ambiguous
+ "testing.AllocsPerRun": "testing",
+ "testing.B": "testing",
+ "testing.Benchmark": "testing",
+ "testing.BenchmarkResult": "testing",
+ "testing.Cover": "testing",
+ "testing.CoverBlock": "testing",
+ "testing.InternalBenchmark": "testing",
+ "testing.InternalExample": "testing",
+ "testing.InternalTest": "testing",
+ "testing.Main": "testing",
+ "testing.RegisterCover": "testing",
+ "testing.RunBenchmarks": "testing",
+ "testing.RunExamples": "testing",
+ "testing.RunTests": "testing",
+ "testing.Short": "testing",
+ "testing.T": "testing",
+ "testing.Verbose": "testing",
+ "textproto.CanonicalMIMEHeaderKey": "net/textproto",
+ "textproto.Conn": "net/textproto",
+ "textproto.Dial": "net/textproto",
+ "textproto.Error": "net/textproto",
+ "textproto.MIMEHeader": "net/textproto",
+ "textproto.NewConn": "net/textproto",
+ "textproto.NewReader": "net/textproto",
+ "textproto.NewWriter": "net/textproto",
+ "textproto.Pipeline": "net/textproto",
+ "textproto.ProtocolError": "net/textproto",
+ "textproto.Reader": "net/textproto",
+ "textproto.TrimBytes": "net/textproto",
+ "textproto.TrimString": "net/textproto",
+ "textproto.Writer": "net/textproto",
+ "time.ANSIC": "time",
+ "time.After": "time",
+ "time.AfterFunc": "time",
+ "time.April": "time",
+ "time.August": "time",
+ "time.Date": "time",
+ "time.December": "time",
+ "time.Duration": "time",
+ "time.February": "time",
+ "time.FixedZone": "time",
+ "time.Friday": "time",
+ "time.Hour": "time",
+ "time.January": "time",
+ "time.July": "time",
+ "time.June": "time",
+ "time.Kitchen": "time",
+ "time.LoadLocation": "time",
+ "time.Local": "time",
+ "time.Location": "time",
+ "time.March": "time",
+ "time.May": "time",
+ "time.Microsecond": "time",
+ "time.Millisecond": "time",
+ "time.Minute": "time",
+ "time.Monday": "time",
+ "time.Month": "time",
+ "time.Nanosecond": "time",
+ "time.NewTicker": "time",
+ "time.NewTimer": "time",
+ "time.November": "time",
+ "time.Now": "time",
+ "time.October": "time",
+ "time.Parse": "time",
+ "time.ParseDuration": "time",
+ "time.ParseError": "time",
+ "time.ParseInLocation": "time",
+ "time.RFC1123": "time",
+ "time.RFC1123Z": "time",
+ "time.RFC3339": "time",
+ "time.RFC3339Nano": "time",
+ "time.RFC822": "time",
+ "time.RFC822Z": "time",
+ "time.RFC850": "time",
+ "time.RubyDate": "time",
+ "time.Saturday": "time",
+ "time.Second": "time",
+ "time.September": "time",
+ "time.Since": "time",
+ "time.Sleep": "time",
+ "time.Stamp": "time",
+ "time.StampMicro": "time",
+ "time.StampMilli": "time",
+ "time.StampNano": "time",
+ "time.Sunday": "time",
+ "time.Thursday": "time",
+ "time.Tick": "time",
+ "time.Ticker": "time",
+ "time.Time": "time",
+ "time.Timer": "time",
+ "time.Tuesday": "time",
+ "time.UTC": "time",
+ "time.Unix": "time",
+ "time.UnixDate": "time",
+ "time.Wednesday": "time",
+ "time.Weekday": "time",
+ "tls.Certificate": "crypto/tls",
+ "tls.Client": "crypto/tls",
+ "tls.ClientAuthType": "crypto/tls",
+ "tls.Config": "crypto/tls",
+ "tls.Conn": "crypto/tls",
+ "tls.ConnectionState": "crypto/tls",
+ "tls.Dial": "crypto/tls",
+ "tls.Listen": "crypto/tls",
+ "tls.LoadX509KeyPair": "crypto/tls",
+ "tls.NewListener": "crypto/tls",
+ "tls.NoClientCert": "crypto/tls",
+ "tls.RequestClientCert": "crypto/tls",
+ "tls.RequireAndVerifyClientCert": "crypto/tls",
+ "tls.RequireAnyClientCert": "crypto/tls",
+ "tls.Server": "crypto/tls",
+ "tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA": "crypto/tls",
+ "tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256": "crypto/tls",
+ "tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA": "crypto/tls",
+ "tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA": "crypto/tls",
+ "tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA": "crypto/tls",
+ "tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA": "crypto/tls",
+ "tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256": "crypto/tls",
+ "tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA": "crypto/tls",
+ "tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA": "crypto/tls",
+ "tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA": "crypto/tls",
+ "tls.TLS_RSA_WITH_AES_128_CBC_SHA": "crypto/tls",
+ "tls.TLS_RSA_WITH_AES_256_CBC_SHA": "crypto/tls",
+ "tls.TLS_RSA_WITH_RC4_128_SHA": "crypto/tls",
+ "tls.VerifyClientCertIfGiven": "crypto/tls",
+ "tls.VersionSSL30": "crypto/tls",
+ "tls.VersionTLS10": "crypto/tls",
+ "tls.VersionTLS11": "crypto/tls",
+ "tls.VersionTLS12": "crypto/tls",
+ "tls.X509KeyPair": "crypto/tls",
+ "token.ADD": "go/token",
+ "token.ADD_ASSIGN": "go/token",
+ "token.AND": "go/token",
+ "token.AND_ASSIGN": "go/token",
+ "token.AND_NOT": "go/token",
+ "token.AND_NOT_ASSIGN": "go/token",
+ "token.ARROW": "go/token",
+ "token.ASSIGN": "go/token",
+ "token.BREAK": "go/token",
+ "token.CASE": "go/token",
+ "token.CHAN": "go/token",
+ "token.CHAR": "go/token",
+ "token.COLON": "go/token",
+ "token.COMMA": "go/token",
+ "token.COMMENT": "go/token",
+ "token.CONST": "go/token",
+ "token.CONTINUE": "go/token",
+ "token.DEC": "go/token",
+ "token.DEFAULT": "go/token",
+ "token.DEFER": "go/token",
+ "token.DEFINE": "go/token",
+ "token.ELLIPSIS": "go/token",
+ "token.ELSE": "go/token",
+ "token.EOF": "go/token",
+ "token.EQL": "go/token",
+ "token.FALLTHROUGH": "go/token",
+ "token.FLOAT": "go/token",
+ "token.FOR": "go/token",
+ "token.FUNC": "go/token",
+ "token.File": "go/token",
+ "token.FileSet": "go/token",
+ "token.GEQ": "go/token",
+ "token.GO": "go/token",
+ "token.GOTO": "go/token",
+ "token.GTR": "go/token",
+ "token.HighestPrec": "go/token",
+ "token.IDENT": "go/token",
+ "token.IF": "go/token",
+ "token.ILLEGAL": "go/token",
+ "token.IMAG": "go/token",
+ "token.IMPORT": "go/token",
+ "token.INC": "go/token",
+ "token.INT": "go/token",
+ "token.INTERFACE": "go/token",
+ "token.LAND": "go/token",
+ "token.LBRACE": "go/token",
+ "token.LBRACK": "go/token",
+ "token.LEQ": "go/token",
+ "token.LOR": "go/token",
+ "token.LPAREN": "go/token",
+ "token.LSS": "go/token",
+ "token.Lookup": "go/token",
+ "token.LowestPrec": "go/token",
+ "token.MAP": "go/token",
+ "token.MUL": "go/token",
+ "token.MUL_ASSIGN": "go/token",
+ "token.NEQ": "go/token",
+ "token.NOT": "go/token",
+ "token.NewFileSet": "go/token",
+ "token.NoPos": "go/token",
+ "token.OR": "go/token",
+ "token.OR_ASSIGN": "go/token",
+ "token.PACKAGE": "go/token",
+ "token.PERIOD": "go/token",
+ "token.Pos": "go/token",
+ "token.Position": "go/token",
+ "token.QUO": "go/token",
+ "token.QUO_ASSIGN": "go/token",
+ "token.RANGE": "go/token",
+ "token.RBRACE": "go/token",
+ "token.RBRACK": "go/token",
+ "token.REM": "go/token",
+ "token.REM_ASSIGN": "go/token",
+ "token.RETURN": "go/token",
+ "token.RPAREN": "go/token",
+ "token.SELECT": "go/token",
+ "token.SEMICOLON": "go/token",
+ "token.SHL": "go/token",
+ "token.SHL_ASSIGN": "go/token",
+ "token.SHR": "go/token",
+ "token.SHR_ASSIGN": "go/token",
+ "token.STRING": "go/token",
+ "token.STRUCT": "go/token",
+ "token.SUB": "go/token",
+ "token.SUB_ASSIGN": "go/token",
+ "token.SWITCH": "go/token",
+ "token.TYPE": "go/token",
+ "token.Token": "go/token",
+ "token.UnaryPrec": "go/token",
+ "token.VAR": "go/token",
+ "token.XOR": "go/token",
+ "token.XOR_ASSIGN": "go/token",
+ "unicode.ASCII_Hex_Digit": "unicode",
+ "unicode.Arabic": "unicode",
+ "unicode.Armenian": "unicode",
+ "unicode.Avestan": "unicode",
+ "unicode.AzeriCase": "unicode",
+ "unicode.Balinese": "unicode",
+ "unicode.Bamum": "unicode",
+ "unicode.Batak": "unicode",
+ "unicode.Bengali": "unicode",
+ "unicode.Bidi_Control": "unicode",
+ "unicode.Bopomofo": "unicode",
+ "unicode.Brahmi": "unicode",
+ "unicode.Braille": "unicode",
+ "unicode.Buginese": "unicode",
+ "unicode.Buhid": "unicode",
+ "unicode.C": "unicode",
+ "unicode.Canadian_Aboriginal": "unicode",
+ "unicode.Carian": "unicode",
+ "unicode.CaseRange": "unicode",
+ "unicode.CaseRanges": "unicode",
+ "unicode.Categories": "unicode",
+ "unicode.Cc": "unicode",
+ "unicode.Cf": "unicode",
+ "unicode.Chakma": "unicode",
+ "unicode.Cham": "unicode",
+ "unicode.Cherokee": "unicode",
+ "unicode.Co": "unicode",
+ "unicode.Common": "unicode",
+ "unicode.Coptic": "unicode",
+ "unicode.Cs": "unicode",
+ "unicode.Cuneiform": "unicode",
+ "unicode.Cypriot": "unicode",
+ "unicode.Cyrillic": "unicode",
+ "unicode.Dash": "unicode",
+ "unicode.Deprecated": "unicode",
+ "unicode.Deseret": "unicode",
+ "unicode.Devanagari": "unicode",
+ "unicode.Diacritic": "unicode",
+ "unicode.Digit": "unicode",
+ "unicode.Egyptian_Hieroglyphs": "unicode",
+ "unicode.Ethiopic": "unicode",
+ "unicode.Extender": "unicode",
+ "unicode.FoldCategory": "unicode",
+ "unicode.FoldScript": "unicode",
+ "unicode.Georgian": "unicode",
+ "unicode.Glagolitic": "unicode",
+ "unicode.Gothic": "unicode",
+ "unicode.GraphicRanges": "unicode",
+ "unicode.Greek": "unicode",
+ "unicode.Gujarati": "unicode",
+ "unicode.Gurmukhi": "unicode",
+ "unicode.Han": "unicode",
+ "unicode.Hangul": "unicode",
+ "unicode.Hanunoo": "unicode",
+ "unicode.Hebrew": "unicode",
+ "unicode.Hex_Digit": "unicode",
+ "unicode.Hiragana": "unicode",
+ "unicode.Hyphen": "unicode",
+ "unicode.IDS_Binary_Operator": "unicode",
+ "unicode.IDS_Trinary_Operator": "unicode",
+ "unicode.Ideographic": "unicode",
+ "unicode.Imperial_Aramaic": "unicode",
+ "unicode.In": "unicode",
+ "unicode.Inherited": "unicode",
+ "unicode.Inscriptional_Pahlavi": "unicode",
+ "unicode.Inscriptional_Parthian": "unicode",
+ "unicode.Is": "unicode",
+ "unicode.IsControl": "unicode",
+ "unicode.IsDigit": "unicode",
+ "unicode.IsGraphic": "unicode",
+ "unicode.IsLetter": "unicode",
+ "unicode.IsLower": "unicode",
+ "unicode.IsMark": "unicode",
+ "unicode.IsNumber": "unicode",
+ "unicode.IsOneOf": "unicode",
+ "unicode.IsPrint": "unicode",
+ "unicode.IsPunct": "unicode",
+ "unicode.IsSpace": "unicode",
+ "unicode.IsSymbol": "unicode",
+ "unicode.IsTitle": "unicode",
+ "unicode.IsUpper": "unicode",
+ "unicode.Javanese": "unicode",
+ "unicode.Join_Control": "unicode",
+ "unicode.Kaithi": "unicode",
+ "unicode.Kannada": "unicode",
+ "unicode.Katakana": "unicode",
+ "unicode.Kayah_Li": "unicode",
+ "unicode.Kharoshthi": "unicode",
+ "unicode.Khmer": "unicode",
+ "unicode.L": "unicode",
+ "unicode.Lao": "unicode",
+ "unicode.Latin": "unicode",
+ "unicode.Lepcha": "unicode",
+ "unicode.Letter": "unicode",
+ "unicode.Limbu": "unicode",
+ "unicode.Linear_B": "unicode",
+ "unicode.Lisu": "unicode",
+ "unicode.Ll": "unicode",
+ "unicode.Lm": "unicode",
+ "unicode.Lo": "unicode",
+ "unicode.Logical_Order_Exception": "unicode",
+ "unicode.Lower": "unicode",
+ "unicode.LowerCase": "unicode",
+ "unicode.Lt": "unicode",
+ "unicode.Lu": "unicode",
+ "unicode.Lycian": "unicode",
+ "unicode.Lydian": "unicode",
+ "unicode.M": "unicode",
+ "unicode.Malayalam": "unicode",
+ "unicode.Mandaic": "unicode",
+ "unicode.Mark": "unicode",
+ "unicode.MaxASCII": "unicode",
+ "unicode.MaxCase": "unicode",
+ "unicode.MaxLatin1": "unicode",
+ "unicode.MaxRune": "unicode",
+ "unicode.Mc": "unicode",
+ "unicode.Me": "unicode",
+ "unicode.Meetei_Mayek": "unicode",
+ "unicode.Meroitic_Cursive": "unicode",
+ "unicode.Meroitic_Hieroglyphs": "unicode",
+ "unicode.Miao": "unicode",
+ "unicode.Mn": "unicode",
+ "unicode.Mongolian": "unicode",
+ "unicode.Myanmar": "unicode",
+ "unicode.N": "unicode",
+ "unicode.Nd": "unicode",
+ "unicode.New_Tai_Lue": "unicode",
+ "unicode.Nko": "unicode",
+ "unicode.Nl": "unicode",
+ "unicode.No": "unicode",
+ "unicode.Noncharacter_Code_Point": "unicode",
+ "unicode.Number": "unicode",
+ "unicode.Ogham": "unicode",
+ "unicode.Ol_Chiki": "unicode",
+ "unicode.Old_Italic": "unicode",
+ "unicode.Old_Persian": "unicode",
+ "unicode.Old_South_Arabian": "unicode",
+ "unicode.Old_Turkic": "unicode",
+ "unicode.Oriya": "unicode",
+ "unicode.Osmanya": "unicode",
+ "unicode.Other": "unicode",
+ "unicode.Other_Alphabetic": "unicode",
+ "unicode.Other_Default_Ignorable_Code_Point": "unicode",
+ "unicode.Other_Grapheme_Extend": "unicode",
+ "unicode.Other_ID_Continue": "unicode",
+ "unicode.Other_ID_Start": "unicode",
+ "unicode.Other_Lowercase": "unicode",
+ "unicode.Other_Math": "unicode",
+ "unicode.Other_Uppercase": "unicode",
+ "unicode.P": "unicode",
+ "unicode.Pattern_Syntax": "unicode",
+ "unicode.Pattern_White_Space": "unicode",
+ "unicode.Pc": "unicode",
+ "unicode.Pd": "unicode",
+ "unicode.Pe": "unicode",
+ "unicode.Pf": "unicode",
+ "unicode.Phags_Pa": "unicode",
+ "unicode.Phoenician": "unicode",
+ "unicode.Pi": "unicode",
+ "unicode.Po": "unicode",
+ "unicode.PrintRanges": "unicode",
+ "unicode.Properties": "unicode",
+ "unicode.Ps": "unicode",
+ "unicode.Punct": "unicode",
+ "unicode.Quotation_Mark": "unicode",
+ "unicode.Radical": "unicode",
+ "unicode.Range16": "unicode",
+ "unicode.Range32": "unicode",
+ "unicode.RangeTable": "unicode",
+ "unicode.Rejang": "unicode",
+ "unicode.ReplacementChar": "unicode",
+ "unicode.Runic": "unicode",
+ "unicode.S": "unicode",
+ "unicode.STerm": "unicode",
+ "unicode.Samaritan": "unicode",
+ "unicode.Saurashtra": "unicode",
+ "unicode.Sc": "unicode",
+ "unicode.Scripts": "unicode",
+ "unicode.Sharada": "unicode",
+ "unicode.Shavian": "unicode",
+ "unicode.SimpleFold": "unicode",
+ "unicode.Sinhala": "unicode",
+ "unicode.Sk": "unicode",
+ "unicode.Sm": "unicode",
+ "unicode.So": "unicode",
+ "unicode.Soft_Dotted": "unicode",
+ "unicode.Sora_Sompeng": "unicode",
+ "unicode.Space": "unicode",
+ "unicode.SpecialCase": "unicode",
+ "unicode.Sundanese": "unicode",
+ "unicode.Syloti_Nagri": "unicode",
+ "unicode.Symbol": "unicode",
+ "unicode.Syriac": "unicode",
+ "unicode.Tagalog": "unicode",
+ "unicode.Tagbanwa": "unicode",
+ "unicode.Tai_Le": "unicode",
+ "unicode.Tai_Tham": "unicode",
+ "unicode.Tai_Viet": "unicode",
+ "unicode.Takri": "unicode",
+ "unicode.Tamil": "unicode",
+ "unicode.Telugu": "unicode",
+ "unicode.Terminal_Punctuation": "unicode",
+ "unicode.Thaana": "unicode",
+ "unicode.Thai": "unicode",
+ "unicode.Tibetan": "unicode",
+ "unicode.Tifinagh": "unicode",
+ "unicode.Title": "unicode",
+ "unicode.TitleCase": "unicode",
+ "unicode.To": "unicode",
+ "unicode.ToLower": "unicode",
+ "unicode.ToTitle": "unicode",
+ "unicode.ToUpper": "unicode",
+ "unicode.TurkishCase": "unicode",
+ "unicode.Ugaritic": "unicode",
+ "unicode.Unified_Ideograph": "unicode",
+ "unicode.Upper": "unicode",
+ "unicode.UpperCase": "unicode",
+ "unicode.UpperLower": "unicode",
+ "unicode.Vai": "unicode",
+ "unicode.Variation_Selector": "unicode",
+ "unicode.Version": "unicode",
+ "unicode.White_Space": "unicode",
+ "unicode.Yi": "unicode",
+ "unicode.Z": "unicode",
+ "unicode.Zl": "unicode",
+ "unicode.Zp": "unicode",
+ "unicode.Zs": "unicode",
+ "url.Error": "net/url",
+ "url.EscapeError": "net/url",
+ "url.Parse": "net/url",
+ "url.ParseQuery": "net/url",
+ "url.ParseRequestURI": "net/url",
+ "url.QueryEscape": "net/url",
+ "url.QueryUnescape": "net/url",
+ "url.URL": "net/url",
+ "url.User": "net/url",
+ "url.UserPassword": "net/url",
+ "url.Userinfo": "net/url",
+ "url.Values": "net/url",
+ "user.Current": "os/user",
+ "user.Lookup": "os/user",
+ "user.LookupId": "os/user",
+ "user.UnknownUserError": "os/user",
+ "user.UnknownUserIdError": "os/user",
+ "user.User": "os/user",
+ "utf16.Decode": "unicode/utf16",
+ "utf16.DecodeRune": "unicode/utf16",
+ "utf16.Encode": "unicode/utf16",
+ "utf16.EncodeRune": "unicode/utf16",
+ "utf16.IsSurrogate": "unicode/utf16",
+ "utf8.DecodeLastRune": "unicode/utf8",
+ "utf8.DecodeLastRuneInString": "unicode/utf8",
+ "utf8.DecodeRune": "unicode/utf8",
+ "utf8.DecodeRuneInString": "unicode/utf8",
+ "utf8.EncodeRune": "unicode/utf8",
+ "utf8.FullRune": "unicode/utf8",
+ "utf8.FullRuneInString": "unicode/utf8",
+ "utf8.MaxRune": "unicode/utf8",
+ "utf8.RuneCount": "unicode/utf8",
+ "utf8.RuneCountInString": "unicode/utf8",
+ "utf8.RuneError": "unicode/utf8",
+ "utf8.RuneLen": "unicode/utf8",
+ "utf8.RuneSelf": "unicode/utf8",
+ "utf8.RuneStart": "unicode/utf8",
+ "utf8.UTFMax": "unicode/utf8",
+ "utf8.Valid": "unicode/utf8",
+ "utf8.ValidRune": "unicode/utf8",
+ "utf8.ValidString": "unicode/utf8",
+ "x509.CANotAuthorizedForThisName": "crypto/x509",
+ "x509.CertPool": "crypto/x509",
+ "x509.Certificate": "crypto/x509",
+ "x509.CertificateInvalidError": "crypto/x509",
+ "x509.ConstraintViolationError": "crypto/x509",
+ "x509.CreateCertificate": "crypto/x509",
+ "x509.DSA": "crypto/x509",
+ "x509.DSAWithSHA1": "crypto/x509",
+ "x509.DSAWithSHA256": "crypto/x509",
+ "x509.DecryptPEMBlock": "crypto/x509",
+ "x509.ECDSA": "crypto/x509",
+ "x509.ECDSAWithSHA1": "crypto/x509",
+ "x509.ECDSAWithSHA256": "crypto/x509",
+ "x509.ECDSAWithSHA384": "crypto/x509",
+ "x509.ECDSAWithSHA512": "crypto/x509",
+ "x509.EncryptPEMBlock": "crypto/x509",
+ "x509.ErrUnsupportedAlgorithm": "crypto/x509",
+ "x509.Expired": "crypto/x509",
+ "x509.ExtKeyUsage": "crypto/x509",
+ "x509.ExtKeyUsageAny": "crypto/x509",
+ "x509.ExtKeyUsageClientAuth": "crypto/x509",
+ "x509.ExtKeyUsageCodeSigning": "crypto/x509",
+ "x509.ExtKeyUsageEmailProtection": "crypto/x509",
+ "x509.ExtKeyUsageIPSECEndSystem": "crypto/x509",
+ "x509.ExtKeyUsageIPSECTunnel": "crypto/x509",
+ "x509.ExtKeyUsageIPSECUser": "crypto/x509",
+ "x509.ExtKeyUsageMicrosoftServerGatedCrypto": "crypto/x509",
+ "x509.ExtKeyUsageNetscapeServerGatedCrypto": "crypto/x509",
+ "x509.ExtKeyUsageOCSPSigning": "crypto/x509",
+ "x509.ExtKeyUsageServerAuth": "crypto/x509",
+ "x509.ExtKeyUsageTimeStamping": "crypto/x509",
+ "x509.HostnameError": "crypto/x509",
+ "x509.IncompatibleUsage": "crypto/x509",
+ "x509.IncorrectPasswordError": "crypto/x509",
+ "x509.InvalidReason": "crypto/x509",
+ "x509.IsEncryptedPEMBlock": "crypto/x509",
+ "x509.KeyUsage": "crypto/x509",
+ "x509.KeyUsageCRLSign": "crypto/x509",
+ "x509.KeyUsageCertSign": "crypto/x509",
+ "x509.KeyUsageContentCommitment": "crypto/x509",
+ "x509.KeyUsageDataEncipherment": "crypto/x509",
+ "x509.KeyUsageDecipherOnly": "crypto/x509",
+ "x509.KeyUsageDigitalSignature": "crypto/x509",
+ "x509.KeyUsageEncipherOnly": "crypto/x509",
+ "x509.KeyUsageKeyAgreement": "crypto/x509",
+ "x509.KeyUsageKeyEncipherment": "crypto/x509",
+ "x509.MD2WithRSA": "crypto/x509",
+ "x509.MD5WithRSA": "crypto/x509",
+ "x509.MarshalECPrivateKey": "crypto/x509",
+ "x509.MarshalPKCS1PrivateKey": "crypto/x509",
+ "x509.MarshalPKIXPublicKey": "crypto/x509",
+ "x509.NewCertPool": "crypto/x509",
+ "x509.NotAuthorizedToSign": "crypto/x509",
+ "x509.PEMCipher": "crypto/x509",
+ "x509.PEMCipher3DES": "crypto/x509",
+ "x509.PEMCipherAES128": "crypto/x509",
+ "x509.PEMCipherAES192": "crypto/x509",
+ "x509.PEMCipherAES256": "crypto/x509",
+ "x509.PEMCipherDES": "crypto/x509",
+ "x509.ParseCRL": "crypto/x509",
+ "x509.ParseCertificate": "crypto/x509",
+ "x509.ParseCertificates": "crypto/x509",
+ "x509.ParseDERCRL": "crypto/x509",
+ "x509.ParseECPrivateKey": "crypto/x509",
+ "x509.ParsePKCS1PrivateKey": "crypto/x509",
+ "x509.ParsePKCS8PrivateKey": "crypto/x509",
+ "x509.ParsePKIXPublicKey": "crypto/x509",
+ "x509.PublicKeyAlgorithm": "crypto/x509",
+ "x509.RSA": "crypto/x509",
+ "x509.SHA1WithRSA": "crypto/x509",
+ "x509.SHA256WithRSA": "crypto/x509",
+ "x509.SHA384WithRSA": "crypto/x509",
+ "x509.SHA512WithRSA": "crypto/x509",
+ "x509.SignatureAlgorithm": "crypto/x509",
+ "x509.SystemRootsError": "crypto/x509",
+ "x509.TooManyIntermediates": "crypto/x509",
+ "x509.UnhandledCriticalExtension": "crypto/x509",
+ "x509.UnknownAuthorityError": "crypto/x509",
+ "x509.UnknownPublicKeyAlgorithm": "crypto/x509",
+ "x509.UnknownSignatureAlgorithm": "crypto/x509",
+ "x509.VerifyOptions": "crypto/x509",
+ "xml.Attr": "encoding/xml",
+ "xml.CharData": "encoding/xml",
+ "xml.Comment": "encoding/xml",
+ "xml.CopyToken": "encoding/xml",
+ "xml.Decoder": "encoding/xml",
+ "xml.Directive": "encoding/xml",
+ "xml.Encoder": "encoding/xml",
+ "xml.EndElement": "encoding/xml",
+ "xml.Escape": "encoding/xml",
+ "xml.EscapeText": "encoding/xml",
+ "xml.HTMLAutoClose": "encoding/xml",
+ "xml.HTMLEntity": "encoding/xml",
+ "xml.Header": "encoding/xml",
+ "xml.Marshal": "encoding/xml",
+ "xml.MarshalIndent": "encoding/xml",
+ "xml.Marshaler": "encoding/xml",
+ "xml.MarshalerAttr": "encoding/xml",
+ "xml.Name": "encoding/xml",
+ "xml.NewDecoder": "encoding/xml",
+ "xml.NewEncoder": "encoding/xml",
+ "xml.ProcInst": "encoding/xml",
+ "xml.StartElement": "encoding/xml",
+ "xml.SyntaxError": "encoding/xml",
+ "xml.TagPathError": "encoding/xml",
+ "xml.Token": "encoding/xml",
+ "xml.Unmarshal": "encoding/xml",
+ "xml.UnmarshalError": "encoding/xml",
+ "xml.Unmarshaler": "encoding/xml",
+ "xml.UnmarshalerAttr": "encoding/xml",
+ "xml.UnsupportedTypeError": "encoding/xml",
+ "zip.Compressor": "archive/zip",
+ "zip.Decompressor": "archive/zip",
+ "zip.Deflate": "archive/zip",
+ "zip.ErrAlgorithm": "archive/zip",
+ "zip.ErrChecksum": "archive/zip",
+ "zip.ErrFormat": "archive/zip",
+ "zip.File": "archive/zip",
+ "zip.FileHeader": "archive/zip",
+ "zip.FileInfoHeader": "archive/zip",
+ "zip.NewReader": "archive/zip",
+ "zip.NewWriter": "archive/zip",
+ "zip.OpenReader": "archive/zip",
+ "zip.ReadCloser": "archive/zip",
+ "zip.Reader": "archive/zip",
+ "zip.RegisterCompressor": "archive/zip",
+ "zip.RegisterDecompressor": "archive/zip",
+ "zip.Store": "archive/zip",
+ "zip.Writer": "archive/zip",
+ "zlib.BestCompression": "compress/zlib",
+ "zlib.BestSpeed": "compress/zlib",
+ "zlib.DefaultCompression": "compress/zlib",
+ "zlib.ErrChecksum": "compress/zlib",
+ "zlib.ErrDictionary": "compress/zlib",
+ "zlib.ErrHeader": "compress/zlib",
+ "zlib.NewReader": "compress/zlib",
+ "zlib.NewReaderDict": "compress/zlib",
+ "zlib.NewWriter": "compress/zlib",
+ "zlib.NewWriterLevel": "compress/zlib",
+ "zlib.NewWriterLevelDict": "compress/zlib",
+ "zlib.NoCompression": "compress/zlib",
+ "zlib.Writer": "compress/zlib",
+}
diff --git a/cmd/geth/monitorcmd.go b/cmd/geth/monitorcmd.go
index a45d29b8f2..2f08f16758 100644
--- a/cmd/geth/monitorcmd.go
+++ b/cmd/geth/monitorcmd.go
@@ -165,7 +165,11 @@ func monitor(ctx *cli.Context) {
// retrieveMetrics contacts the attached geth node and retrieves the entire set
// of collected system metrics.
func retrieveMetrics(xeth *rpc.Xeth) (map[string]interface{}, error) {
- return xeth.Call("debug_metrics", []interface{}{true})
+ reply, err := xeth.Call("debug_metrics", []interface{}{true})
+ if err != nil {
+ return nil, err
+ }
+ return reply.(map[string]interface{}), nil
}
// resolveMetrics takes a list of input metric patterns, and resolves each to one
diff --git a/rpc/api/db.go b/rpc/api/db.go
index 0eddc410ed..7ca049e801 100644
--- a/rpc/api/db.go
+++ b/rpc/api/db.go
@@ -97,7 +97,10 @@ func (self *dbApi) GetString(req *shared.Request) (interface{}, error) {
}
ret, err := self.xeth.DbGet([]byte(args.Database + args.Key))
- return string(ret), err
+ if err != nil {
+ return nil, err
+ }
+ return string(ret), nil
}
func (self *dbApi) PutString(req *shared.Request) (interface{}, error) {
diff --git a/rpc/api/debug.go b/rpc/api/debug.go
index d325b17209..b3e96fa26f 100644
--- a/rpc/api/debug.go
+++ b/rpc/api/debug.go
@@ -138,7 +138,10 @@ func (self *debugApi) GetBlockRlp(req *shared.Request) (interface{}, error) {
return nil, fmt.Errorf("block #%d not found", args.BlockNumber)
}
encoded, err := rlp.EncodeToBytes(block)
- return fmt.Sprintf("%x", encoded), err
+ if err != nil {
+ return nil, err
+ }
+ return fmt.Sprintf("%x", encoded), nil
}
func (self *debugApi) SetHead(req *shared.Request) (interface{}, error) {
diff --git a/rpc/api/personal.go b/rpc/api/personal.go
index 1b0dea330a..fd78a757d5 100644
--- a/rpc/api/personal.go
+++ b/rpc/api/personal.go
@@ -101,7 +101,10 @@ func (self *personalApi) NewAccount(req *shared.Request) (interface{}, error) {
am := self.ethereum.AccountManager()
acc, err := am.NewAccount(args.Passphrase)
- return acc.Address.Hex(), err
+ if err != nil {
+ return nil, err
+ }
+ return acc.Address.Hex(), nil
}
func (self *personalApi) UnlockAccount(req *shared.Request) (interface{}, error) {
diff --git a/rpc/genapi.go b/rpc/genapi.go
new file mode 100644
index 0000000000..508e075b97
--- /dev/null
+++ b/rpc/genapi.go
@@ -0,0 +1,805 @@
+package rpc
+
+import (
+ "math/big"
+
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/common/compiler"
+ "github.com/ethereum/go-ethereum/core/state"
+ "github.com/ethereum/go-ethereum/eth"
+ "github.com/ethereum/go-ethereum/rpc/api"
+ "github.com/ethereum/go-ethereum/rpc/comms"
+ "github.com/ethereum/go-ethereum/xeth"
+)
+
+type GenApi struct {
+ Admin *Admin
+ Db *Db
+ Debug *Debug
+ Eth *Eth
+ Miner *Miner
+ Net *Net
+ Personal *Personal
+ Shh *Shh
+ Txpool *Txpool
+ Web3 *Web3
+}
+
+func NewGenApi(client comms.EthereumClient) *GenApi {
+ xeth := NewXeth(client)
+
+ return &GenApi{
+ Admin: &Admin{xeth},
+ Db: &Db{xeth},
+ Debug: &Debug{xeth},
+ Eth: &Eth{xeth},
+ Miner: &Miner{xeth},
+ Net: &Net{xeth},
+ Personal: &Personal{xeth},
+ Shh: &Shh{xeth},
+ Txpool: &Txpool{xeth},
+ Web3: &Web3{xeth},
+ }
+}
+
+type Admin struct {
+ xeth *Xeth
+}
+
+func (self *Admin) AddPeer(url string) (result bool, failure error) {
+ res, err := self.xeth.Call("admin_addPeer", []interface{}{url})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Admin) ChainSyncStatus() (interface{}, error) {
+ return self.xeth.Call("admin_chainSyncStatus", nil)
+}
+func (self *Admin) Datadir() (interface{}, error) {
+ return self.xeth.Call("admin_datadir", nil)
+}
+func (self *Admin) EnableUserAgent() (result bool, failure error) {
+ res, err := self.xeth.Call("admin_enableUserAgent", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Admin) ExportChain() (result bool, failure error) {
+ res, err := self.xeth.Call("admin_exportChain", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Admin) GetContractInfo(contract string) (interface{}, error) {
+ return self.xeth.Call("admin_getContractInfo", []interface{}{contract})
+}
+func (self *Admin) HttpGet(uri string, path string) (result string, failure error) {
+ res, err := self.xeth.Call("admin_httpGet", []interface{}{uri, path})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(string), nil
+}
+func (self *Admin) ImportChain() (result bool, failure error) {
+ res, err := self.xeth.Call("admin_importChain", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Admin) NodeInfo() (result *eth.NodeInfo, failure error) {
+ res, err := self.xeth.Call("admin_nodeInfo", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(*eth.NodeInfo), nil
+}
+func (self *Admin) Peers() (result []*eth.PeerInfo, failure error) {
+ res, err := self.xeth.Call("admin_peers", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ for _, item := range res.([]interface{}) {
+ result = append(result, item.(*eth.PeerInfo))
+ }
+ return
+}
+func (self *Admin) Register(sender string, address string, contentHashHex string) (result bool, failure error) {
+ res, err := self.xeth.Call("admin_register", []interface{}{sender, address, contentHashHex})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Admin) RegisterUrl(sender string, contentHash string, url string) (result bool, failure error) {
+ res, err := self.xeth.Call("admin_registerUrl", []interface{}{sender, contentHash, url})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Admin) SaveInfo(contractInfo compiler.ContractInfo, filename string) (result string, failure error) {
+ res, err := self.xeth.Call("admin_saveInfo", []interface{}{contractInfo, filename})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(string), nil
+}
+func (self *Admin) SetGlobalRegistrar(nameReg string, contractAddress string) (interface{}, error) {
+ return self.xeth.Call("admin_setGlobalRegistrar", []interface{}{nameReg, contractAddress})
+}
+func (self *Admin) SetHashReg(hashReg string, sender string) (interface{}, error) {
+ return self.xeth.Call("admin_setHashReg", []interface{}{hashReg, sender})
+}
+func (self *Admin) SetSolc(path string) (result string, failure error) {
+ res, err := self.xeth.Call("admin_setSolc", []interface{}{path})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(string), nil
+}
+func (self *Admin) SetUrlHint(urlHint string, sender string) (interface{}, error) {
+ return self.xeth.Call("admin_setUrlHint", []interface{}{urlHint, sender})
+}
+func (self *Admin) Sleep(s int) (interface{}, error) {
+ return self.xeth.Call("admin_sleep", []interface{}{s})
+}
+func (self *Admin) SleepBlocks(n int64, timeout int64) (result uint64, failure error) {
+ res, err := self.xeth.Call("admin_sleepBlocks", []interface{}{n, timeout})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(uint64), nil
+}
+func (self *Admin) StartNatSpec() (result bool, failure error) {
+ res, err := self.xeth.Call("admin_startNatSpec", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Admin) StartRPC(listenAddress string, listenPort uint, corsDomain string, apis string) (result bool, failure error) {
+ res, err := self.xeth.Call("admin_startRPC", []interface{}{listenAddress, listenPort, corsDomain, apis})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Admin) StopNatSpec() (result bool, failure error) {
+ res, err := self.xeth.Call("admin_stopNatSpec", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Admin) StopRPC() (result bool, failure error) {
+ res, err := self.xeth.Call("admin_stopRPC", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Admin) Verbosity(level int) (result bool, failure error) {
+ res, err := self.xeth.Call("admin_verbosity", []interface{}{level})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+
+type Db struct {
+ xeth *Xeth
+}
+
+func (self *Db) GetHex() (result []byte, failure error) {
+ res, err := self.xeth.Call("db_getHex", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.([]byte), nil
+}
+func (self *Db) GetString() (result string, failure error) {
+ res, err := self.xeth.Call("db_getString", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(string), nil
+}
+func (self *Db) PutHex() (result bool, failure error) {
+ res, err := self.xeth.Call("db_putHex", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Db) PutString() (result bool, failure error) {
+ res, err := self.xeth.Call("db_putString", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+
+type Debug struct {
+ xeth *Xeth
+}
+
+func (self *Debug) DumpBlock() (result state.World, failure error) {
+ res, err := self.xeth.Call("debug_dumpBlock", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(state.World), nil
+}
+func (self *Debug) GetBlockRlp() (interface{}, error) {
+ return self.xeth.Call("debug_getBlockRlp", nil)
+}
+func (self *Debug) Metrics(raw bool) (interface{}, error) {
+ return self.xeth.Call("debug_metrics", []interface{}{raw})
+}
+func (self *Debug) PrintBlock() (interface{}, error) {
+ return self.xeth.Call("debug_printBlock", nil)
+}
+func (self *Debug) ProcessBlock() (result bool, failure error) {
+ res, err := self.xeth.Call("debug_processBlock", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Debug) SeedHash() (interface{}, error) {
+ return self.xeth.Call("debug_seedHash", nil)
+}
+func (self *Debug) SetHead() (interface{}, error) {
+ return self.xeth.Call("debug_setHead", nil)
+}
+
+type Eth struct {
+ xeth *Xeth
+}
+
+func (self *Eth) Accounts() (result []string, failure error) {
+ res, err := self.xeth.Call("eth_accounts", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ for _, item := range res.([]interface{}) {
+ result = append(result, item.(string))
+ }
+ return
+}
+func (self *Eth) BlockNumber() (result int64, failure error) {
+ res, err := self.xeth.Call("eth_blockNumber", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return new(big.Int).SetBytes(common.FromHex(res.(string))).Int64(), nil
+}
+func (self *Eth) Call(from string, to string, value *big.Int, gas *big.Int, gasPrice *big.Int, data string, blockNumber int64) (result []byte, failure error) {
+ res, err := self.xeth.Call("eth_call", []interface{}{from, to, value, gas, gasPrice, data, blockNumber})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.([]byte), nil
+}
+func (self *Eth) Coinbase() (result []byte, failure error) {
+ res, err := self.xeth.Call("eth_coinbase", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.([]byte), nil
+}
+func (self *Eth) CompileSolidity() (interface{}, error) {
+ return self.xeth.Call("eth_compileSolidity", nil)
+}
+func (self *Eth) EstimateGas() (result int64, failure error) {
+ res, err := self.xeth.Call("eth_estimateGas", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return new(big.Int).SetBytes(common.FromHex(res.(string))).Int64(), nil
+}
+func (self *Eth) Flush() (interface{}, error) {
+ return self.xeth.Call("eth_flush", nil)
+}
+func (self *Eth) GasPrice(price string) (result int64, failure error) {
+ res, err := self.xeth.Call("eth_gasPrice", []interface{}{price})
+ if err != nil {
+ failure = err
+ return
+ }
+ return new(big.Int).SetBytes(common.FromHex(res.(string))).Int64(), nil
+}
+func (self *Eth) GetBalance(address string, blockNumber int64) (result string, failure error) {
+ res, err := self.xeth.Call("eth_getBalance", []interface{}{address, blockNumber})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(string), nil
+}
+func (self *Eth) GetBlockByHash(blockHash string, includeTxs bool) (result *api.BlockRes, failure error) {
+ res, err := self.xeth.Call("eth_getBlockByHash", []interface{}{blockHash, includeTxs})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(*api.BlockRes), nil
+}
+func (self *Eth) GetBlockByNumber(blockNumber int64, includeTxs bool) (interface{}, error) {
+ return self.xeth.Call("eth_getBlockByNumber", []interface{}{blockNumber, includeTxs})
+}
+func (self *Eth) GetBlockTransactionCountByHash() (interface{}, error) {
+ return self.xeth.Call("eth_getBlockTransactionCountByHash", nil)
+}
+func (self *Eth) GetBlockTransactionCountByNumber() (interface{}, error) {
+ return self.xeth.Call("eth_getBlockTransactionCountByNumber", nil)
+}
+func (self *Eth) GetCode(address string, blockNumber int64) (result []byte, failure error) {
+ res, err := self.xeth.Call("eth_getCode", []interface{}{address, blockNumber})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.([]byte), nil
+}
+func (self *Eth) GetCompilers() (interface{}, error) {
+ return self.xeth.Call("eth_getCompilers", nil)
+}
+func (self *Eth) GetData(address string, blockNumber int64) (result []byte, failure error) {
+ res, err := self.xeth.Call("eth_getData", []interface{}{address, blockNumber})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.([]byte), nil
+}
+func (self *Eth) GetFilterChanges() (interface{}, error) {
+ return self.xeth.Call("eth_getFilterChanges", nil)
+}
+func (self *Eth) GetFilterLogs() (result []api.LogRes, failure error) {
+ res, err := self.xeth.Call("eth_getFilterLogs", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ for _, item := range res.([]interface{}) {
+ result = append(result, item.(api.LogRes))
+ }
+ return
+}
+func (self *Eth) GetLogs() (result []api.LogRes, failure error) {
+ res, err := self.xeth.Call("eth_getLogs", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ for _, item := range res.([]interface{}) {
+ result = append(result, item.(api.LogRes))
+ }
+ return
+}
+func (self *Eth) GetStorage(address string, blockNumber int64) (result map[string]string, failure error) {
+ res, err := self.xeth.Call("eth_getStorage", []interface{}{address, blockNumber})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(map[string]string), nil
+}
+func (self *Eth) GetStorageAt(address string, blockNumber int64, key string) (result string, failure error) {
+ res, err := self.xeth.Call("eth_getStorageAt", []interface{}{address, blockNumber, key})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(string), nil
+}
+func (self *Eth) GetTransactionByBlockHashAndIndex() (interface{}, error) {
+ return self.xeth.Call("eth_getTransactionByBlockHashAndIndex", nil)
+}
+func (self *Eth) GetTransactionByBlockNumberAndIndex() (interface{}, error) {
+ return self.xeth.Call("eth_getTransactionByBlockNumberAndIndex", nil)
+}
+func (self *Eth) GetTransactionByHash() (interface{}, error) {
+ return self.xeth.Call("eth_getTransactionByHash", nil)
+}
+func (self *Eth) GetTransactionCount() (result int64, failure error) {
+ res, err := self.xeth.Call("eth_getTransactionCount", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return new(big.Int).SetBytes(common.FromHex(res.(string))).Int64(), nil
+}
+func (self *Eth) GetTransactionReceipt() (interface{}, error) {
+ return self.xeth.Call("eth_getTransactionReceipt", nil)
+}
+func (self *Eth) GetUncleByBlockHashAndIndex() (interface{}, error) {
+ return self.xeth.Call("eth_getUncleByBlockHashAndIndex", nil)
+}
+func (self *Eth) GetUncleByBlockNumberAndIndex() (interface{}, error) {
+ return self.xeth.Call("eth_getUncleByBlockNumberAndIndex", nil)
+}
+func (self *Eth) GetUncleCountByBlockHash() (result int64, failure error) {
+ res, err := self.xeth.Call("eth_getUncleCountByBlockHash", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return new(big.Int).SetBytes(common.FromHex(res.(string))).Int64(), nil
+}
+func (self *Eth) GetUncleCountByBlockNumber() (result int64, failure error) {
+ res, err := self.xeth.Call("eth_getUncleCountByBlockNumber", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return new(big.Int).SetBytes(common.FromHex(res.(string))).Int64(), nil
+}
+func (self *Eth) GetWork() (result [3]string, failure error) {
+ res, err := self.xeth.Call("eth_getWork", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.([3]string), nil
+}
+func (self *Eth) Hashrate() (result int64, failure error) {
+ res, err := self.xeth.Call("eth_hashrate", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return new(big.Int).SetBytes(common.FromHex(res.(string))).Int64(), nil
+}
+func (self *Eth) Mining() (result bool, failure error) {
+ res, err := self.xeth.Call("eth_mining", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Eth) NewBlockFilter() (result int64, failure error) {
+ res, err := self.xeth.Call("eth_newBlockFilter", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return new(big.Int).SetBytes(common.FromHex(res.(string))).Int64(), nil
+}
+func (self *Eth) NewFilter() (result int64, failure error) {
+ res, err := self.xeth.Call("eth_newFilter", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return new(big.Int).SetBytes(common.FromHex(res.(string))).Int64(), nil
+}
+func (self *Eth) NewPendingTransactionFilter() (result int64, failure error) {
+ res, err := self.xeth.Call("eth_newPendingTransactionFilter", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return new(big.Int).SetBytes(common.FromHex(res.(string))).Int64(), nil
+}
+func (self *Eth) PendingTransactions() (interface{}, error) {
+ return self.xeth.Call("eth_pendingTransactions", nil)
+}
+func (self *Eth) ProtocolVersion() (result string, failure error) {
+ res, err := self.xeth.Call("eth_protocolVersion", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(string), nil
+}
+func (self *Eth) SendRawTransaction() (interface{}, error) {
+ return self.xeth.Call("eth_sendRawTransaction", nil)
+}
+func (self *Eth) SendTransaction() (interface{}, error) {
+ return self.xeth.Call("eth_sendTransaction", nil)
+}
+func (self *Eth) Sign() (interface{}, error) {
+ return self.xeth.Call("eth_sign", nil)
+}
+func (self *Eth) StorageAt(address string, blockNumber int64) (result map[string]string, failure error) {
+ res, err := self.xeth.Call("eth_storageAt", []interface{}{address, blockNumber})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(map[string]string), nil
+}
+func (self *Eth) SubmitHashrate() (result bool, failure error) {
+ res, err := self.xeth.Call("eth_submitHashrate", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Eth) SubmitWork(nonce uint64, header string, digest string) (result bool, failure error) {
+ res, err := self.xeth.Call("eth_submitWork", []interface{}{nonce, header, digest})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Eth) Transact() (interface{}, error) {
+ return self.xeth.Call("eth_transact", nil)
+}
+func (self *Eth) UninstallFilter() (result bool, failure error) {
+ res, err := self.xeth.Call("eth_uninstallFilter", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+
+type Miner struct {
+ xeth *Xeth
+}
+
+func (self *Miner) Hashrate() (result int64, failure error) {
+ res, err := self.xeth.Call("miner_hashrate", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return new(big.Int).SetBytes(common.FromHex(res.(string))).Int64(), nil
+}
+func (self *Miner) MakeDAG(blockNumber int64) (result bool, failure error) {
+ res, err := self.xeth.Call("miner_makeDAG", []interface{}{blockNumber})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Miner) SetEtherbase(etherbase common.Address) (interface{}, error) {
+ return self.xeth.Call("miner_setEtherbase", []interface{}{etherbase})
+}
+func (self *Miner) SetExtra(data string) (result bool, failure error) {
+ res, err := self.xeth.Call("miner_setExtra", []interface{}{data})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Miner) SetGasPrice() (result bool, failure error) {
+ res, err := self.xeth.Call("miner_setGasPrice", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Miner) Start(threads int) (result bool, failure error) {
+ res, err := self.xeth.Call("miner_start", []interface{}{threads})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Miner) StartAutoDAG() (result bool, failure error) {
+ res, err := self.xeth.Call("miner_startAutoDAG", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Miner) Stop() (result bool, failure error) {
+ res, err := self.xeth.Call("miner_stop", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Miner) StopAutoDAG() (result bool, failure error) {
+ res, err := self.xeth.Call("miner_stopAutoDAG", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+
+type Net struct {
+ xeth *Xeth
+}
+
+func (self *Net) Listening() (result bool, failure error) {
+ res, err := self.xeth.Call("net_listening", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Net) PeerCount() (result int64, failure error) {
+ res, err := self.xeth.Call("net_peerCount", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return new(big.Int).SetBytes(common.FromHex(res.(string))).Int64(), nil
+}
+func (self *Net) Version() (result string, failure error) {
+ res, err := self.xeth.Call("net_version", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(string), nil
+}
+
+type Personal struct {
+ xeth *Xeth
+}
+
+func (self *Personal) ListAccounts() (result []string, failure error) {
+ res, err := self.xeth.Call("personal_listAccounts", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ for _, item := range res.([]interface{}) {
+ result = append(result, item.(string))
+ }
+ return
+}
+func (self *Personal) NewAccount(passphrase string) (result string, failure error) {
+ res, err := self.xeth.Call("personal_newAccount", []interface{}{passphrase})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(string), nil
+}
+func (self *Personal) UnlockAccount(address string, passphrase string, duration int) (result bool, failure error) {
+ res, err := self.xeth.Call("personal_unlockAccount", []interface{}{address, passphrase, duration})
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+
+type Shh struct {
+ xeth *Xeth
+}
+
+func (self *Shh) GetFilterChanges() (result []xeth.WhisperMessage, failure error) {
+ res, err := self.xeth.Call("shh_getFilterChanges", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ for _, item := range res.([]interface{}) {
+ result = append(result, item.(xeth.WhisperMessage))
+ }
+ return
+}
+func (self *Shh) GetMessages() (result []xeth.WhisperMessage, failure error) {
+ res, err := self.xeth.Call("shh_getMessages", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ for _, item := range res.([]interface{}) {
+ result = append(result, item.(xeth.WhisperMessage))
+ }
+ return
+}
+func (self *Shh) HasIdentity() (result bool, failure error) {
+ res, err := self.xeth.Call("shh_hasIdentity", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Shh) NewFilter() (result int64, failure error) {
+ res, err := self.xeth.Call("shh_newFilter", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return new(big.Int).SetBytes(common.FromHex(res.(string))).Int64(), nil
+}
+func (self *Shh) NewIdentity() (result string, failure error) {
+ res, err := self.xeth.Call("shh_newIdentity", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(string), nil
+}
+func (self *Shh) Post() (result bool, failure error) {
+ res, err := self.xeth.Call("shh_post", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Shh) UninstallFilter() (result bool, failure error) {
+ res, err := self.xeth.Call("shh_uninstallFilter", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(bool), nil
+}
+func (self *Shh) Version() (result uint, failure error) {
+ res, err := self.xeth.Call("shh_version", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(uint), nil
+}
+
+type Txpool struct {
+ xeth *Xeth
+}
+
+func (self *Txpool) Status() (interface{}, error) {
+ return self.xeth.Call("txpool_status", nil)
+}
+
+type Web3 struct {
+ xeth *Xeth
+}
+
+func (self *Web3) ClientVersion() (result string, failure error) {
+ res, err := self.xeth.Call("web3_clientVersion", nil)
+ if err != nil {
+ failure = err
+ return
+ }
+ return res.(string), nil
+}
+func (self *Web3) Sha3(data string) (interface{}, error) {
+ return self.xeth.Call("web3_sha3", []interface{}{data})
+}
diff --git a/rpc/generator/generator.go b/rpc/generator/generator.go
new file mode 100644
index 0000000000..54be566b6b
--- /dev/null
+++ b/rpc/generator/generator.go
@@ -0,0 +1,391 @@
+// Copyright 2015 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
+
+// This is the Go API auto-generator for the RPC APIs.
+package main //build !none
+
+//go:generate go run generator.go
+
+import (
+ "encoding/json"
+ "fmt"
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "io/ioutil"
+ "log"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "reflect"
+ "regexp"
+ "sort"
+ "strings"
+ "unicode"
+
+ "golang.org/x/tools/go/loader"
+ "golang.org/x/tools/go/types"
+ "golang.org/x/tools/imports"
+)
+
+// Package description from the go list command
+type Package struct {
+ Name string
+ Dir string
+ GoFiles []string
+}
+
+type Endpoint struct {
+ Method string
+ Function string
+ Params []string
+ Return string
+}
+
+func main() {
+ // Load the entire package and dependencies for static analysis
+ conf := new(loader.Config)
+ conf.Import("github.com/ethereum/go-ethereum/rpc/api")
+
+ prog, err := conf.Load()
+ if err != nil {
+ log.Fatalf("Failed to load API package: %v", err)
+ }
+ info := prog.Imported["github.com/ethereum/go-ethereum/rpc/api"].Info
+
+ // Iterate over all the API files and collect the top level declarations
+ api, err := details("github.com/ethereum/go-ethereum/rpc/api")
+ if err != nil {
+ log.Fatalf("Failed to retrieve API package details: %v", err)
+ }
+ funs, types, values, err := declarations(api)
+ if err != nil {
+ log.Fatalf("Failed to collect API declarations: %v", err)
+ }
+ // Gather all the deteced API endpoints
+ methods, err := endpoints(info, funs, types, values)
+ if err != nil {
+ log.Fatalf("Failed to gather API endpoints: %v", err)
+ }
+ // Generate the client API and output if successfull
+ if code, err := generate(methods); err != nil {
+ log.Fatalf("Failed to format output code: %v", err)
+ } else if err := ioutil.WriteFile("../genapi.go", code, 0600); err != nil {
+ log.Fatalf("Failed to write output code: %v", err)
+ }
+}
+
+// details loads the metadata of the Go package.
+func details(name string) (*Package, error) {
+ // Create the command to retrieve the package infos
+ cmd := exec.Command("go", "list", "-e", "-json", name)
+
+ // Retrieve the output, redirect the errors
+ out, err := cmd.StdoutPipe()
+ if err != nil {
+ return nil, err
+ }
+ cmd.Stderr = os.Stderr
+
+ // Start executing and parse the results
+ if err := cmd.Start(); err != nil {
+ return nil, err
+ }
+ defer cmd.Process.Kill()
+
+ info := new(Package)
+ if err := json.NewDecoder(out).Decode(&info); err != nil {
+ return nil, err
+ }
+ // Clean up and return
+ if err := cmd.Wait(); err != nil {
+ return nil, err
+ }
+ return info, nil
+}
+
+// declarations iterates over a package contents and collects type and value declarations.
+func declarations(pack *Package) (map[string]*ast.BlockStmt, map[string]*ast.TypeSpec, map[string]ast.Expr, error) {
+ funs := make(map[string]*ast.BlockStmt)
+ types := make(map[string]*ast.TypeSpec)
+ values := make(map[string]ast.Expr)
+
+ for _, path := range pack.GoFiles {
+ // Parse the specified source file
+ fileSet := token.NewFileSet()
+ tree, err := parser.ParseFile(fileSet, filepath.Join(pack.Dir, path), nil, parser.ParseComments)
+ if err != nil {
+ return nil, nil, nil, err
+ }
+ // Collect all top level declarations
+ for _, decl := range tree.Decls {
+ switch decl := decl.(type) {
+ case *ast.FuncDecl:
+ if decl.Recv != nil {
+ recv := decl.Recv.List[0].Type.(*ast.StarExpr).X.(*ast.Ident).String()
+ call := decl.Name.String()
+ funs[recv+"."+call] = decl.Body
+ }
+ case *ast.GenDecl:
+ for _, spec := range decl.Specs {
+ switch spec := spec.(type) {
+ case *ast.ValueSpec:
+ for i, name := range spec.Names {
+ values[name.String()] = spec.Values[i]
+ }
+ case *ast.TypeSpec:
+ types[spec.Name.String()] = spec
+ }
+ }
+ }
+ }
+ }
+ return funs, types, values, nil
+}
+
+// returns recursively iterates over a block statement and extracts all the
+// return statements that contain nil errors.
+func returns(block *ast.BlockStmt) []*ast.ReturnStmt {
+ results := []*ast.ReturnStmt{}
+
+ for _, stmt := range block.List {
+ switch stmt := stmt.(type) {
+ case *ast.ReturnStmt:
+ if ident, ok := stmt.Results[1].(*ast.Ident); ok {
+ if ident.String() == "nil" {
+ results = append(results, stmt)
+ }
+ }
+ case *ast.IfStmt:
+ results = append(results, returns(stmt.Body)...)
+ }
+ }
+ return results
+}
+
+// flatten converts a possibly multi selextor expression into a string identifier.
+func flatten(sel ast.Expr) string {
+ switch x := sel.(type) {
+ case *ast.Ident:
+ return x.String()
+ case *ast.SelectorExpr:
+ return flatten(x.X) + "." + x.Sel.String()
+ case *ast.CallExpr:
+ return flatten(x.Fun) + "()"
+ default:
+ //fmt.Println("unknown selector to flatten", reflect.TypeOf(sel.X))
+ }
+ return ""
+}
+
+// endpoints collects the detected RPC API method endpoints.
+func endpoints(info types.Info, funs map[string]*ast.BlockStmt, typeDecls map[string]*ast.TypeSpec, values map[string]ast.Expr) (map[string][]*Endpoint, error) {
+ methods := make(map[string][]*Endpoint)
+
+ // Iterate over all the API mappings, and locate the RPC function associations
+ for variable, val := range values {
+ if strings.HasSuffix(variable, "Mapping") {
+ // Iterate over all the exposed functionality and extract them
+ for _, mapping := range val.(*ast.CompositeLit).Elts {
+ // Fetch the name of the RPC function, and the associated argument definition
+ call := strings.Trim(mapping.(*ast.KeyValueExpr).Key.(*ast.BasicLit).Value, "\"")
+ impl := mapping.(*ast.KeyValueExpr).Value.(*ast.SelectorExpr)
+ args := mapping.(*ast.KeyValueExpr).Value.(*ast.SelectorExpr).Sel.Name + "Args"
+
+ // Generate the submodule and function names
+ module := strings.Split(call, "_")[0]
+ module = string(unicode.ToUpper(rune(module[0]))) + module[1:]
+ function := strings.Split(call, "_")[1]
+ function = string(unicode.ToUpper(rune(function[0]))) + function[1:]
+
+ // Generate the parameter list
+ params, paramList := []string{}, []string{}
+ if arg := typeDecls[args]; arg != nil {
+ for _, field := range arg.Type.(*ast.StructType).Fields.List {
+ variable := field.Names[0].String()
+ variable = string(unicode.ToLower(rune(variable[0]))) + variable[1:]
+
+ kind := ""
+ switch t := field.Type.(type) {
+ case *ast.Ident:
+ kind = t.String()
+ case *ast.SelectorExpr:
+ kind = t.X.(*ast.Ident).String() + "." + t.Sel.String()
+ case *ast.StarExpr:
+ switch sub := t.X.(type) {
+ case *ast.Ident:
+ kind = "*" + sub.String()
+ case *ast.SelectorExpr:
+ kind = "*" + sub.X.(*ast.Ident).String() + "." + sub.Sel.String()
+ default:
+ return nil, fmt.Errorf("Unknown pointer subtype: %v", sub)
+ }
+ default:
+ return nil, fmt.Errorf("Unknown type: %v", t)
+ }
+ params = append(params, fmt.Sprintf("%s %s", variable, kind))
+ paramList = append(paramList, variable)
+ }
+ }
+ // Try to detect and generate the return type
+ owner := impl.X.(*ast.ParenExpr).X.(*ast.StarExpr).X.(*ast.Ident).String()
+ method := mapping.(*ast.KeyValueExpr).Value.(*ast.SelectorExpr).Sel.String()
+ rets := returns(funs[owner+"."+method])
+
+ result := "interface{}"
+ for _, ret := range rets {
+ switch res := ret.Results[0].(type) {
+ case *ast.Ident:
+ if res.String() == "nil" {
+ break
+ } else if res.String() == "true" || res.String() == "false" {
+ result = "bool"
+ } else {
+ fmt.Println(owner, method, res, "unknown ident")
+ }
+ case *ast.CallExpr:
+ if ident, ok := res.Fun.(*ast.Ident); ok {
+ if ident.String() == "string" {
+ result = "string"
+ } else if ident.String() == "newHexNum" {
+ result = "int64"
+ } else if ident.String() == "newHexData" {
+ result = "[]byte"
+ } else {
+ for match, def := range info.Defs {
+ if ident.String() == match.String() {
+ result = def.Type().(*types.Signature).Results().At(0).Type().String()
+ if strings.Contains(result, "/") {
+ result = regexp.MustCompile("[a-zA-Z0-9-\\.]+/").ReplaceAllString(result, "")
+ }
+ }
+ }
+ if result == "interface{}" {
+ fmt.Println(owner, method, res, "unknown ident funcion")
+ }
+ }
+ } else if sel, ok := res.Fun.(*ast.SelectorExpr); ok {
+ if selector := flatten(sel); selector != "" {
+ for match, selection := range info.Selections {
+ if flatten(match) == selector {
+ result = selection.Type().(*types.Signature).Results().At(0).Type().String()
+ if strings.Contains(result, "/") {
+ result = regexp.MustCompile("[a-zA-Z0-9-\\.]+/").ReplaceAllString(result, "")
+ }
+ }
+ }
+ }
+ } else {
+ fmt.Println(owner, method, res, "call", res.Fun, reflect.TypeOf(res.Fun))
+ }
+ default:
+ fmt.Println(owner, method, res, reflect.TypeOf(ret.Results[0]))
+ }
+ }
+ // Insert the function to the submodule collection (alphabetically)
+ methods[module] = append(methods[module], &Endpoint{
+ Method: call,
+ Function: fmt.Sprintf("%s(%s)", function, strings.Join(params, ",")),
+ Params: paramList,
+ Return: result,
+ })
+ }
+ }
+ }
+ return methods, nil
+}
+
+// generate creates the client code belonging to a set of API method endpoints.
+func generate(methods map[string][]*Endpoint) ([]byte, error) {
+ // Create a sorted list of API modules and endpoints to generate
+ modules := make([]string, 0, len(methods))
+ for module, _ := range methods {
+ modules = append(modules, module)
+ }
+ sort.Strings(modules)
+
+ for _, module := range modules {
+ for i := 0; i < len(methods[module]); i++ {
+ for j := i + 1; j < len(methods[module]); j++ {
+ if methods[module][i].Function > methods[module][j].Function {
+ methods[module][i], methods[module][j] = methods[module][j], methods[module][i]
+ }
+ }
+ }
+ }
+ // Start generating the client API
+ client := "package rpc\n"
+
+ // Generate the client struct with all its submodules
+ client += fmt.Sprintf("type GenApi struct {\n")
+ for _, module := range modules {
+ client += fmt.Sprintf("%s *%s\n", module, module)
+ }
+ client += fmt.Sprintf("}\n")
+
+ // Generate the API constructor to create the individual submodules
+ client += fmt.Sprint("func NewGenApi(client comms.EthereumClient) *GenApi {\n")
+ client += fmt.Sprint("xeth := NewXeth(client)\n\n")
+ client += fmt.Sprint("return &GenApi{\n")
+ for _, module := range modules {
+ client += fmt.Sprintf("%s: &%s{xeth},\n", module, module)
+ }
+ client += fmt.Sprintf("}}\n")
+
+ // Generate each of the client API calls
+ for _, module := range modules {
+ endpoints := methods[module]
+
+ client += fmt.Sprintf("\ntype %s struct {\n xeth *Xeth\n}\n", module)
+ for _, endpoint := range endpoints {
+ // Generate the header (only add variables if conversions are required)
+ if endpoint.Return == "interface{}" {
+ client += fmt.Sprintf("func (self *%s) %s (interface{}, error) {\n", module, endpoint.Function)
+ } else {
+ client += fmt.Sprintf("func (self *%s) %s (result %s, failure error) {\n", module, endpoint.Function, endpoint.Return)
+ }
+ // Generate the actual function invocation (straight return if no return type is known)
+ invocation := fmt.Sprintf("self.xeth.Call(\"%s\", nil)", endpoint.Method)
+ if len(endpoint.Params) > 0 {
+ invocation = fmt.Sprintf("self.xeth.Call(\"%s\", []interface{}{%s})", endpoint.Method, strings.Join(endpoint.Params, ","))
+ }
+ if endpoint.Return == "interface{}" {
+ client += fmt.Sprintf("return %s\n", invocation)
+ } else {
+ client += fmt.Sprintf("res, err := %s\n", invocation)
+ }
+ // If conversions are needed, check for errors and post process
+ if endpoint.Return != "interface{}" {
+ client += fmt.Sprintf("if err != nil { failure = err; return; }\n")
+
+ if endpoint.Return == "int64" {
+ client += fmt.Sprintf("return new(big.Int).SetBytes(common.FromHex(res.(string))).Int64(), nil\n")
+ } else if endpoint.Return == "*big.Int" {
+ client += fmt.Sprintf("return new(big.Int).SetBytes(common.FromHex(res.(string))), nil\n")
+ } else if endpoint.Return == "[]byte" {
+ client += fmt.Sprintf("return res.([]byte), nil\n")
+ } else if strings.HasPrefix(endpoint.Return, "[]") {
+ client += fmt.Sprintf("for _, item := range res.([]interface{}) { result = append(result, item.(%s))}; return\n", endpoint.Return[2:])
+ } else {
+ client += fmt.Sprintf("return res.(%s), nil\n", endpoint.Return)
+ }
+ }
+ client += fmt.Sprintf("}\n")
+ }
+ }
+ // Format the final code and return
+ return imports.Process("", []byte(client), nil)
+}
diff --git a/rpc/xeth.go b/rpc/xeth.go
index 9527a96c00..25a4d98fd8 100644
--- a/rpc/xeth.go
+++ b/rpc/xeth.go
@@ -41,7 +41,7 @@ func NewXeth(client comms.EthereumClient) *Xeth {
}
// Call invokes a method with the given parameters are the remote node.
-func (self *Xeth) Call(method string, params []interface{}) (map[string]interface{}, error) {
+func (self *Xeth) Call(method string, params []interface{}) (interface{}, error) {
// Assemble the json RPC request
data, err := json.Marshal(params)
if err != nil {
@@ -69,7 +69,7 @@ func (self *Xeth) Call(method string, params []interface{}) (map[string]interfac
return nil, fmt.Errorf("Method invocation failed: %v", failure.Error)
case isSuccessResponse:
- return success.Result.(map[string]interface{}), nil
+ return success.Result, nil
default:
return nil, fmt.Errorf("Invalid response type: %v", reflect.TypeOf(res))