Documentation
¶
Overview ¶
Package util contains helper for test
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{})
- func ReadFixture(t *testing.T, path string) []byte
- func ReadJson(t *testing.T, path string, v 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 ... LoadDotEnv load .env in current directory into environment variable, line start with # are comments It is modeled after https://github.com/motdotla/dotenv
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
func ReadFixture ¶
TODO: migrate its usage to util/testutil
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Code generated by gommon from util/color/color_generated.go.tmpl DO NOT EDIT.
|
Code generated by gommon from util/color/color_generated.go.tmpl DO NOT EDIT. |
|
Package hashutil provides alloc free alternatives for pkg/hash
|
Package hashutil provides alloc free alternatives for pkg/hash |