INNER CODE UNIT · Go
compileStr
brexhq/substation · cmd/substation/main.go:140
func compileStr(s string, extVars map[string]string) (string, error) {
vm := jsonnet.MakeVM()
vm.ExtCode("sub", substation.Library)
for k, v := range extVars {
vm.ExtVar(k, v)
}
res, err := vm.EvaluateAnonymousSnippet("snippet", s)
if err != nil {
return "", err
}
return res, nil
}
// pathVars returns the directory and file name of a file path.
func pathVars(p string) (string, string) {