Documentation
¶
Overview ¶
Package util contains helpers
Index ¶
- func EnvAsMap() map[string]string
- func GeneratedHeader(generator string, template string) string
- func LoadDotEnv(t *testing.T)
- func MapKeys(m map[string]interface{}) []string
- func MapSortedKeys(m map[string]interface{}, asc bool) []string
- func MergeStringMap(dst map[string]interface{}, extra map[string]interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnvAsMap ¶
EnvAsMap returns environment variables as string map TODO: might cache it when package init, the problem of doing so is user might call os.Setenv, we also do this in test
func GeneratedHeader ¶
func LoadDotEnv ¶
TODO: it seems it was designed for test only, but now I need to use it in normal application as well, put in envutil? Deprecated
func MapKeys ¶
MapKeys returns keys of a map as string slice in an undermined order NOTE: you can not pass map[string]string because string is not interface{}, you need to convert it, but you can get the keys along the way of converting ...
func MapSortedKeys ¶
MapKeys returns keys of a map as string slice in an asc/desc order as specified
func MergeStringMap ¶
MergeStringMap merges the second map to first map, and keep the value of the second map if there is duplicate key
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cast convert types safely and drop incompatible types during conversion it is inspired by https://github.com/spf13/cast
|
Package cast convert types safely and drop incompatible types during conversion it is inspired by https://github.com/spf13/cast |
|
Package color defines color code for pretty print in linux shell, windows is not supported
|
Package color defines color code for pretty print in linux shell, windows is not supported |
|
Package fsutil adds ignore support for walk
|
Package fsutil adds ignore support for walk |
|
Package hashutil provides alloc free alternatives for pkg/hash
|
Package hashutil provides alloc free alternatives for pkg/hash |
|
Package logutil is a registry of loggers, it is required for all lib and app that use gommon/log.
|
Package logutil is a registry of loggers, it is required for all lib and app that use gommon/log. |
|
Package runtimeutil provides wrapper to get caller, stack etc.
|
Package runtimeutil provides wrapper to get caller, stack etc. |
|
Package testutil defines helper functions that fails test instead of return error
|
Package testutil defines helper functions that fails test instead of return error |