diff --git a/ch07/debug/main.go b/ch07/debug/main.go index e69de29..69f2e68 100644 --- a/ch07/debug/main.go +++ b/ch07/debug/main.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "os" +) + +func function(i int) int { + return i * i +} + +func main() { + if len(os.Args) == 1 { + fmt.Println("Need at least one argument.") + return + } + + i := 5 + fmt.Println("Debugging with Delve") + fmt.Println(i) + fmt.Println(function(i)) + + for arg, _ := range os.Args[1:] { + fmt.Println(arg) + } +}