Standard library / reflect

reflect.Value.Bytes()

Expose the underlying bytes of a byte slice or addressable byte array; mutations can affect the original. Other kinds panic. Expected stdout: 'go\n'.

Formal Syntax & Structure

go syntaxgo
func (v Value) Bytes() []byte

Return Value

[]byte

Expose the underlying bytes of a byte slice or addressable byte array; mutations can affect the original.

Working Example

Example Snippetgo
package main
import (  "fmt"  "reflect")
func main() { fmt.Println(string(reflect.ValueOf([]byte("go")).Bytes())) }
Go Reference