Standard library / reflect
reflect.Indirect()
Dereference a reflected pointer once; return non-pointer values unchanged. A nil pointer produces an invalid Value. Expected stdout: '7\n'.
Formal Syntax & Structure
go syntaxgo
func Indirect(v Value) ValueParameters & Attributes
| Name | Type | Description |
|---|---|---|
| v | Value | Value to inspect or dereference. |
Return Value
Value
Dereference a reflected pointer once; return non-pointer values unchanged.
Working Example
Example Snippetgo
package main
import ( "fmt" "reflect")
func main() { n := 7; fmt.Println(reflect.Indirect(reflect.ValueOf(&n)).Int()) }