Standard library / reflect

reflect.Value.CanSet()

Report whether a value may be changed through Set or kind-specific setters. Unexported fields are not settable. Expected stdout: 'false\n'.

Formal Syntax & Structure

go syntaxgo
func (v Value) CanSet() bool

Return Value

bool

Report whether a value may be changed through Set or kind-specific setters.

Working Example

Example Snippetgo
package main
import (  "fmt"  "reflect")
func main() { fmt.Println(reflect.ValueOf(42).CanSet()) }
Go Reference