xos

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 12 Imported by: 1

README

xos - Extra Operating System Functionality

Copyright (c) 2022, 2023, Geert JM Vanderkelen

Package xos extra functionality around the Go os package, which provides a platform-independent interface to operating system functionality. It extends whatever is provided by the standard Go library, contains no magic, and probably does offer not more than what can be found in various other projects.

License

Distributed under the MIT license. See LICENSE.txt for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllFilenamesInDir added in v1.4.0

func AllFilenamesInDir(root string) ([]string, error)

AllFilenamesInDir returns files which are not directories recursively found in directory path. The result is alphabetically sorted.

func EnvironMap added in v1.2.0

func EnvironMap() map[string]string

EnvironMap goes through all environment variables, saving them into a map with name being the key.

func EnvironMapLookup added in v1.2.0

func EnvironMapLookup(mapper func(name, value string) bool) map[string]string

EnvironMapLookup goes through all environment variables, saving them into a map with name being the key. When provided, the mapper function can be used to include variables.

For example, you would like to include some Go environment variables:

envMap := EnvironMapLookup(func(name, _ string) bool {
  return name == "GOROOT" || name == "GOPATH"
})

If no mapper is provided, EnvironMapLookup works exactly as EnvironMap.

func FChecksumMD5 added in v1.3.0

func FChecksumMD5(fp io.ReadSeeker) (string, error)

func FChecksumSHA1 added in v1.3.0

func FChecksumSHA1(fp io.ReadSeeker) (string, error)

func FChecksumSHA256 added in v1.3.0

func FChecksumSHA256(fp io.ReadSeeker) (string, error)

func FilesInDir

func FilesInDir(path string) ([]string, error)

FilesInDir returns files which are not directories found in directory path. The result is alphabetically sorted.

func InDockerContainer added in v1.1.0

func InDockerContainer() bool

InDockerContainer returns true if the application is running within a Docker container.

func IsDir

func IsDir(path string) bool

IsDir returns whether path is a directory.

func IsRegularFile

func IsRegularFile(path string) bool

IsRegularFile returns whether path is a regular file.

func RegularFilesInDir

func RegularFilesInDir(path string) ([]string, error)

RegularFilesInDir returns regular files found in directory path.

func RegularFilesInDirWithFullPath

func RegularFilesInDirWithFullPath(path string) ([]string, error)

RegularFilesInDirWithFullPath returns regular files found in directory path with each path included in the filename.

Types

This section is empty.

Jump to

Keyboard shortcuts

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