v2ray/ext

tools/build/v2ray.go: GOPATH 不应直接被用于组成 releaseDir

Closed this issue · 2 comments

根据 go 官方对 GOPATH 的定义:

The GOPATH environment variable lists places to look for Go code.
On Unix, the value is a colon-separated string.
On Windows, the value is a semicolon-separated string.
On Plan 9, the value is a list.

在 Linux 下,GOPATH 包含多个路径(使用冒号分割)时。在 genRegularTarget 函数中会导致拼接出错误的源路径,导致如下错误:

Building V2Ray (custom) for linux amd64
Failed to build V2Ray on amd64 for linux with error open /var/tmp/portage/net-proxy/v2ray-3.21/work/v2ray-3.21:/usr/lib/go-gentoo/src/v2ray.com/core/release/config/geoip.dat: no such file or directory

另: build/vbuild 报错时返回值仍然是 0 。

strings.Split(os.Getenv("GOPATH"), string(os.PathListSeparator)) may help

Golang 官方也推荐使用单一路径用于 GOPATH: https://github.com/golang/go/wiki/GOPATH

临时的解决方案是:GOPATH=/path/to/v2ray vbuild