arch linux中安装yay,makepkg -si 的时候出错,提示 :

[sh@lenovo yay]$ makepkg -si ==> Making package: yay 10.3.0-1 (Sun 18 Jul 2021 05:37:26 PM CST) ==> Checking runtime dependencies... ==> Checking buildtime dependencies... ==> Retrieving sources... -> Found yay-10.3.0.tar.gz ==> Validating source files with sha256sums... yay-10.3.0.tar.gz ... Passed ==> Extracting sources... -> Extracting yay-10.3.0.tar.gz with bsdtar ==> Removing existing $pkgdir/ directory... ==> Starting build()... go build -trimpath -mod=readonly -modcacherw -ldflags '-X "main.yayVersion=10.3.0" -X "main.localePath=/usr/share/locale/" -linkmode=external' -buildmode=pie -o yay go: github.com/Jguer/aur@v1.0.0: Get "https://proxy.golang.org/github.com/%21jguer/aur/@v/v1.0.0.mod": dial tcp 216.58.200.49:443: i/o timeout make: *** [Makefile:111: yay] Error 1 ==> ERROR: A failure occurred in build(). Aborting...

经过搜索,发现是国内无法访问 https://proxy.golang.org/github.com/%21jguer/aur/@v/v1.0.0.mod 导致的。

https://goproxy.cn/   是国内代理,使用方法:

$ go env -w GO111MODULE=on $ go env -w GOPROXY=https://goproxy.cn,direct

这样设置后使用go env看都已经改过来了,但是还是同样都错误,不知是什么原因。

最终,在终端里执行下面两行再执行makepkg -si 就OK了。

$ export GO111MODULE=on $ export GOPROXY=https://goproxy.cn