Skip to content

nickwells/utilities

Repository files navigation

go.dev reference Go Report Card GitHub License

utilities

Miscellaneous useful commands.

gosh gosh

This is a tool for running Go code from the command line.

See here.

gosh.snippet

This is for installing the standard gosh snippets.

See here

findCmpRm

This finds files with copies, compares them with the copies and optionally deletes the old copies.

See here

findGoDirs

This finds Go source directories and optionally performs some useful tasks on them or just lists them.

See here

mkparamfilefunc

This is intended to be used with go generate to construct functions that can be used to set the parameter files for packages and commands. It will write a Go file with functions that can be passed to a call to paramset.NewOrPanic to set the per-command config files. This will allow the user of a program to set parameters that they want to use every time the program is run.

See here

mkpkgerr

This will generate the code to provide a package-specific error type (pkgError) which allows errors from your package to be distinguished from errors from other sources. It defines an interface called Error which will be satisfied only by errors from your package. The pkgError is not exported and so cannot be used outside of the package but does satisfy the package-specific Error interface (and also the standard error interface). It also provides a local pkgErrorf function that can be used to generate a pkgError. The pkgError is a renaming of string and so a string can simply be cast to a pkgError.

See here

mkfunccontrolparamtype

This can be used to generate a type which can be used to control the behaviour of a function. You can give a type name, a list of valid values and a description and it will generate a file containing the necessary code that you can then use.

The type can be thought of as an enumerated type.

See here

mkdoc

This is a tool for generating markdown files documenting Go programs.

See here.

mkbadge

This is a tool for generating badges to be inserted into the README.md file

See here

statfs

This provides an equivalent to the Linux df command but in a form that is easier to use in a shell script. The default output is easy for a human to understand but with the right flags set it can deliver just the value required.

See here

sleepuntil

This provides a way of repeatedly sleeping until a particular time is reached.

See here

timeconv

This provides a way of simply converting the time from one locale to another. This can be useful when you are working with colleagues in other timezones with different daylight-saving rules.

See here

About

miscellaneous useful commands, including 'gosh' the Go scripting tool

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages