问题描述:在对minio源码进行build时出现下面错误
[minio]# go build
go: cloud.google.com/go@v0.39.0 requires
golang.org/x/text@v0.3.1-0.20180807135948-17ff2d5776d2: invalid version: git fetch --unshallow -f origin in /root/go/pkg/mod/cache/vcs/38515699458adac9c8b61a0b44f9ad7a5f6edd7bcc2d7fae95930ec78f71e1b4: exit status 128:
fatal: git fetch-pack: expected shallow list
VScode中的错误信息
{
“resource”: “/…/minio/cmd/fs-v1.go”,
“owner”: “go”,
“severity”: 8,
“message”: “go: github.com/nats-io/nats-server/v2@v2.1.7 requires\n\tgoogle.golang.org/protobuf@v1.22.0 requires\n\tgithub.com/golang/protobuf@v1.4.0 requires\n\tgoogle.golang.org/protobuf@v1.21.0 requires\n\tgithub.com/golang/protobuf@v1.4.0-rc.4.0.20200313231945-b860323f09d0: invalid version: git fetch --unshallow -f origin in /…/go/pkg/mod/cache/vcs/6e18cbff36266c74e48dd81b4b672026ac74fb69c838ddb6240f256bb8edf590: exit status 128:\n\tfatal: git fetch-pack: expected shallow list\n”,
“source”: “go”,
“startLineNumber”: 1,
“startColumn”: 1,
“endLineNumber”: 1,
“endColumn”: 3
}
环境:机器在美国;redhat 7.7
解决方法:
原本系统中go由 yum install go安装,版本为1.15.2
后来从官网下载安装了 go 1.15.4 编译成功
Install Go on linux
wget https://golang.google.cn/doc/install?download=go1.15.4.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.15.4.linux-amd64.tar.gz
vim /etc/profile
//add at the end
export PATH=$PATH:/usr/local/go/bin
source /etc/profile