$ git clone https://github.com/golang/vgo
$ find ./vgo -name "*.go" |xargs grep "zip file too large"
./vendor/cmd/go/internal/modfetch/coderepo.go: return "", fmt.Errorf("downloaded zip file too large")
./vendor/cmd/go/internal/modfetch/proxy.go: return "", fmt.Errorf("downloaded zip file too large")
./vendor/cmd/go/internal/modfetch/coderepo.go:
maxSize := int64(codehost.MaxZipFile)
lr := &io.LimitedReader{R: dl, N: maxSize + 1}
if _, err := io.Copy(f, lr); err != nil {
dl.Close()
return "", err
}
dl.Close()
if lr.N <= 0 {
return "", fmt.Errorf("downloaded zip file too large")
}
./vendor/cmd/go/internal/modfetch/codehost/codehost.go:
// Downloaded size limits.
const (
MaxGoMod = 16 << 20 // maximum size of go.mod file
MaxLICENSE = 16 << 20 // maximum size of LICENSE file
MaxZipFile = 100 << 20 // maximum size of downloaded zip file
)
https://github.com/ikawaha/kagome/releases/tag/v1.7.1
$ wget https://github.com/ikawaha/kagome/archive/v1.7.1.zip
$ ls -l v1.7.1.zip
-rw-r--r--@ 1 deltam staff 133686181 May 16 22:00 v1.7.1.zip
MaxZipFile = 100 << 20 = 104857600
$ git blame vendor/cmd/go/internal/modfetch/codehost/codehost.go
3579ffcf (Russ Cox 2018-04-17 16:35:23 -0400 27) MaxZipFile = 100 << 20 // maximum size of downloaded zip file
Why is the maximum size of downloaded zip file 100 << 20
?