MCPcopy Index your code
hub / github.com/DoNewsCode/core / LocationForPC

Function LocationForPC

di/optional_provider.go:21–30  ·  view source on GitHub ↗

LocationForPC sets the constructor pointer to a specified location. Use this Options to reduce vague debug message when constructor are made by reflect.makeFunc. For example: LocationForPC(reflect.makeFunc(...), reflect.ValueOf(realConstructor).Pointer())

(constructor interface{}, pc uintptr)

Source from the content-addressed store, hash-verified

19// reflect.makeFunc. For example:
20// LocationForPC(reflect.makeFunc(...), reflect.ValueOf(realConstructor).Pointer())
21func LocationForPC(constructor interface{}, pc uintptr) interface{} {
22 if op, ok := constructor.(OptionalProvider); ok {
23 op.Options = append(op.Options, dig.LocationForPC(pc))
24 return op
25 }
26 return OptionalProvider{
27 Constructor: constructor,
28 Options: []dig.ProvideOption{dig.LocationForPC(pc)},
29 }
30}
31
32// As constructs the instance and bind it to another interface. As means to be used as an argument to graph.Provide.
33// For example:

Callers 2

TestLocationForPCFunction · 0.92
TestChainedOptionsFunction · 0.92

Calls

no outgoing calls

Tested by 2

TestLocationForPCFunction · 0.74
TestChainedOptionsFunction · 0.74