Created
July 15, 2019 13:27
-
-
Save d0c-s4vage/af1a5782f310937ec2e227203e85f165 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// holds script-specific information (i.e. how to load the script data, | |
// name of the script, script runtime version required, etc.) | |
type Script struct { | |
} | |
// parameters to the script, TBD if key/value or positional | |
type ScriptParam struct { | |
} | |
// current script execution context. Defines global variables, pre-exising variables | |
// from the current scope, etc. | |
type ScriptContext struct { | |
} | |
// runs the script in the given context | |
func (s *Script) Run(sCtx *ScriptContext) error { | |
} | |
// accepts a script structure, and a script context, returns errors that occur | |
func RunScript( | |
s *Script, params []*ScriptParam, sCtx *ScriptContext, | |
) error { | |
log.Printf("Running script: %+v, with params %+v", s, params) | |
err := s.Run(params, sCtx) | |
if err != nil { | |
log.Printf("Error running script %+v: %s", s, err.Error()) | |
return err | |
} | |
log.Printf("Done running script") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment