Source File
indirect.go
Belonging Package
github.com/spf13/cast
// Copyright © 2014 Steve Francia <spf@spf13.com>.//// Use of this source code is governed by an MIT-style// license that can be found in the LICENSE file.package castimport ()// From html/template/content.go// Copyright 2011 The Go Authors. All rights reserved.// indirect returns the value, after dereferencing as many times// as necessary to reach the base type (or nil).func indirect( any) (any, bool) {if == nil {return nil, false}if := reflect.TypeOf(); .Kind() != reflect.Ptr {// Avoid creating a reflect.Value if it's not a pointer.return , false}:= reflect.ValueOf()for .Kind() == reflect.Ptr || (.Kind() == reflect.Interface && .Elem().Kind() == reflect.Ptr) {if .IsNil() {return nil, true}= .Elem()}return .Interface(), true}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |