Help us shape the future of Go! Take the 2026 Go Developer Survey

platform

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppDir

func AppDir() (string, error)

AppDir 返回当前可执行文件所在的目录。

func BundledModelsDir

func BundledModelsDir(appDir string) string

BundledModelsDir 返回打包自带的模型目录路径(绝对路径)。

func DataDir

func DataDir() string

DataDir 返回应用数据目录(绝对路径)。 Windows 返回可执行文件所在目录(单目录安装模式),其他平台返回 ~/Goink/。 开发模式下 exe 位于临时目录时,所有平台统一返回 ~/Goink/。 环境变量 GOINK_DATA_DIR 可覆盖以上逻辑,用于集成测试。

func ResolveGit

func ResolveGit() (string, error)

ResolveGit 返回 git 可执行文件的路径。 搜索顺序: app 自带 runtime/git/ → 用户数据目录 runtime/git/ → 系统 PATH。 每个候选路径都会验证可执行性(git --version),不可用则跳过继续 fallback。

当环境变量 GOINK_TESTING=1 时,仅从 DataDir 的 bundled 路径查找, 不 fallback 到系统 PATH,找不到直接报错。用于 E2E 测试确保使用 bundled git。

func ResolveOnnxLib

func ResolveOnnxLib() (string, error)

ResolveOnnxLib 返回 ONNX Runtime 动态库的路径。 优先 app 自带的 runtime/,然后用户数据目录 runtime/,最后系统路径。

当环境变量 GOINK_TESTING=1 时,仅从 DataDir 的 runtime/ 查找, 不 fallback 到系统路径,找不到直接报错。用于 E2E 测试确保使用 bundled ONNX。

func SetPlatformAttr

func SetPlatformAttr(*exec.Cmd)

SetPlatformAttr 为子进程设置平台相关属性(非 Windows 平台为空操作)。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL