Documentation ¶
Index ¶
- Variables
- func ComputeRelativePath(basePath, targetPath string) (string, error)
- func FindFileInParent(fileName string) (string, error)
- func FindFileInParentTarget(parentFolder, targetFolder, fileName string) (string, error)
- func Get(h HCL, key string) (string, bool)
- func WrapError(customErr, originalErr error) error
- type HCL
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrFileNotFound indicates the .hcl file was not found in the expected locations. ErrFileNotFound = fmt.Errorf("could not find .hcl file") // ErrParseFailed indicates a failure in parsing the .hcl file content. ErrParseFailed = fmt.Errorf("could not parse .hcl file") )
Predefined errors for file operations.
View Source
var ( // ErrFindUpwards is returned when the target directory is not found. ErrFindUpwards = fmt.Errorf("target directory not found") )
Predefined errors for file operations.
Functions ¶
func ComputeRelativePath ¶
ComputeRelativePath computes the relative path from base to target. It returns the relative path as a string and any error encountered.
func FindFileInParent ¶
func FindFileInParentTarget ¶
FindFileInParentTarget searches a file in a parent target folder.
Types ¶
type HCL ¶
type HCL struct {
KeyValues map[string]interface{}
}
func GetHCLFromParent ¶
GetHCLFromParent retrieves the configuration from an HCL file located within the project directory or any parent directory. The function searches for a file with the provided name appended with ".hcl". It wraps and returns any error encountered during the file search or parsing process, with additional context.
Click to show internal directories.
Click to hide internal directories.