github.com/hedzr/evendeep@v0.4.8/internal/tool/unsafe_appengine.go (about)

     1  //go:build appengine || disableunsafe
     2  // +build appengine disableunsafe
     3  
     4  package tool
     5  
     6  import "reflect"
     7  
     8  const (
     9  	// UnsafeDisabled is a build-time constant which specifies whether or
    10  	// not access to the unsafe package is available.
    11  	UnsafeDisabled = true
    12  )
    13  
    14  // UnsafeReflectValue typically converts the passed reflect.Value into a one
    15  // that bypasses the typical safety restrictions preventing access to
    16  // unaddressable and unexported data.  However, doing this relies on access to
    17  // the unsafe package.  This is a stub version which simply returns the passed
    18  // reflect.Value when the unsafe package is not available.
    19  func UnsafeReflectValue(v reflect.Value) reflect.Value {
    20  	return v
    21  }