Skip to content

路径

go
	// 执行文件 的 绝对路径
	exePath, err := os.Executable() 
	if err != nil {
		panic(err)
	}
	// 目录
	exeDir := filepath.Dir(exePath) 

    // 拼接配置文件绝对路径
	configPath := filepath.Join(exeDir, "config.yaml")