在我的基于Golang的基于Web的项目中,需要从相对位置读取配置文件,读取如下配置文件代码
configMap, err :=publicutil.GetCurrentDirectory()+"/"+Const_HDFSPathPatternElm_configFilePath+"/hdfs-conf.xml"
在VSCode中执行运行代码,遇到以下错误
panic: open C:/Users/50806/AppData/Local/Temp/go-build130778702/b001/exe/hadoop-conf/hdfs-site.xml: The system cannot find the path specified.
以上错误日志中的位置是代码运行者的临时构建,因此如何使用特定位置配置代码运行器来运行项目,因此我可以将该配置文件复制到该位置。
P.S我不会重新编写代码以读取配置文件。