Documentation
¶
Index ¶
- Variables
- func CleanupServiceFileStructure(servicePath string) error
- func CopyDirectory(src, dest string) error
- func CopyFile(srcPath, destPath string) error
- func GetFileContentsFromURL(client *http.Client, url string) ([]byte, string, error)
- func GetFileHash(file io.Reader) string
- func GetModuleInfo(startDir string) (string, string, error)
- func IsEmptyDir(path string) bool
- func IsJsonType(content []byte) bool
- func IsURL(path string) bool
- func IsYamlType(content []byte) bool
- func ReadFileOrURL(path string) ([]byte, error)
- func SaveFile(filePath string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrGettingFileFromURL = errors.New("error getting file from url")
)
Functions ¶
func CleanupServiceFileStructure ¶
CleanupServiceFileStructure removes empty directories from the service directory.
func CopyDirectory ¶
CopyDirectory copies a directory recursively.
func CopyFile ¶
CopyFile copies a file from srcPath to destPath. If the destination directory doesn't exist, it will be created. File permissions are preserved from the source file.
func GetFileContentsFromURL ¶
GetFileContentsFromURL fetches file contents from a URL.
func GetFileHash ¶
GetFileHash gets the SHA256 hash of a file.
func GetModuleInfo ¶
GetModuleInfo walks up the directory tree to find go.mod and returns both the module name and the module root directory path
func IsJsonType ¶
IsJsonType checks if the content is a valid JSON document.
func IsYamlType ¶
IsYamlType checks if the content is a valid YAML document.
func ReadFileOrURL ¶
ReadFileOrURL reads content from either a local file path or a URL. If the path starts with http:// or https://, it fetches from the URL. Otherwise, it reads from the local file system. Returns the file contents and an error if any.
Types ¶
This section is empty.