Closed smiecj closed 4 years ago
希望可以在config.go 中,把DICT_DIR 设置成可通过环境变量配置的方式(如:检查环境变量 DICT_PATH 是否为空,如果不为空就优先用环境变量的配置)。否则如果发布环境和编译环境是区分开的,发布环境没有go 依赖的文件,就无法获取单词库了。
相关方法: func getCurrentFilePath() string { _, filePath, _, _ := runtime.Caller(1) return filePath }
func getCurrentFilePath() string { _, filePath, _, _ := runtime.Caller(1) return filePath }
已经找到解决方法啦,DICT_DIR 可以直接修改的。。迷糊了
希望可以在config.go 中,把DICT_DIR 设置成可通过环境变量配置的方式(如:检查环境变量 DICT_PATH 是否为空,如果不为空就优先用环境变量的配置)。否则如果发布环境和编译环境是区分开的,发布环境没有go 依赖的文件,就无法获取单词库了。
相关方法:
func getCurrentFilePath() string { _, filePath, _, _ := runtime.Caller(1) return filePath }