codeberg.org/gruf/go-errors/v2@v2.3.1/build_trace.go (about)

     1  //go:build errtrace
     2  // +build errtrace
     3  
     4  package errors
     5  
     6  import (
     7  	"runtime"
     8  	_ "unsafe"
     9  )
    10  
    11  // IncludesStacktrace is a compile-time flag used to indicate
    12  // whether to include stacktraces on error wrap / creation.
    13  const IncludesStacktrace = true
    14  
    15  type trace []runtime.Frame
    16  
    17  // set will set the actual trace value
    18  // only when correct build flag is set.
    19  func (t *trace) set(v []runtime.Frame) {
    20  	*t = trace(v)
    21  }
    22  
    23  // value returns the actual trace value
    24  // only when correct build flag is set.
    25  func (t trace) value() Callers {
    26  	return Callers(t)
    27  }