os

package
v1.0.0-beta.9 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies a file. It truncates the destination file if it exists.

func EnsureDir

func EnsureDir(dir string, mode os.FileMode) error

EnsureDir ensures the given directory exists, creating it if necessary. Errors if the path already exists as a non-directory.

func FileExists

func FileExists(filePath string) bool

FileExists checks if a file exists.

func MustReadFile

func MustReadFile(filePath string) []byte

MustReadFile reads a file and returns the contents. If the file does not exist, it exits the program.

func MustWriteFile

func MustWriteFile(filePath string, contents []byte, mode os.FileMode)

MustWriteFile writes a file. If the file does not exist, it exits the program.

func ReadFile

func ReadFile(filePath string) ([]byte, error)

ReadFile reads a file and returns the contents.

func TrapSignal

func TrapSignal(logger zerolog.Logger, cb func())

TrapSignal catches the SIGTERM/SIGINT and executes cb function. After that it exits with code 0.

func WriteFile

func WriteFile(filePath string, contents []byte, mode os.FileMode) error

WriteFile writes a file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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