github.com/zhongdalu/gf@v1.0.0/g/errors/gerror/gerror_stack.go (about) 1 // Copyright 2019 gf Author(https://github.com/zhongdalu/gf). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/zhongdalu/gf. 6 7 package gerror 8 9 import "runtime" 10 11 // stack represents a stack of program counters. 12 type stack []uintptr 13 14 const ( 15 gMAX_STACK_DEPTH = 32 16 ) 17 18 func callers() stack { 19 var pcs [gMAX_STACK_DEPTH]uintptr 20 n := runtime.Callers(3, pcs[:]) 21 return pcs[0:n] 22 }