Documentation ¶
Overview ¶
Package config provides a simple facility for loading configuration file.
Example ¶
package main import ( "fmt" "gitee.com/erdian718/config" ) // Config represents the configuration information. type Config struct { Default string Value string } func main() { cfg := Config{ Default: "default", // The default value. } if err := config.Load(&cfg, config.ExecDir(), "config.json"); err != nil { panic(err) } fmt.Println(cfg.Default) fmt.Println(cfg.Value) }
Output: default value
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecDir ¶
func ExecDir() string
ExecDir returns the directory of the executable that started the current process. This function is goroutine safe.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.