package main import ( "fmt" "log" ) func main() { // Allocate a chunk of memory. nPtr := new(int) // Assign the value indirectly. *nPtr = 2 // Print out the address. fmt.Println(nPtr) // Dereference the pointer to get the value. if !(*nPtr == 2) { log.Fatal("Wrong value") } }