User Tools

Site Tools


ref.go
//
// $Id$
//
package main
 
import (
    "fmt"
)
 
func ref1() []byte {
    a := make([]byte, 0)
    a = append(a, []byte("qwerty")...)
    fmt.Printf("%p\n", a)
    return a
}
 
func ref2(a []byte)  {
    fmt.Printf("%p\n", a)
}
 
func main() {
    a := ref1()
    fmt.Printf("%p\n", a)
    ref2(a)
 
}
//EOF

out

$ go run ref.go
0xc00008c000
0xc00008c000
0xc00008c000