2019-06-26 07:44:52 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
// +build ignore
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
|
|
|
|
"storj.io/storj/internal/memory"
|
|
|
|
)
|
|
|
|
|
2019-09-05 14:32:46 +01:00
|
|
|
var ignoreFolder = map[string]bool{
|
2019-10-02 13:22:35 +01:00
|
|
|
".build": true,
|
2019-09-05 14:32:46 +01:00
|
|
|
".git": true,
|
|
|
|
"node_modules": true,
|
|
|
|
"coverage": true,
|
|
|
|
"dist": true,
|
|
|
|
}
|
|
|
|
|
2019-06-26 07:44:52 +01:00
|
|
|
func main() {
|
2019-09-12 18:54:44 +01:00
|
|
|
const fileSizeLimit = 650 * memory.KB
|
2019-06-26 07:44:52 +01:00
|
|
|
|
|
|
|
var failed int
|
|
|
|
|
|
|
|
err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
return nil
|
|
|
|
}
|
2019-09-05 14:32:46 +01:00
|
|
|
if info.IsDir() && ignoreFolder[info.Name()] {
|
2019-06-26 07:44:52 +01:00
|
|
|
return filepath.SkipDir
|
|
|
|
}
|
|
|
|
|
|
|
|
size := memory.Size(info.Size())
|
|
|
|
if size > fileSizeLimit {
|
|
|
|
failed++
|
|
|
|
fmt.Printf("%v (%v)\n", path, size)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if failed > 0 {
|
|
|
|
fmt.Printf("some files were over size limit %v\n", fileSizeLimit)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|