This seems like it would be a fairly common thing and abundant examples across the interwebs, but I can\'t seem to find an example of how to convert an [32]byte
This should work:
func Foo() [32]byte {
return [32]byte{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}
}
func Bar(b []byte) {
fmt.Println(string(b))
}
func main() {
x := Foo()
Bar(x[:])
}
And it doesn't create a copy of the underlying buffer