@@ -2072,7 +2072,8 @@ func (v Value) SetBool(x bool) {
20722072}
20732073
20742074// SetBytes sets v's underlying value.
2075- // It panics if v's underlying value is not a slice of bytes.
2075+ // It panics if v's underlying value is not a slice of bytes
2076+ // or if [Value.CanSet] returns false.
20762077func (v Value ) SetBytes (x []byte ) {
20772078 v .mustBeAssignable ()
20782079 v .mustBe (Slice )
@@ -2083,7 +2084,8 @@ func (v Value) SetBytes(x []byte) {
20832084}
20842085
20852086// setRunes sets v's underlying value.
2086- // It panics if v's underlying value is not a slice of runes (int32s).
2087+ // It panics if v's underlying value is not a slice of runes (int32s)
2088+ // or if [Value.CanSet] returns false.
20872089func (v Value ) setRunes (x []rune ) {
20882090 v .mustBeAssignable ()
20892091 v .mustBe (Slice )
@@ -2094,7 +2096,8 @@ func (v Value) setRunes(x []rune) {
20942096}
20952097
20962098// SetComplex sets v's underlying value to x.
2097- // It panics if v's Kind is not [Complex64] or [Complex128], or if [Value.CanSet] returns false.
2099+ // It panics if v's Kind is not [Complex64] or [Complex128],
2100+ // or if [Value.CanSet] returns false.
20982101func (v Value ) SetComplex (x complex128 ) {
20992102 v .mustBeAssignable ()
21002103 switch k := v .kind (); k {
@@ -2108,7 +2111,8 @@ func (v Value) SetComplex(x complex128) {
21082111}
21092112
21102113// SetFloat sets v's underlying value to x.
2111- // It panics if v's Kind is not [Float32] or [Float64], or if [Value.CanSet] returns false.
2114+ // It panics if v's Kind is not [Float32] or [Float64],
2115+ // or if [Value.CanSet] returns false.
21122116func (v Value ) SetFloat (x float64 ) {
21132117 v .mustBeAssignable ()
21142118 switch k := v .kind (); k {
@@ -2122,7 +2126,8 @@ func (v Value) SetFloat(x float64) {
21222126}
21232127
21242128// SetInt sets v's underlying value to x.
2125- // It panics if v's Kind is not [Int], [Int8], [Int16], [Int32], or [Int64], or if [Value.CanSet] returns false.
2129+ // It panics if v's Kind is not [Int], [Int8], [Int16], [Int32], or [Int64],
2130+ // or if [Value.CanSet] returns false.
21262131func (v Value ) SetInt (x int64 ) {
21272132 v .mustBeAssignable ()
21282133 switch k := v .kind (); k {
@@ -2142,8 +2147,9 @@ func (v Value) SetInt(x int64) {
21422147}
21432148
21442149// SetLen sets v's length to n.
2145- // It panics if v's Kind is not [Slice] or if n is negative or
2146- // greater than the capacity of the slice.
2150+ // It panics if v's Kind is not [Slice], or if n is negative or
2151+ // greater than the capacity of the slice,
2152+ // or if [Value.CanSet] returns false.
21472153func (v Value ) SetLen (n int ) {
21482154 v .mustBeAssignable ()
21492155 v .mustBe (Slice )
@@ -2155,8 +2161,9 @@ func (v Value) SetLen(n int) {
21552161}
21562162
21572163// SetCap sets v's capacity to n.
2158- // It panics if v's Kind is not [Slice] or if n is smaller than the length or
2159- // greater than the capacity of the slice.
2164+ // It panics if v's Kind is not [Slice], or if n is smaller than the length or
2165+ // greater than the capacity of the slice,
2166+ // or if [Value.CanSet] returns false.
21602167func (v Value ) SetCap (n int ) {
21612168 v .mustBeAssignable ()
21622169 v .mustBe (Slice )
@@ -2168,7 +2175,8 @@ func (v Value) SetCap(n int) {
21682175}
21692176
21702177// SetUint sets v's underlying value to x.
2171- // It panics if v's Kind is not [Uint], [Uintptr], [Uint8], [Uint16], [Uint32], or [Uint64], or if [Value.CanSet] returns false.
2178+ // It panics if v's Kind is not [Uint], [Uintptr], [Uint8], [Uint16], [Uint32], or [Uint64],
2179+ // or if [Value.CanSet] returns false.
21722180func (v Value ) SetUint (x uint64 ) {
21732181 v .mustBeAssignable ()
21742182 switch k := v .kind (); k {
@@ -2190,7 +2198,8 @@ func (v Value) SetUint(x uint64) {
21902198}
21912199
21922200// SetPointer sets the [unsafe.Pointer] value v to x.
2193- // It panics if v's Kind is not [UnsafePointer].
2201+ // It panics if v's Kind is not [UnsafePointer]
2202+ // or if [Value.CanSet] returns false.
21942203func (v Value ) SetPointer (x unsafe.Pointer ) {
21952204 v .mustBeAssignable ()
21962205 v .mustBe (UnsafePointer )
@@ -2558,8 +2567,8 @@ func arrayAt(p unsafe.Pointer, i int, eltSize uintptr, whySafe string) unsafe.Po
25582567// another n elements. After Grow(n), at least n elements can be appended
25592568// to the slice without another allocation.
25602569//
2561- // It panics if v's Kind is not a [Slice] or if n is negative or too large to
2562- // allocate the memory.
2570+ // It panics if v's Kind is not a [Slice], or if n is negative or too large to
2571+ // allocate the memory, or if [Value.CanSet] returns false .
25632572func (v Value ) Grow (n int ) {
25642573 v .mustBeAssignable ()
25652574 v .mustBe (Slice )
@@ -2647,6 +2656,7 @@ func AppendSlice(s, t Value) Value {
26472656// It returns the number of elements copied.
26482657// Dst and src each must have kind [Slice] or [Array], and
26492658// dst and src must have the same element type.
2659+ // It dst is an [Array], it panics if [Value.CanSet] returns false.
26502660//
26512661// As a special case, src can have kind [String] if the element type of dst is kind [Uint8].
26522662func Copy (dst , src Value ) int {
0 commit comments