There is such an application structure
./ ├── conf │ └── conf.go ├── helpers │ └── helpers.go ├── config.cfg └── main.go in main.go:
import ( "./conf" "./helpers" "fmt" ... ) var cfg conf.Config func init() { cfg = make(conf.Config) cfg.Parse("config.cfg") } func main () { fmt.Print(cfg["variable"]) } In /helpers/helpers.go I want to use cfg :
func Helper() { fmt.Print(cfg["variable"]) } But when compiling I get the expected error helpers/helpers.go:10: undefined: cfg . How can I access cfg in helpers / helpers.go?