package main import ( "fmt" "net/http" "./models" ) // Global variables var config map[string]*models.Config func indexHandler(w http.ResponseWriter, r *http.Request) { // Use config fmt.Println(config["Keywords"]) // Prints nil - why? } func main() { config := models.Conf() fmt.Println(config.Keywords) // Prints "keywords1" // Routes http.HandleFunc("/", indexHandler) // Get port http.ListenAndServe(":3000", nil) }