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的类型其实是![image.png](https://static.studygolang.com/190130/f78698cec6c341a4a76b1766023c56c3.png)
所以不能使用索引方式来进行读取。那么我想读取driverName的内容应该怎么做~~
搞了一下午没搞定~~~求大神帮忙~
![微信截图_20190131171444.png](https://static.studygolang.com/190131/ba2e0f0e95e4e1f1374e6bcfe197004b.png)
#3
更多评论