os

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 3 Imported by: 1

README

OS library

Go Report Card codecov

Candidate functions :

Func Name Prototype Description Comments
Chmod Chmod(name string, mode int) error {} Changes the mode of the file N/A
Chown Chown(path string, uid int, gid int) {} Chown changes the owner and group of the file Does not work on Windows
ClearEnv ClearEnv() {} Clears all environment variables N/A
Create Create(name string) {} Creates a file and returns the file object N/A
Exit Exit(code int) {} Exits the program with the given code N/A
Getegid Getegid() int {} Gets the effective group ID of the calling process N/A
GetEnv GetEnv(key string) string {} Returns an environment variable N/A
Geteuid Geteuid() int {} Gets the effective user ID of the calling process N/A
Getgid Getgid() int {} Gets the group ID of the calling process N/A
GetHostname GetHostname() string {} Gets the hostname of the machine N/A
Getpid Getpid() int {} Gets the process ID of the calling process N/A
Getppid Getppid() int {} Gets the process ID of the parent of the calling process N/A
Getuid Getuid() int {} Gets the user ID of the calling process N/A
GetUserHomeDir GetUserHomeDir() string {} Gets the home directory of the current user N/A
Getwd Getwd() string {} Gets the current working directory N/A
Mkdir Mkdir(name string) {} Creates a new directory N/A
ReadDir ReadDir(name string) []string {} Reads a directory and returns the names of the files and directories N/A
ReadFile ReadFile(str string) string {} Returns the content of a file N/A
Remove Remove(filename string) {} Removes a file N/A
RemoveAll RemoveAll(path string) {} Removes a directory and all its contents N/A
SetEnv SetEnv(key string, value string) {} Sets an environment variable N/A
SetEnvByFile SetEnvByFile(filename string) error {} Sets an environment variable by reading a file Uses the format key=value
UnsetEnv UnsetEnv(key string) {} Unsets an environment variable N/A
WriteFile WriteFile(filename string, content string) {} Writes a file with the given content N/A

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Variables = map[string]eclaType.Type{}

Functions

func Chmod added in v1.1.0

func Chmod(name string, mode int) error

Chmod changes the mode of the file

func Chown

func Chown(path string, uid int, gid int)

Chown changes the owner and group of the file

func ClearEnv

func ClearEnv()

ClearEnv clears all environment variables

func Create

func Create(name string)

Create creates a file and returns the file object

func Exit added in v1.1.0

func Exit(code int)

Exit exits the program with the given code

func GetEnv

func GetEnv(key string) string

GetEnv gets an environment variable

func GetHostname

func GetHostname() string

GetHostname gets the hostname of the machine

func GetUserHomeDir

func GetUserHomeDir() string

GetUserHomeDir gets the home directory of the current user

func Getegid

func Getegid() int

Getegid gets the effective group ID of the calling process

func Geteuid

func Geteuid() int

Geteuid gets the effective user ID of the calling process

func Getgid

func Getgid() int

Getgid gets the group ID of the calling process

func Getpid

func Getpid() int

Getpid gets the process ID of the calling process

func Getppid

func Getppid() int

Getppid gets the process ID of the parent of the calling process

func Getuid

func Getuid() int

Getuid gets the user ID of the calling process

func Getwd

func Getwd() string

Getwd gets the current working directory

func Mkdir

func Mkdir(name string)

Mkdir creates a new directory

func ReadDir

func ReadDir(name string) []string

ReadDir reads a directory and returns the names of the files and directories

func ReadFile

func ReadFile(filename string) string

ReadFile reads a file and returns the contents

func Remove

func Remove(filename string)

Remove removes a file

func RemoveAll

func RemoveAll(path string)

RemoveAll removes a directory and all its contents

func SetEnv

func SetEnv(key string, value string)

SetEnv sets an environment variable

func SetEnvByFile

func SetEnvByFile(filename string) error

SetEnvByFile sets an environment variable by reading a file

func UnsetEnv

func UnsetEnv(key string)

UnsetEnv unsets an environment variable

func WriteFile

func WriteFile(filename string, content string)

WriteFile writes a file with the given content

Types

This section is empty.

Jump to

Keyboard shortcuts

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