// // param.go // Copyright (C) 2022 tiglog // // Distributed under terms of the MIT license. // package gconfig import ( "io/ioutil" "gopkg.in/yaml.v2" "git.hexq.cn/tiglog/golib/gfile" ) type ParamConfig struct { Params map[string]any } func (c *ParamConfig) Load(fp string) { if !gfile.Exists(fp) { panic("配置文件 " + fp + " 不存在") } dat, err := ioutil.ReadFile(fp) if err != nil { panic(err) } err = yaml.Unmarshal(dat, &c.Params) if err != nil { panic(err) } }