Documentation
¶
Index ¶
- func MustAbs(path string) string
- func MustCheckExists(fileOrDirPath string) bool
- func MustCopyEmbedFSSimple(src embed.FS, root string, outDirPath string)
- func MustCreateTempDir(pattern string) string
- func MustGetWD() string
- func MustPrepareDir(dirPath string, dirMode os.FileMode)
- func MustReadFile(filePath string) []byte
- func MustUserHomeDir() string
- func MustWriteFile(filePath string, dirMode os.FileMode, fileMode os.FileMode, contents []byte) string
- func MustWriteTempFile(pattern string, contents []byte) string
- func WithMustCreateTempDir(pattern string, f func(dirPath string))
- func WithMustWriteTempFile(pattern string, contents []byte, f func(filePath string))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustCheckExists ¶ added in v1.6.0
MustCheckExists checks if the given path exists, panics on error (other than os.ErrNotExist).
func MustCopyEmbedFSSimple ¶ added in v1.7.0
MustCopyEmbedFSSimple copies regular files and directories from embed.FS to disk. Note that the copy logic is very simple and only suited for small tasks such as preparing a templated directory.
func MustCreateTempDir ¶
MustCreateTempDir is like os.MkdirTemp, but panics on error.
func MustPrepareDir ¶
MustPrepareDir deletes the given directory and its contents (if present) and recreates it.
func MustReadFile ¶
MustReadFile reads a file, panics on error.
func MustUserHomeDir ¶
func MustUserHomeDir() string
MustUserHomeDir is like os.UserHomeDir, but panics on error.
func MustWriteFile ¶
func MustWriteFile(filePath string, dirMode os.FileMode, fileMode os.FileMode, contents []byte) string
MustWriteFile creates a file with the given mode and contents, also ensuring the containing folder exists.
func MustWriteTempFile ¶
MustWriteTempFile creates a temporary file with the given contents.
func WithMustCreateTempDir ¶
WithMustCreateTempDir calls f passing it the path to a new temporary directory, which is wiped after f returns.
func WithMustWriteTempFile ¶ added in v1.2.0
WithMustWriteTempFile calls f passing it the path to a new temporary file, which is wiped after f returns.
Types ¶
This section is empty.