Go 程序编译报错: undefined: toml.TreeFromMap 和 toml.LoadBytes
这个错误是因为在编译过程中缺少了对 'toml.TreeFromMap' 和 'toml.LoadBytes' 的定义。这些函数是来自于 'github.com/BurntSushi/toml' 包。
要解决这个问题,您需要在您的项目中导入 'github.com/BurntSushi/toml' 包并确保已正确安装它。您可以使用以下命令安装该包:
go get github.com/BurntSushi/toml
然后,在您的代码中添加以下导入语句:
import "github.com/BurntSushi/toml"
这样就可以解决编译错误了。
原文地址: https://www.cveoy.top/t/topic/pMIT 著作权归作者所有。请勿转载和采集!