Documentation ¶
Index ¶
- Variables
- func CheckError(fn func() error)
- func CreateFile(p string) (f *os.File, err error)
- func Dir() (string, error)
- func Expand(path string) (string, error)
- func FromTaskContext(ctx context.Context) string
- func FromTxContext(ctx context.Context) *db.Tx
- func NewTaskContext(ctx context.Context, t string) context.Context
- func NewTxContext(ctx context.Context, tx *db.Tx) context.Context
- type ContextKey
Constants ¶
This section is empty.
Variables ¶
var DisableCache bool
DisableCache will disable caching of the home directory. Caching is enabled by default.
Functions ¶
func CheckError ¶
func CheckError(fn func() error)
CheckError will execute the func, handle it's panic and error
func CreateFile ¶
CreateFile will create a file recursively.
func Dir ¶
Dir returns the home directory for the executing user.
This uses an OS-specific method for discovering the home directory. An error is returned if a home directory cannot be detected.
func Expand ¶
Expand expands the path to include the home directory if the path is prefixed with `~`. If it isn't prefixed with `~`, the path is returned as-is.
func FromTaskContext ¶
FromTaskContext will extract task name from context.
func FromTxContext ¶
FromTxContext will extract tx from context.
func NewTaskContext ¶
NewTaskContext will create a ctx with task name.
Types ¶
type ContextKey ¶
type ContextKey string
ContextKey is the type for context key.
const ( ContextKeyTx ContextKey = "tx" ContextKeyTask ContextKey = "task" )
Context keys.