prysm-pulse/tools/analyzers/properpermissions/testdata/custom_imports.go
Håvard Anda Estensen d2f4a8cc7c
Replace ioutil with io and os (#10541)
* Replace ioutil with io and os

* Fix build errors
2022-04-18 20:42:07 +00:00

19 lines
617 B
Go

package testdata
import (
"crypto/rand"
"fmt"
"math/big"
osAlias "os"
"path/filepath"
)
// UseAliasedPackages --
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/file"
someFile := filepath.Join(p, "some.txt")
_ = osAlias.WriteFile(someFile, []byte("hello"), osAlias.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/file"
}