Standard library / go/types
go/types.Scope.Contains()
Reports whether a position is within the half-open scope interval. Expected stdout: 'true false\n'.
Formal Syntax & Structure
go syntaxgo
func (s *Scope) Contains(pos token.Pos) boolParameters & Attributes
| Name | Type | Description |
|---|---|---|
| pos | token.Pos | Source position in the associated file set. |
Return Value
bool
Reports whether a position is within the half-open scope interval.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func main() { s := types.NewScope(nil, 1, 10, "demo"); fmt.Println(s.Contains(1), s.Contains(10)) }