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

     1  //go:build errcaller
     2  // +build errcaller
     3  
     4  package errors
     5  
     6  import (
     7  	_ "unsafe"
     8  )
     9  
    10  // IncludesCaller is a compile-time flag used to indicate whether
    11  // to include calling function prefix on error wrap / creation.
    12  const IncludesCaller = true
    13  
    14  type caller string
    15  
    16  // set will set the actual caller value
    17  // only when correct build flag is set.
    18  func (c *caller) set(v string) {
    19  	*c = caller(v)
    20  }
    21  
    22  // value returns the actual caller value
    23  // only when correct build flag is set
    24  func (c caller) value() string {
    25  	return string(c)
    26  }