go mod tidy报错:zip: not a valid zip file

go mod tidy报错:zip: not a valid zip file

go get报错:zip: not a valid zip file

具体报错:

User@3-WIN10BG0088 MINGW64 /d/Users/WorkSpace/Go/projects/gin-study
$ go get github.***/gin-gonic/gin
go: downloading github.***/gin-gonic/gin v1.9.1
go: github.***/gin-gonic/gin: zip: not a valid zip file

User@3-WIN10BG0088 MINGW64 /d/Users/WorkSpace/Go/projects/gin-study
$ go env | grep PROXY
set GONOPROXY=
set GOPROXY=https://mirrors.aliyun.***/goproxy/,direct

解决方式:

方式1:执行 go clean -modcache清理缓存(无效)
User@3-WIN10BG0088 MINGW64 /d/Users/WorkSpace/Go/projects/gin-study
$ go clean -modcache

User@3-WIN10BG0088 MINGW64 /d/Users/WorkSpace/Go/projects/gin-study
$ go mod tidy
go: finding module for package github.***/gin-gonic/gin
go: downloading github.***/gin-gonic/gin v1.9.1
go: github.***/ice-fire-song/gin-study imports
        github.***/gin-gonic/gin: zip: not a valid zip file
方式2:更换GOPROXY为七牛云的go代理(有效)
User@3-WIN10BG0088 MINGW64 /d/Users/WorkSpace/Go/projects/gin-study
$ go env -w GOPROXY="https://goproxy.***,direct"

User@3-WIN10BG0088 MINGW64 /d/Users/WorkSpace/Go/projects/gin-study
$ go env|grep PROXY
set GONOPROXY=
set GOPROXY=https://goproxy.***,direct

User@3-WIN10BG0088 MINGW64 /d/Users/WorkSpace/Go/projects/gin-study
$ go mod tidy
go: finding module for package github.***/gin-gonic/gin
go: downloading github.***/gin-gonic/gin v1.9.1
go: found github.***/gin-gonic/gin in github.***/gin-gonic/gin v1.9.1
go: downloading github.***/gin-contrib/sse v0.1.0
go: downloading github.***/mattn/go-isatty v0.0.19
go: downloading golang.org/x/*** v0.10.0
go: downloading github.***/stretchr/testify v1.8.3
go: downloading google.golang.org/protobuf v1.30.0
go: downloading github.***/go-playground/validator/v10 v10.14.0
go: downloading github.***/pelletier/go-toml/v2 v2.0.8
go: downloading github.***/ugorji/go/codec v1.2.11
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.***/bytedance/sonic v1.9.1
go: downloading github.***/go***y/go-json v0.10.2
go: downloading github.***/json-iterator/go v1.1.12
go: downloading golang.org/x/sys v0.8.0
go: downloading github.***/davecgh/go-spew v1.1.1
go: downloading github.***/pmezard/go-difflib v1.0.0
go: downloading github.***/gabriel-vasile/mimetype v1.4.2
go: downloading github.***/go-playground/universal-translator v0.18.1
go: downloading github.***/leodido/go-urn v1.2.4
go: downloading golang.org/x/crypto v0.9.0
go: downloading golang.org/x/text v0.9.0
go: downloading github.***/go-playground/locales v0.14.1
go: downloading github.***/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: downloading github.***/modern-go/reflect2 v1.0.2
go: downloading github.***/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311
go: downloading golang.org/x/arch v0.3.0
go: downloading github.***/twitchyliquid64/golang-asm v0.15.1
go: downloading github.***/klauspost/cpuid/v2 v2.2.4
go: downloading github.***/go-playground/assert/v2 v2.2.0
go: downloading github.***/google/go-cmp v0.5.5
go: downloading gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
go: downloading golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
转载请说明出处内容投诉
CSS教程_站长资源网 » go mod tidy报错:zip: not a valid zip file

发表评论

欢迎 访客 发表评论

一个令你着迷的主题!

查看演示 官网购买