github.com/brownsys/tracing-framework-go@v0.0.0-20161210174012-0542a62412fe/go/darwin_amd64/misc/tour/content/methods/methods-funcs.go (about) 1 // +build OMIT 2 3 package main 4 5 import ( 6 "fmt" 7 "math" 8 ) 9 10 type Vertex struct { 11 X, Y float64 12 } 13 14 func Abs(v Vertex) float64 { 15 return math.Sqrt(v.X*v.X + v.Y*v.Y) 16 } 17 18 func main() { 19 v := Vertex{3, 4} 20 fmt.Println(Abs(v)) 21 }