MCPcopy Create free account
hub / github.com/cloudwan/gohan / LoadFile

Method LoadFile

extension/gohanscript/vm.go:73–88  ·  view source on GitHub ↗

LoadFile loads gohan script code from file and make func

(file string)

Source from the content-addressed store, hash-verified

71
72//LoadFile loads gohan script code from file and make func
73func (vm *VM) LoadFile(file string) error {
74 code, err := LoadYAMLFile(file)
75 if err != nil {
76 return err
77 }
78 main, err := NewStmt(file, code)
79 if err != nil {
80 return err
81 }
82 fun, err := main.Func()
83 if err != nil {
84 return err
85 }
86 vm.funcs = append(vm.funcs, fun)
87 return nil
88}
89
90//LoadString loads gohan script code from string and make func
91func (vm *VM) LoadString(fileName, yamlString string) error {

Callers 2

BenchmarkFibFunction · 0.95
FetchContentFunction · 0.80

Calls 3

FuncMethod · 0.95
LoadYAMLFileFunction · 0.85
NewStmtFunction · 0.85

Tested by 1

BenchmarkFibFunction · 0.76