github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2015/go-for-java-programmers/safe.go (about) 1 // +build OMIT 2 3 package main 4 5 import "fmt" 6 7 func newInt(v int) *int { 8 var n = v 9 return &n // HL 10 } 11 12 func inc(p *int) { 13 *p++ // try removing * // HL 14 } 15 16 func main() { 17 p := newInt(3) 18 inc(p) 19 fmt.Println(p, "points to", *p) 20 }