1.安装依赖环境
yum install go -y
2.安装go-torch工具
[[email protected] x]# go get -v github.com/uber/go-torch
package golang.org/x/sys/unix: unrecognized import path "golang.org/x/sys/unix" (https fetch: Get https://golang.org/x/sys/unix?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
由于国内网络问题有点代码下载不了,可以通过如下方式处理
来到这个目录下,这个是golang的代码库
[[email protected] x]# pwd
/usr/share/gocode/src/golang.org/x
unrecognized import path "golang.org/x/sys/unix"
这个报错需要通过克隆github上的文件来解决
[[email protected] x]# git clone https://github.com/golang/sys.git
git clone https://github.com/golang/crypto.git
git clone https://github.com/golang/net.git
yum install glide -y
替换路径
glide mirror set https://golang.org/x/net https://github.com/golang/net --vcs git
编译go的环境变量
[[email protected] bin]# tail -f /etc/profile
export GOPATH=/usr/share/gocode
[[email protected] x]# source /etc/profile
[[email protected] x]# go get github.com/uber/go-torch
[[email protected] x]# cd /usr/share/gocode/
[[email protected] gocode]# ls
bin src
[[email protected] gocode]# cd bin/
[[email protected] bin]# ls
go-torch