MCPcopy Index your code
hub / github.com/coder/coder / makeStubFunction

Function makeStubFunction

provisioner/terraform/tfparse/funcs.go:154–162  ·  view source on GitHub ↗

makeStubFunction returns a function.Function with the required return type and parameters that will always return an unknown type and an error.

(name string, returnType cty.Type, params ...function.Parameter)

Source from the content-addressed store, hash-verified

152// makeStubFunction returns a function.Function with the required return type and parameters
153// that will always return an unknown type and an error.
154func makeStubFunction(name string, returnType cty.Type, params ...function.Parameter) function.Function {
155 var spec function.Spec
156 spec.Params = params
157 spec.Type = function.StaticReturnType(returnType)
158 spec.Impl = func(_ []cty.Value, _ cty.Type) (cty.Value, error) {
159 return cty.UnknownVal(returnType), xerrors.Errorf("function %q may not be used here", name)
160 }
161 return function.New(&spec)
162}

Callers 1

funcs.goFile · 0.85

Calls 2

NewMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected