util

package
v0.0.0-...-a5f00ba Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: ISC Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckerAssert

func CheckerAssert()

CheckerAssert should be defer-called in main().

func CheckerPop

func CheckerPop(xs ...string)

CheckerPop function is used when a resource has been created and is ready to be closed. In the naming scheme, Pop simply implies teardown for a given resource following a Push. The Checker function is a thread-safe map of named resources to integer counts. The math is slightly different in that in a close call to Cascade, events are teardown in reverse order of how they were set up (ex: chart listeners are deleted first, then candle listeners).

func CheckerPush

func CheckerPush(xs ...string)

CheckerPush function saves a specific event in a vault structure. For each function there is a vault sorted by name and obtained with a hash named history (map with key=Name and value=Number of invokes). ex. (funcName,value)=push). push attaches one to the counter if it is present, or it creates a vault with 1 if it is not present.

func ConfigFile

func ConfigFile(inp string) string

The ConfigFile function takes a string filename and the value of the environment variable $DOLA CONFIG, which defaults to nil. This function checks to see whether the specified file exists and if the file exists. If none of the criteria are met, route is returned as an empty string. This empty string is a desirable outcome since it will be subjected to an additional exception check.

func ExpandUser

func ExpandUser(path string) string

ExpandUser can take in a string and a string, and returns a string if the string paths are the same. This function also expands the tilde (~) to the current user's home directory. The userPath variable holds the result of all the string replacements, and then the result is returned. This function can be used to set files in one directory as the home for all changes that occur in directories the user has permissions to. The ~ is replaced with the current username's home directory and expanded in order to be a valid path, it is considered a "shortcut" for the current user's home directory. This file can then put to use with the other functions, to print the document's user directory and change the directory of the working directory.

func FileExists

func FileExists(path string) bool

FileExists returns a boolean indicating whether the path exist. Path is the parameter for the filename to check os.Stat is a filesystem`s function which returns a code indicating whether the name is that of an existing file The return statement closing the function `FileExists` and informing that the File does not exist.

func Location

func Location() string

Location attempts to write the name of the caller function's parent. This occurs when the pointer pc is set to 1 and when the compiler is queried for the function's name. The pointer's data type is set to the data type of the function that is currently being executed. The compiler is then queried to get the function's pointer. If it succeeds, the code then performs a location and completes the phrase If it cannot locate the function's pointer, it returns a question mark to indicate that it is unknown.

func Location2

func Location2() string

Location2 implements the grandparent call interface and contains Call 'street calling' troubleshooting and returns the name of the grandparent function

Types

type ErrorWaitGroup

type ErrorWaitGroup struct {
	// contains filtered or unexported fields
}

ErrorWaitGroup Wait function is dependent on a boolean condition in a goroutine. If you add a mutex to it, your application will lock your threads in motion, making it slower to execute but less prone to resource leaks or data races. As a result, bind the mutex to the ErrorWaitGroup structs mutex.

func (*ErrorWaitGroup) Add

func (m *ErrorWaitGroup) Add(delta int)

Add method of a WaitGroup takes a delta as a parameter and adds that delta to the WaitGroup counter. The struct field itself as well as the mutex fields need to know about this as well.

func (*ErrorWaitGroup) Done

func (m *ErrorWaitGroup) Done(right error)

Done method of WaitGroup takes an error as a parameter, which is put into the ErrorWaitGroup structs error field. Again, this needs to be known by all fields of the ErrorWaitGroup struct.

func (*ErrorWaitGroup) Wait

func (m *ErrorWaitGroup) Wait() error

Wait method of the WaitGroup needs to be accessed by multiple threads due to having persistent wait condition.

Jump to

Keyboard shortcuts

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