package valsimport ()// Indexer wraps the Index method.typeIndexerinterface {// Index retrieves the value corresponding to the specified key in the // container. It returns the value (if any), and whether it actually exists.Index(k interface{}) (v interface{}, ok bool)}// ErrIndexer wraps the Index method.typeErrIndexerinterface {// Index retrieves one value from the receiver at the specified index.Index(k interface{}) (interface{}, error)}varerrNotIndexable = errors.New("not indexable")typenoSuchKeyErrorstruct {keyinterface{}}// NoSuchKey returns an error indicating that a key is not found in a map-like// value.func ( interface{}) error {returnnoSuchKeyError{}}func ( noSuchKeyError) () string {return"no such key: " + Repr(.key, NoPretty)}// Index indexes a value with the given key. It is implemented for the builtin// type string, *os.File, List, StructMap and PseudoStructMap types, and types// satisfying the ErrIndexer or Indexer interface (the Map type satisfies// Indexer). For other types, it returns a nil value and a non-nil error.func (, interface{}) (interface{}, error) {switch a := .(type) {casestring:returnindexString(, )case *os.File:returnindexFile(, )caseErrIndexer:return .Index()caseIndexer: , := .Index()if ! {returnnil, NoSuchKey() }return , nilcaseList:returnindexList(, )caseStructMap:returnindexStructMap(, )casePseudoStructMap:returnindexStructMap(.Fields(), )default:returnnil, errNotIndexable }}func ( *os.File, interface{}) (interface{}, error) {switch {case"fd":returnint(.Fd()), nilcase"name":return .Name(), nil }returnnil, NoSuchKey()}func ( StructMap, interface{}) (interface{}, error) { , := .(string)if ! || == "" {returnnil, NoSuchKey() } := reflect.ValueOf() := iterateStructMap(reflect.TypeOf())for .Next() { , := .Get()if == {returnFromGo(), nil } }returnnil, NoSuchKey()}
The pages are generated with Goldsv0.2.8-preview. (GOOS=darwin GOARCH=arm64)