tConfig := ReadConfig(mConfig{}, aPath)
fmt.Println(reflect.TypeOf(tConfig))
输出:map[string]interface {}
fmt.Println(tConfig)
输出:map[driverName:mysql dataSourceName:root:cat123@tcp(localhost:3306)/dnf_log?charset=utf8]
fmt.Println(tConfig["driverName"])
报错: invalid operation: tConfig["driverName"] (type interface {} does not support indexing)
使用断点查看。发现tConfig的类型其实是
所以不能使用索引方式来进行读取。那么我想读取driverName的内容应该怎么做~~ 搞了一下午没搞定~~~求大神帮忙~
有疑问加站长微信联系(非本文作者)

interface类型索引? 先转类型吧
tConfig 类型断言成map[string]interface{}
我的没有报错耶。。
我的没有报错耶。。。