Standard library / go/types

go/types.Scope.End()

Returns the exclusive end position of the scope. Expected stdout: '100\n'.

Formal Syntax & Structure

go syntaxgo
func (s *Scope) End() token.Pos

Return Value

token.Pos

Returns the exclusive end position of the scope.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/types")
func scope() *types.Scope {  s := types.NewScope(nil, 10, 100, "outer")  types.NewScope(s, 20, 40, "inner")  s.Insert(types.NewVar(11, nil, "X", types.Typ[types.Int]))  return s}
func main() { v := scope(); fmt.Println(v.End()) }
Go Reference