package main import ( "encoding/json" "fmt" "os" ) type Config struct { Method string `json:method` OutputDir string `json:outputdir` InputDir string `json:inputdir` BaseImage string `json:baseimage` } // loads configuration values from json file func (c *Config) LoadConfigFromFile(filePath string) { file, _ := os.Open("conf.json") defer file.Close() decoder := json.NewDecoder(file) configuration := Config{} err := decoder.Decode(&configuration) if err != nil { fmt.Println("error:", err) } fmt.Println(configuration.Method) fmt.Println(configuration.OutputDir) } // global register to acccess configuration values var ConfigRegister Config