RunFile load data from file and execute it
(file string)
| 54 | |
| 55 | //RunFile load data from file and execute it |
| 56 | func (vm *VM) RunFile(file string) (interface{}, error) { |
| 57 | code, err := LoadYAMLFile(file) |
| 58 | if err != nil { |
| 59 | return nil, err |
| 60 | } |
| 61 | main, err := NewStmt(file, code) |
| 62 | if err != nil { |
| 63 | return nil, err |
| 64 | } |
| 65 | runner, err := main.Func() |
| 66 | if err != nil { |
| 67 | return nil, err |
| 68 | } |
| 69 | return runner(vm.Context) |
| 70 | } |
| 71 | |
| 72 | //LoadFile loads gohan script code from file and make func |
| 73 | func (vm *VM) LoadFile(file string) error { |
no test coverage detected