问题现象
在开发机上升级到了最新 golang 1.16.3 版本,在为一个基于 golang 1.13 的历史项目添加 excel 依赖包后
go get github.com/360EntSecGroup-Skylar/excelize/v2
编译报错:
go build ../../../golang/pkg/mod/golang.org/x/crypto@v0.0.0-20201012173705-84dcc777aaee/blake2b/blake2bAVX2_amd64.go:9:8: missing go.sum entry for module providing package golang.org/x/sys/cpu (imported by golang.org/x/crypto/blake2b); to add: go get golang.org/x/crypto/blake2b@v0.0.0-20201012173705-84dcc777aaee ../../../golang/pkg/mod/github.com/mattn/go-isatty@v0.0.8/isatty_tcgets.go:7:8: missing go.sum entry for module providing package golang.org/x/sys/unix (imported by github.com/mattn/go-isatty); to add: go get github.com/mattn/go-isatty@v0.0.8
主要错误就是这个
missing go.sum entry for module providing package xxx
golang 版本
go version
go version go1.16.5 windows/amd64
解决方法
go mod tidy
go mod tidy 的作用
go mod tidy removes unused dependencies.
即,移除未使用的依赖。