Skip to content

Commit

Permalink
Add print stack example
Browse files Browse the repository at this point in the history
  • Loading branch information
naeemaei committed Oct 7, 2023
1 parent 2cb7328 commit e8b8bac
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 04-Variables/01-Declaration/declaration.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
// Click here and start typing.
package main

import (
"fmt"
"runtime/debug"
)

func main() {
//var varName type = value
// 1
Expand Down Expand Up @@ -59,5 +64,10 @@ func main() {
println("i7: ", i7)
println("f5: ", f5)
println("s7: ", s7)
fmt.Printf("Stack is 1 %s\n\n\n", string(debug.Stack()))
fmt.Printf("Stack is 2 %s\n\n\n", string(debug.Stack()))
debug.PrintStack()
println("i7: ", i7)
debug.PrintStack()

}

0 comments on commit e8b8bac

Please sign in to comment.