Documentation ¶
Index ¶
- func Evaluate(path string, impl types.JsonnetImplementation, data string, opts Opts) (string, error)
- func EvaluateFile(impl types.JsonnetImplementation, jsonnetFile string, opts Opts) (string, error)
- func FindFiles(target string, excludes []glob.Glob) ([]string, error)
- func FindImporterForFiles(root string, files []string) ([]string, error)
- func Lint(fds []string, opts *LintOpts) error
- func TransitiveImports(dir string) ([]string, error)
- type FileEvalCache
- type InjectedCode
- type LintOpts
- type Modifier
- type Opts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Evaluate ¶
func Evaluate(path string, impl types.JsonnetImplementation, data string, opts Opts) (string, error)
Evaluate renders the given jsonnet into a string If cache options are given, a hash from the data will be computed and the resulting string will be cached for future retrieval
func EvaluateFile ¶
EvaluateFile evaluates the Jsonnet code in the given file and returns the result in JSON form. It disregards opts.ImportPaths in favor of automatically resolving these according to the specified file.
func FindImporterForFiles ¶ added in v0.24.0
FindImporterForFiles finds the entrypoints (main.jsonnet files) that import the given files. It looks through imports transitively, so if a file is imported through a chain, it will still be reported. If the given file is a main.jsonnet file, it will be returned as well.
func Lint ¶ added in v0.22.0
Lint takes a list of files and directories, processes them and prints out to stderr if there are linting warnings
func TransitiveImports ¶
TransitiveImports returns all recursive imports of an environment
Types ¶
type FileEvalCache ¶ added in v0.18.0
type FileEvalCache struct {
Directory string
}
FileEvalCache is an evaluation cache that stores its data on the local filesystem
func NewFileEvalCache ¶ added in v0.18.0
func NewFileEvalCache(cachePath string) *FileEvalCache
func (*FileEvalCache) Get ¶ added in v0.18.0
func (c *FileEvalCache) Get(hash string) (string, error)
func (*FileEvalCache) Store ¶ added in v0.18.0
func (c *FileEvalCache) Store(hash, content string) error
type InjectedCode ¶ added in v0.12.0
InjectedCode holds data that is "late-bound" into the VM
func (*InjectedCode) Set ¶ added in v0.12.0
func (i *InjectedCode) Set(key, value string)
Set allows to set values on an InjectedCode, even when it is nil
type LintOpts ¶ added in v0.22.0
type LintOpts struct { // Excludes are a list of globs to exclude files while searching for Jsonnet // files Excludes []glob.Glob // Parallelism determines the number of workers that will process files Parallelism int Out io.Writer }
LintOpts modifies the behaviour of Lint
type Modifier ¶ added in v0.7.0
Modifier allows to set optional parameters on the Jsonnet VM. See jsonnet.With* for this.
type Opts ¶ added in v0.12.0
type Opts struct { MaxStack int ExtCode InjectedCode TLACode InjectedCode ImportPaths []string EvalScript string CachePath string CachePathRegexes []*regexp.Regexp }
Opts are additional properties for the Jsonnet VM
func (Opts) PathIsCached ¶ added in v0.18.0
PathIsCached determines if a given path is matched by any of the configured cached path regexes If no path regexes are defined, all paths are matched