Standard library / reflect
reflect.Value.SetZero()
Reset a settable value to the zero value of its type. Expected stdout: '0\n'.
Formal Syntax & Structure
go syntaxgo
func (v Value) SetZero()Working Example
Example Snippetgo
package main
import ( "fmt" "reflect")
func main() { n := 7; reflect.ValueOf(&n).Elem().SetZero(); fmt.Println(n) }