The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
304464743

关于读取 yaml

  •  
  •   304464743 · Apr 7, 2019 · 3098 views
    This topic created in 2615 days ago, the information mentioned may be changed or developed.

    本人初学者,想问下 go 读取 yaml 文件后能否像 python 一样直接按字典那样引用? 比如在 python 中,直接读入转换成字典后就可以 dict['global']['aa'] 引用

    而 go 中,make 新建字典(map[string]interface{})后,只可以引用第一层,引用到第二层好像就变成字符串了 dict['global']可以,dict['global']['aa']就报错了。参考了下 prometheus 的代码,是要定义 struct 和 yaml 中的格式一模一样,觉得这样太麻烦了,所以想问下能否像 python 那样?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5377 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 08:51 · PVG 16:51 · LAX 01:51 · JFK 04:51
    ♥ Do have faith in what you're doing.