mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 21:08:10 -05:00
Move Shared Packages into Math/ and IO/ (#9622)
* amend * building * build * userprompt * imports * build val * gaz * io file Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Package properpermissions implements a static analyzer to ensure that Prysm does not
|
||||
// use ioutil.MkdirAll or os.WriteFile as they are unsafe when it comes to guaranteeing
|
||||
// file permissions and not overriding existing permissions. Instead, users are warned
|
||||
// to utilize shared/fileutil as the canonical solution.
|
||||
// to utilize shared/file as the canonical solution.
|
||||
package properpermissions
|
||||
|
||||
import (
|
||||
@@ -19,7 +19,7 @@ const Doc = "Tool to enforce usage of Prysm's internal file-writing utils instea
|
||||
|
||||
var (
|
||||
errUnsafePackage = errors.New(
|
||||
"os and ioutil dir and file writing functions are not permissions-safe, use shared/fileutil",
|
||||
"os and ioutil dir and file writing functions are not permissions-safe, use shared/file",
|
||||
)
|
||||
disallowedFns = []string{"MkdirAll", "WriteFile"}
|
||||
)
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
func UseAliasedPackages() {
|
||||
randPath, _ := rand.Int(rand.Reader, big.NewInt(1000000))
|
||||
p := filepath.Join(tempDir(), fmt.Sprintf("/%d", randPath))
|
||||
_ = osAlias.MkdirAll(p, osAlias.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/fileutil"
|
||||
_ = osAlias.MkdirAll(p, osAlias.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/file"
|
||||
someFile := filepath.Join(p, "some.txt")
|
||||
_ = ioAlias.WriteFile(someFile, []byte("hello"), osAlias.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/fileutil"
|
||||
_ = ioAlias.WriteFile(someFile, []byte("hello"), osAlias.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/file"
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ func tempDir() string {
|
||||
func UseOsMkdirAllAndWriteFile() {
|
||||
randPath, _ := rand.Int(rand.Reader, big.NewInt(1000000))
|
||||
p := filepath.Join(tempDir(), fmt.Sprintf("/%d", randPath))
|
||||
_ = os.MkdirAll(p, os.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/fileutil"
|
||||
_ = os.MkdirAll(p, os.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/file"
|
||||
someFile := filepath.Join(p, "some.txt")
|
||||
_ = ioutil.WriteFile(someFile, []byte("hello"), os.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/fileutil"
|
||||
_ = ioutil.WriteFile(someFile, []byte("hello"), os.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/file"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user