Wednesday, June 16, 2021
"fatal: git fetch-pack: expected shallow list" golang build error (CentOS 7)
Ran into an error like the following when trying to build etcd as a CentOS 7 package:
go: github.com/prometheus/client_golang@v1.0.0 requires github.com/prometheus/common@v0.4.1 requires github.com/prometheus/procfs@v0.0.0-20181005140218-185b4288413d: invalid version: git fetch --unshallow -f origin in /root/go/pkg/mod/cache/vcs/0ab7c7bc964e6f4054247fed3ac8d636309918420efe8a7cabef12d9f9904311: exit status 128: fatal: git fetch-pack: expected shallow list
or sometimes this:
go: golang.org/x/crypto@v0.0.0-20200622213623-75b288015ac9 requires golang.org/x/net@v0.0.0-20190404232315-eb5bcb51f2a3 requires golang.org/x/crypto@v0.0.0-20190308221718-c2843e01d9a2: invalid version: git fetch --unshallow -f origin in /root/go/pkg/mod/cache/vcs/f72f7a6f267d2fe79b1e174efab21a591b07c84ef53364f65b8281fda7000b49: exit status 128: fatal: git fetch-pack: expected shallow list
The mysterious thing was, the build had previously completed without issue many times, and there were no obvious changes in any of the build elements involved.
This issue does resemble that described in golang GitHub issue #38373; the workaround suggested by the poster involves resolving version references in the go.mod
file. However that did not seem feasible for this build, which indirectly pulls in a large number of golang modules from various git repositories, which would make tracking down any version reference issues a somewhat Herculean task.
It was however possible to resolve the error (as suggested in a comment on the issue) by upgrading the git
package to a more recent one, as the default CentOS 7 version is a very dated 1.8.x (released in 2014 or earlier).
Recent git packages for CentOS 7 can be obtained from the Endpoint repository here: https://packages.endpoint.com/rhel/7/os/x86_64/.
Posted at 6:19 AM |Comments (0)