diff --git a/.golangci.toml b/.golangci.toml index 4efef0a6..0bcadea5 100644 --- a/.golangci.toml +++ b/.golangci.toml @@ -38,6 +38,9 @@ "gocognit", "stylecheck", "gomnd", + "testpackage", + "goerr113", + "nestif", ] [issues] diff --git a/.travis.yml b/.travis.yml index a8bb30b2..03f2f935 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,6 @@ matrix: env: global: - GO111MODULE=on - - CI=1 go_import_path: github.com/containous/yaegi diff --git a/cmd/goexports/goexports.go b/cmd/goexports/goexports.go index a36b03e1..ae50c49d 100644 --- a/cmd/goexports/goexports.go +++ b/cmd/goexports/goexports.go @@ -98,18 +98,18 @@ func init() { {{end}} ` -// Val store the value name and addressable status of symbols +// Val store the value name and addressable status of symbols. type Val struct { Name string // "package.name" Addr bool // true if symbol is a Var } -// Method store information for generating interface wrapper method +// Method store information for generating interface wrapper method. type Method struct { Name, Param, Result, Arg, Ret string } -// Wrap store information for generating interface wrapper +// Wrap store information for generating interface wrapper. type Wrap struct { Name string Method []Method @@ -253,7 +253,7 @@ func genContent(dest, pkgName, license string) ([]byte, error) { return source, nil } -// fixConst checks untyped constant value, converting it if necessary to avoid overflow +// fixConst checks untyped constant value, converting it if necessary to avoid overflow. func fixConst(name string, val constant.Value, imports map[string]bool) string { var ( tok string diff --git a/internal/genop/genop.go b/internal/genop/genop.go index 0228e38c..111d963f 100644 --- a/internal/genop/genop.go +++ b/internal/genop/genop.go @@ -840,7 +840,7 @@ func {{$name}}(n *node) { {{end}} ` -// Op define operator name and properties +// Op define operator name and properties. type Op struct { Name string // +, -, ... Str bool // true if operator applies to string diff --git a/interp/ast.go b/interp/ast.go index 8c0261f6..c75ce15a 100644 --- a/interp/ast.go +++ b/interp/ast.go @@ -12,10 +12,10 @@ import ( "sync/atomic" ) -// nkind defines the kind of AST, i.e. the grammar category +// nkind defines the kind of AST, i.e. the grammar category. type nkind uint -// Node kinds for the go language +// Node kinds for the go language. const ( undefNode nkind = iota addressExpr @@ -179,13 +179,13 @@ func (k nkind) String() string { return "nKind(" + strconv.Itoa(int(k)) + ")" } -// astError represents an error during AST build stage +// astError represents an error during AST build stage. type astError error -// action defines the node action to perform at execution +// action defines the node action to perform at execution. type action uint -// Node actions for the go language +// Node actions for the go language. const ( aNop action = iota aAddr @@ -870,7 +870,7 @@ func (s *nodestack) top() astNode { return astNode{} } -// dup returns a duplicated node subtree +// dup returns a duplicated node subtree. func (interp *Interpreter) dup(nod, anc *node) *node { nindex := atomic.AddInt64(&interp.nindex, 1) n := *nod diff --git a/interp/build.go b/interp/build.go index 4384e69b..17b83756 100644 --- a/interp/build.go +++ b/interp/build.go @@ -31,7 +31,7 @@ func (interp *Interpreter) buildOk(ctx *build.Context, name, src string) (bool, } // buildLineOk returns true if line is not a build constraint or -// if build constraint is satisfied +// if build constraint is satisfied. func buildLineOk(ctx *build.Context, line string) (ok bool) { if len(line) < 7 || line[:7] != "+build " { return true @@ -46,7 +46,7 @@ func buildLineOk(ctx *build.Context, line string) (ok bool) { return ok } -// buildOptionOk return true if all comma separated tags match, false otherwise +// buildOptionOk return true if all comma separated tags match, false otherwise. func buildOptionOk(ctx *build.Context, tag string) bool { // in option, evaluate the AND of individual tags for _, t := range strings.Split(tag, ",") { @@ -58,7 +58,7 @@ func buildOptionOk(ctx *build.Context, tag string) bool { } // buildTagOk returns true if a build tag matches, false otherwise -// if first character is !, result is negated +// if first character is !, result is negated. func buildTagOk(ctx *build.Context, s string) (r bool) { not := s[0] == '!' if not { @@ -112,7 +112,7 @@ func contains(tags []string, tag string) bool { return false } -// goMinorVersion returns the go minor version number +// goMinorVersion returns the go minor version number. func goMinorVersion(ctx *build.Context) int { current := ctx.ReleaseTags[len(ctx.ReleaseTags)-1] @@ -128,7 +128,7 @@ func goMinorVersion(ctx *build.Context) int { return m } -// skipFile returns true if file should be skipped +// skipFile returns true if file should be skipped. func skipFile(ctx *build.Context, p string) bool { if !strings.HasSuffix(p, ".go") { return true diff --git a/interp/cfg.go b/interp/cfg.go index 66c6c4bb..304b9696 100644 --- a/interp/cfg.go +++ b/interp/cfg.go @@ -11,7 +11,7 @@ import ( "unicode" ) -// A cfgError represents an error during CFG build stage +// A cfgError represents an error during CFG build stage. type cfgError struct { *node error @@ -48,7 +48,7 @@ var identifier = regexp.MustCompile(`([\pL_][\pL_\d]*)$`) // cfg generates a control flow graph (CFG) from AST (wiring successors in AST) // and pre-compute frame sizes and indexes for all un-named (temporary) and named // variables. A list of nodes of init functions is returned. -// Following this pass, the CFG is ready to run +// Following this pass, the CFG is ready to run. func (interp *Interpreter) cfg(root *node, pkgID string) ([]*node, error) { sc := interp.initScopePkg(pkgID) var initNodes []*node @@ -1889,7 +1889,7 @@ func getDefault(n *node) int { func isBinType(v reflect.Value) bool { return v.IsValid() && v.Kind() == reflect.Ptr && v.IsNil() } -// isType returns true if node refers to a type definition, false otherwise +// isType returns true if node refers to a type definition, false otherwise. func (n *node) isType(sc *scope) bool { switch n.kind { case arrayType, chanType, funcType, interfaceType, mapType, structType: @@ -1915,7 +1915,7 @@ func (n *node) isType(sc *scope) bool { return false } -// wireChild wires AST nodes for CFG in subtree +// wireChild wires AST nodes for CFG in subtree. func wireChild(n *node) { // Set start node, in subtree (propagated to ancestors by post-order processing) for _, child := range n.child { @@ -1967,7 +1967,7 @@ func (n *node) name() (s string) { return s } -// isInteger returns true if node type is integer, false otherwise +// isInteger returns true if node type is integer, false otherwise. func (n *node) isInteger() bool { if isInt(n.typ.TypeOf()) { return true @@ -2004,7 +2004,7 @@ func (n *node) isInteger() bool { return false } -// isNatural returns true if node type is natural, false otherwise +// isNatural returns true if node type is natural, false otherwise. func (n *node) isNatural() bool { if isUint(n.typ.TypeOf()) { return true @@ -2048,10 +2048,10 @@ func (n *node) isNatural() bool { return false } -// isNil returns true if node is a literal nil value, false otherwise +// isNil returns true if node is a literal nil value, false otherwise. func (n *node) isNil() bool { return n.kind == basicLit && !n.rval.IsValid() } -// fieldType returns the nth parameter field node (type) of a fieldList node +// fieldType returns the nth parameter field node (type) of a fieldList node. func (n *node) fieldType(m int) *node { k := 0 l := len(n.child) @@ -2074,7 +2074,7 @@ func (n *node) fieldType(m int) *node { return nil } -// lastChild returns the last child of a node +// lastChild returns the last child of a node. func (n *node) lastChild() *node { return n.child[len(n.child)-1] } func isKey(n *node) bool { @@ -2093,7 +2093,7 @@ func isRecursiveField(n *node) bool { return isField(n) && (n.typ.recursive || n.typ.cat == ptrT && n.typ.val.recursive) } -// isNewDefine returns true if node refers to a new definition +// isNewDefine returns true if node refers to a new definition. func isNewDefine(n *node, sc *scope) bool { if n.ident == "_" { return true @@ -2285,7 +2285,7 @@ func arrayTypeLen(n *node) int { return max + 1 } -// isValueUntyped returns true if value is untyped +// isValueUntyped returns true if value is untyped. func isValueUntyped(v reflect.Value) bool { // Consider only constant values. if v.CanSet() { diff --git a/interp/dot.go b/interp/dot.go index f6836351..3e90b3c7 100644 --- a/interp/dot.go +++ b/interp/dot.go @@ -10,7 +10,7 @@ import ( "strings" ) -// astDot displays an AST in graphviz dot(1) format using dotty(1) co-process +// astDot displays an AST in graphviz dot(1) format using dotty(1) co-process. func (n *node) astDot(out io.Writer, name string) { fmt.Fprintf(out, "digraph ast {\n") fmt.Fprintf(out, "labelloc=\"t\"\n") @@ -36,7 +36,7 @@ func (n *node) astDot(out io.Writer, name string) { fmt.Fprintf(out, "}\n") } -// cfgDot displays a CFG in graphviz dot(1) format using dotty(1) co-process +// cfgDot displays a CFG in graphviz dot(1) format using dotty(1) co-process. func (n *node) cfgDot(out io.Writer) { fmt.Fprintf(out, "digraph cfg {\n") n.Walk(nil, func(n *node) { @@ -66,7 +66,7 @@ type nopCloser struct { func (nopCloser) Close() error { return nil } -// dotWriter returns an output stream to a dot(1) co-process where to write data in .dot format +// dotWriter returns an output stream to a dot(1) co-process where to write data in .dot format. func dotWriter(dotCmd string) io.WriteCloser { if dotCmd == "" { return nopCloser{ioutil.Discard} diff --git a/interp/example_eval_test.go b/interp/example_eval_test.go index e28c3c62..b19dc600 100644 --- a/interp/example_eval_test.go +++ b/interp/example_eval_test.go @@ -7,7 +7,7 @@ import ( "github.com/containous/yaegi/interp" ) -// Generic example +// Generic example. func Example_eval() { // Create a new interpreter context i := interp.New(interp.Options{}) diff --git a/interp/interp.go b/interp/interp.go index 52380a6c..928c30e3 100644 --- a/interp/interp.go +++ b/interp/interp.go @@ -18,7 +18,7 @@ import ( "sync/atomic" ) -// Interpreter node structure for AST and CFG +// Interpreter node structure for AST and CFG. type node struct { child []*node // child subtrees (AST) anc *node // ancestor (AST) @@ -46,14 +46,14 @@ type node struct { ident string // set if node is a var or func } -// receiver stores method receiver object access path +// receiver stores method receiver object access path. type receiver struct { node *node // receiver value for alias and struct types val reflect.Value // receiver value for interface type and value type index []int // path in receiver value for interface or value type } -// frame contains values for the current execution level (a function context) +// frame contains values for the current execution level (a function context). type frame struct { // id is an atomic counter used for cancellation, only access // via newFrame/runid/setrunid/clone. @@ -96,16 +96,16 @@ func (f *frame) clone() *frame { } } -// convertFn is the signature of a symbol converter +// convertFn is the signature of a symbol converter. type convertFn func(from, to reflect.Type) func(src, dest reflect.Value) -// Exports stores the map of binary packages per package path +// Exports stores the map of binary packages per package path. type Exports map[string]map[string]reflect.Value -// imports stores the map of source packages per package path +// imports stores the map of source packages per package path. type imports map[string]map[string]*symbol -// opt stores interpreter options +// opt stores interpreter options. type opt struct { astDot bool // display AST graph (debug) cfgDot bool // display CFG graph (debug) @@ -117,7 +117,7 @@ type opt struct { context build.Context // build context: GOPATH, build constraints } -// Interpreter contains global resources and state +// Interpreter contains global resources and state. type Interpreter struct { // id is an atomic counter counter used for run cancellation, // only accessed via runid/stop @@ -150,7 +150,7 @@ const ( selfPath = "github.com/containous/yaegi/interp" ) -// Symbols exposes interpreter values +// Symbols exposes interpreter values. var Symbols = Exports{ selfPath: map[string]reflect.Value{ "New": reflect.ValueOf(New), @@ -162,7 +162,7 @@ var Symbols = Exports{ func init() { Symbols[selfPath]["Symbols"] = reflect.ValueOf(Symbols) } -// _error is a wrapper of error interface type +// _error is a wrapper of error interface type. type _error struct { WError func() string } @@ -209,7 +209,7 @@ type Options struct { BuildTags []string } -// New returns a new interpreter +// New returns a new interpreter. func New(options Options) *Interpreter { i := Interpreter{ opt: opt{context: build.Default}, @@ -300,7 +300,7 @@ func initUniverse() *scope { return sc } -// resizeFrame resizes the global frame of interpreter +// resizeFrame resizes the global frame of interpreter. func (interp *Interpreter) resizeFrame() { l := len(interp.universe.types) b := len(interp.frame.data) @@ -325,7 +325,7 @@ func (interp *Interpreter) main() *node { } // Eval evaluates Go code represented as a string. It returns a map on -// current interpreted package exported symbols +// current interpreted package exported symbols. func (interp *Interpreter) Eval(src string) (res reflect.Value, err error) { defer func() { r := recover() @@ -459,7 +459,7 @@ func (interp *Interpreter) stop() { func (interp *Interpreter) runid() uint64 { return atomic.LoadUint64(&interp.id) } -// getWrapper returns the wrapper type of the corresponding interface, or nil if not found +// getWrapper returns the wrapper type of the corresponding interface, or nil if not found. func (interp *Interpreter) getWrapper(t reflect.Type) reflect.Type { if p, ok := interp.binPkg[t.PkgPath()]; ok { return p["_"+t.Name()].Type().Elem() @@ -468,7 +468,7 @@ func (interp *Interpreter) getWrapper(t reflect.Type) reflect.Type { } // Use loads binary runtime symbols in the interpreter context so -// they can be used in interpreted code +// they can be used in interpreted code. func (interp *Interpreter) Use(values Exports) { for k, v := range values { if k != "github.com/containous/yaegi" { @@ -546,7 +546,7 @@ func (interp *Interpreter) REPL(in io.Reader, out io.Writer) { // Repl performs a Read-Eval-Print-Loop on input file descriptor. // Results are printed on output. -// Deprecated: use REPL instead +// Deprecated: use REPL instead. func (interp *Interpreter) Repl(in, out *os.File) { interp.REPL(in, out) } diff --git a/interp/interp_eval_test.go b/interp/interp_eval_test.go index e88329ba..cee64ae6 100644 --- a/interp/interp_eval_test.go +++ b/interp/interp_eval_test.go @@ -483,7 +483,7 @@ func TestEvalWithContext(t *testing.T) { // Successful cancellation. // Check we can still execute an expression. - v, err := i.EvalWithContext(context.Background(), "1+1\n") //nolint:govet + v, err := i.EvalWithContext(context.Background(), "1+1\n") if err != nil { t.Errorf("failed to evaluate expression after cancellation: %v", err) } diff --git a/interp/run.go b/interp/run.go index 5f053e9f..667136df 100644 --- a/interp/run.go +++ b/interp/run.go @@ -9,10 +9,10 @@ import ( "reflect" ) -// bltn type defines functions which run at CFG execution +// bltn type defines functions which run at CFG execution. type bltn func(f *frame) bltn -// bltnGenerator type defines a builtin generator function +// bltnGenerator type defines a builtin generator function. type bltnGenerator func(n *node) var builtin = [...]bltnGenerator{ @@ -99,9 +99,9 @@ func (interp *Interpreter) run(n *node, cf *frame) { runCfg(n.start, f) } -// Functions set to run during execution of CFG +// Functions set to run during execution of CFG. -// runCfg executes a node AST by walking its CFG and running node builtin at each step +// runCfg executes a node AST by walking its CFG and running node builtin at each step. func runCfg(n *node, f *frame) { defer func() { f.mutex.Lock() @@ -961,7 +961,7 @@ func call(n *node) { } } -// pindex returns definition parameter index for function call +// pindex returns definition parameter index for function call. func pindex(i, variadic int) int { if variadic < 0 || i <= variadic { return i @@ -1164,7 +1164,7 @@ func getIndexBinPtrMethod(n *node) { } } -// getIndexArray returns array value from index +// getIndexArray returns array value from index. func getIndexArray(n *node) { tnext := getExec(n.tnext) value0 := genValueArray(n.child[0]) // array @@ -1210,10 +1210,10 @@ func getIndexArray(n *node) { } } -// valueInterfaceType is the reflection type of valueInterface +// valueInterfaceType is the reflection type of valueInterface. var valueInterfaceType = reflect.TypeOf((*valueInterface)(nil)).Elem() -// getIndexMap retrieves map value from index +// getIndexMap retrieves map value from index. func getIndexMap(n *node) { dest := genValue(n) value0 := genValue(n.child[0]) // map @@ -1300,7 +1300,7 @@ func getIndexMap(n *node) { } } -// getIndexMap2 retrieves map value from index and set status +// getIndexMap2 retrieves map value from index and set status. func getIndexMap2(n *node) { dest := genValue(n.anc.child[0]) // result value0 := genValue(n.child[0]) // map @@ -1884,7 +1884,7 @@ func compositeBinMap(n *node) { } } -// compositeBinStruct creates and populates a struct object from a binary type +// compositeBinStruct creates and populates a struct object from a binary type. func compositeBinStruct(n *node) { next := getExec(n.tnext) value := valueGenerator(n, n.findex) @@ -1933,7 +1933,7 @@ func destType(n *node) *itype { } } -// doCompositeLit creates and populates a struct object +// doCompositeLit creates and populates a struct object. func doCompositeLit(n *node, hasType bool) { value := valueGenerator(n, n.findex) next := getExec(n.tnext) @@ -1974,7 +1974,7 @@ func doCompositeLit(n *node, hasType bool) { func compositeLit(n *node) { doCompositeLit(n, true) } func compositeLitNotype(n *node) { doCompositeLit(n, false) } -// doCompositeSparse creates a struct Object, filling fields from sparse key-values +// doCompositeSparse creates a struct Object, filling fields from sparse key-values. func doCompositeSparse(n *node, hasType bool) { value := valueGenerator(n, n.findex) next := getExec(n.tnext) @@ -2539,7 +2539,7 @@ func reset(n *node) { } } -// recv reads from a channel +// recv reads from a channel. func recv(n *node) { value := genValue(n.child[0]) tnext := getExec(n.tnext) @@ -2856,7 +2856,7 @@ func convertConstantValueTo(n *node, typ reflect.Type) { n.rval = v } -// Write to a channel +// Write to a channel. func send(n *node) { next := getExec(n.tnext) value0 := genValue(n.child[0]) // channel @@ -2990,7 +2990,7 @@ func _select(n *node) { } } -// slice expression: array[low:high:max] +// slice expression: array[low:high:max]. func slice(n *node) { i := n.findex next := getExec(n.tnext) @@ -3024,7 +3024,7 @@ func slice(n *node) { } } -// slice expression, no low value: array[:high:max] +// slice expression, no low value: array[:high:max]. func slice0(n *node) { i := n.findex next := getExec(n.tnext) diff --git a/interp/scope.go b/interp/scope.go index 3f275e09..7bc8d22e 100644 --- a/interp/scope.go +++ b/interp/scope.go @@ -6,10 +6,10 @@ import ( "strconv" ) -// A sKind represents the kind of symbol +// A sKind represents the kind of symbol. type sKind uint -// Symbol kinds for the Go interpreter +// Symbol kinds for the Go interpreter. const ( undefSym sKind = iota binSym // Binary from runtime @@ -86,7 +86,7 @@ type scope struct { iota int // iota value in this scope } -// push creates a new scope and chain it to the current one +// push creates a new scope and chain it to the current one. func (s *scope) push(indirect bool) *scope { sc := scope{anc: s, level: s.level, sym: map[string]*symbol{}} if indirect { @@ -117,7 +117,7 @@ func (s *scope) pop() *scope { // lookup searches for a symbol in the current scope, and upper ones if not found // it returns the symbol, the number of indirections level from the current scope -// and status (false if no result) +// and status (false if no result). func (s *scope) lookup(ident string) (*symbol, int, bool) { level := s.level for { @@ -163,7 +163,7 @@ func (s *scope) getType(ident string) *itype { return t } -// add adds a type to the scope types array, and returns its index +// add adds a type to the scope types array, and returns its index. func (s *scope) add(typ *itype) (index int) { if typ == nil { log.Panic("nil type") diff --git a/interp/src.go b/interp/src.go index 42368dd6..0fb11386 100644 --- a/interp/src.go +++ b/interp/src.go @@ -161,7 +161,7 @@ func pkgDir(goPath string, root, path string) (string, string, error) { return pkgDir(goPath, previousRoot(root), path) } -// Find the previous source root. (vendor > vendor > ... > GOPATH) +// Find the previous source root (vendor > vendor > ... > GOPATH). func previousRoot(root string) string { splitRoot := strings.Split(root, string(filepath.Separator)) @@ -208,7 +208,7 @@ func effectivePkg(root, path string) string { return filepath.Join(root, frag) } -// isPathRelative returns true if path starts with "./" or "../" +// isPathRelative returns true if path starts with "./" or "../". func isPathRelative(s string) bool { p := "." + string(filepath.Separator) return strings.HasPrefix(s, p) || strings.HasPrefix(s, "."+p) diff --git a/interp/type.go b/interp/type.go index 1d76bc27..c8f4a9e7 100644 --- a/interp/type.go +++ b/interp/type.go @@ -8,10 +8,10 @@ import ( "strconv" ) -// tcat defines interpreter type categories +// tcat defines interpreter type categories. type tcat uint -// Types for go language +// Types for go language. const ( nilT tcat = iota aliasT @@ -92,7 +92,7 @@ func (c tcat) String() string { return "Cat(" + strconv.Itoa(int(c)) + ")" } -// structField type defines a field in a struct +// structField type defines a field in a struct. type structField struct { name string tag string @@ -100,7 +100,7 @@ type structField struct { typ *itype } -// itype defines the internal representation of types in the interpreter +// itype defines the internal representation of types in the interpreter. type itype struct { cat tcat // Type category field []structField // Array of struct fields if structT or interfaceT @@ -122,7 +122,7 @@ type itype struct { scope *scope // type declaration scope (in case of re-parse incomplete type) } -// nodeType returns a type definition for the corresponding AST subtree +// nodeType returns a type definition for the corresponding AST subtree. func nodeType(interp *Interpreter, sc *scope, n *node) (*itype, error) { if n.typ != nil && !n.typ.incomplete { if n.kind == sliceExpr { @@ -630,7 +630,7 @@ func (interp *Interpreter) isBuiltinCall(n *node) bool { return s != nil && s.kind == bltnSym } -// struct name returns the name of a struct type +// struct name returns the name of a struct type. func typeName(n *node) string { if n.anc.kind == typeSpec { return n.anc.child[0].ident @@ -638,7 +638,7 @@ func typeName(n *node) string { return "" } -// fieldName returns an implicit struct field name according to node kind +// fieldName returns an implicit struct field name according to node kind. func fieldName(n *node) string { switch n.kind { case selectorExpr: @@ -888,7 +888,7 @@ func (t *itype) methods() methodSet { return res } -// id returns a unique type identificator string +// id returns a unique type identificator string. func (t *itype) id() (res string) { if t.name != "" { return t.path + "." + t.name @@ -930,7 +930,7 @@ func (t *itype) id() (res string) { return res } -// zero instantiates and return a zero value object for the given type during execution +// zero instantiates and return a zero value object for the given type during execution. func (t *itype) zero() (v reflect.Value, err error) { if t, err = t.finalize(); err != nil { return v, err @@ -951,7 +951,7 @@ func (t *itype) zero() (v reflect.Value, err error) { return v, err } -// fieldIndex returns the field index from name in a struct, or -1 if not found +// fieldIndex returns the field index from name in a struct, or -1 if not found. func (t *itype) fieldIndex(name string) int { switch t.cat { case aliasT, ptrT: @@ -965,7 +965,7 @@ func (t *itype) fieldIndex(name string) int { return -1 } -// fieldSeq returns the field type from the list of field indexes +// fieldSeq returns the field type from the list of field indexes. func (t *itype) fieldSeq(seq []int) *itype { ft := t for _, i := range seq { @@ -977,7 +977,7 @@ func (t *itype) fieldSeq(seq []int) *itype { return ft } -// lookupField returns a list of indices, i.e. a path to access a field in a struct object +// lookupField returns a list of indices, i.e. a path to access a field in a struct object. func (t *itype) lookupField(name string) []int { switch t.cat { case aliasT, ptrT: @@ -999,7 +999,7 @@ func (t *itype) lookupField(name string) []int { return nil } -// lookupBinField returns a structfield and a path to access an embedded binary field in a struct object +// lookupBinField returns a structfield and a path to access an embedded binary field in a struct object. func (t *itype) lookupBinField(name string) (s reflect.StructField, index []int, ok bool) { if t.cat == ptrT { return t.val.lookupBinField(name) @@ -1101,7 +1101,7 @@ func exportName(s string) string { var interf = reflect.TypeOf((*interface{})(nil)).Elem() var constVal = reflect.TypeOf((*constant.Value)(nil)).Elem() -// RefType returns a reflect.Type representation from an interpereter type. +// RefType returns a reflect.Type representation from an interpreter type. // In simple cases, reflect types are directly mapped from the interpreter // counterpart. // For recursive named struct or interfaces, as reflect does not permit to diff --git a/stdlib/stdlib.go b/stdlib/stdlib.go index ee7f0331..25cdb070 100644 --- a/stdlib/stdlib.go +++ b/stdlib/stdlib.go @@ -5,7 +5,7 @@ package stdlib import "reflect" -// Symbols variable stores the map of stdlib symbols per package +// Symbols variable stores the map of stdlib symbols per package. var Symbols = map[string]map[string]reflect.Value{} func init() { diff --git a/stdlib/syscall/syscall.go b/stdlib/syscall/syscall.go index a416208b..266415da 100644 --- a/stdlib/syscall/syscall.go +++ b/stdlib/syscall/syscall.go @@ -5,7 +5,7 @@ package syscall import "reflect" -// Symbols stores the map of syscall package symbols +// Symbols stores the map of syscall package symbols. var Symbols = map[string]map[string]reflect.Value{} func init() { diff --git a/stdlib/unsafe/unsafe.go b/stdlib/unsafe/unsafe.go index e364f34f..05f5b320 100644 --- a/stdlib/unsafe/unsafe.go +++ b/stdlib/unsafe/unsafe.go @@ -8,7 +8,7 @@ import ( "unsafe" ) -// Symbols stores the map of unsafe package symbols +// Symbols stores the map of unsafe package symbols. var Symbols = map[string]map[string]reflect.Value{} func init() {