使用代码运行器在vs代码中运行golang项目时如何设置配置文件位置

时间:2020-02-25 02:57:49

标签: visual-studio-code vscode-code-runner

在我的基于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我不会重新编写代码以读取配置文件。

0 个答案:

没有答案