纠正以下go代码:package confconst env = devvar devConf = mapstringinterface port 8080var prodConf = mapstringinterface port 80var Conf = prodConfifenv==dev Conf = devConf
package conf
const env = "dev"
var devConf = map[string]interface{}{ "port": 8080, }
var prodConf = map[string]interface{}{ "port": 80, }
var Conf map[string]interface{}
func init() { if env == "dev" { Conf = devConf } else { Conf = prodConf } }
原文地址: http://www.cveoy.top/t/topic/GCJ 著作权归作者所有。请勿转载和采集!