oswrapper

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package oswrapper is a wrapper around the standard os package that allows more secure interactions with the operating system. It should be used as a replacement in production code of the standard os package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Getenv

func Getenv(name string) string

Getenv is an os.Getenv wrapper.

func GetenvBool

func GetenvBool(name string) (bool, error)

GetenvBool returns if an environmental variable is set to true. If it is not set, it is considered false. If it is set to a value that cannot be parsed as a boolean, an error is returned.

func IsRunningOnWindows

func IsRunningOnWindows() bool

IsRunningOnWindows returns true if the code is running on Windows.

func LookupEnv

func LookupEnv(name string) (string, bool)

LookupEnv is an os.LookupEnv wrapper.

func ReadFileSafe

func ReadFileSafe(path string, verifyPermissions bool) ([]byte, error)

ReadFileSafe checks if a file is safe to read, and then reads it. On Unix platforms, it can optionally if the file has strict permissions.

func Stat

func Stat(path string) (os.FileInfo, error)

Stat is an os.Stat wrapper.

func UserHomeDir

func UserHomeDir() (string, error)

UserHomeDir is an os.UserHomeDir wrapper.

Types

This section is empty.

Jump to

Keyboard shortcuts

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