jpath

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2020 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorNoRoot means no rootDir was found in the parents
	ErrorNoRoot = errors.New("could not locate a tkrc.yaml or jsonnetfile.json in the parent directories, which is required to identify the project root.\nRefer to https://tanka.dev/directory-structure for more information")

	// ErrorNoBase means no baseDir was found in the parents
	ErrorNoBase = errors.New("could not locate a main.jsonnet in the parent directories, which is required as the entrypoint for the evaluation.\nRefer to https://tanka.dev/directory-structure for more information")
)

Functions

func FindParentFile

func FindParentFile(file, start, stop string) (string, error)

FindParentFile traverses the parent directory tree for the given `file`, starting from `start` and ending in `stop`. If the file is not found an error is returned.

func Resolve

func Resolve(workdir string) (path []string, base, root string, err error)

Resolve the given directory and resolves the jPath around it. This means it: - figures out the project root (the one with .jsonnetfile, vendor/ and lib/) - figures out the environments base directory (the one with the main.jsonnet)

It then constructs a jPath with the base directory, vendor/ and lib/. This results in predictable imports, as it doesn't matter whether the user called called the command further down tree or not. A little bit like git.

Types

type ErrorFileNotFound

type ErrorFileNotFound struct {
	// contains filtered or unexported fields
}

ErrorFileNotFound means that the searched file was not found

func (ErrorFileNotFound) Error

func (e ErrorFileNotFound) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL