os

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0, UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirExists

func DirExists(dirPath string) bool

func EnsureDir

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

func Exit

func Exit(s string)

func FileExists

func FileExists(filePath string) bool

Note: returns true for files and dirs.

func Kill

func Kill() error

Kill the running process by sending itself SIGTERM.

func MustReadFile

func MustReadFile(filePath string) []byte

func MustWriteFile

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

func PrintAllGoroutines

func PrintAllGoroutines()

func ProtocolAndAddress

func ProtocolAndAddress(listenAddr string) (string, string)

ProtocolAndAddress splits an address into the protocol and address components. For instance, "tcp://127.0.0.1:8080" will be split into "tcp" and "127.0.0.1:8080". If the address has no protocol prefix, the default is "tcp".

func ReadFile

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

func TrapSignal

func TrapSignal(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

func WriteFileAtomic

func WriteFileAtomic(filename string, data []byte, perm os.FileMode) (err error)

WriteFileAtomic creates a temporary file with data and provided perm and swaps it atomically with filename if successful.

Types

This section is empty.

Jump to

Keyboard shortcuts

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