mirror of
https://github.com/openfaas/faas.git
synced 2025-06-23 07:13:23 +00:00
Upgrade x/sync, Prometheus client and faas-provider
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
This commit is contained in:
11
gateway/vendor/github.com/prometheus/procfs/internal/util/readfile.go
generated
vendored
11
gateway/vendor/github.com/prometheus/procfs/internal/util/readfile.go
generated
vendored
@ -15,17 +15,16 @@ package util
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
// ReadFileNoStat uses ioutil.ReadAll to read contents of entire file.
|
||||
// This is similar to ioutil.ReadFile but without the call to os.Stat, because
|
||||
// ReadFileNoStat uses io.ReadAll to read contents of entire file.
|
||||
// This is similar to os.ReadFile but without the call to os.Stat, because
|
||||
// many files in /proc and /sys report incorrect file sizes (either 0 or 4096).
|
||||
// Reads a max file size of 512kB. For files larger than this, a scanner
|
||||
// Reads a max file size of 1024kB. For files larger than this, a scanner
|
||||
// should be used.
|
||||
func ReadFileNoStat(filename string) ([]byte, error) {
|
||||
const maxBufferSize = 1024 * 512
|
||||
const maxBufferSize = 1024 * 1024
|
||||
|
||||
f, err := os.Open(filename)
|
||||
if err != nil {
|
||||
@ -34,5 +33,5 @@ func ReadFileNoStat(filename string) ([]byte, error) {
|
||||
defer f.Close()
|
||||
|
||||
reader := io.LimitReader(f, maxBufferSize)
|
||||
return ioutil.ReadAll(reader)
|
||||
return io.ReadAll(reader)
|
||||
}
|
||||
|
Reference in New Issue
Block a user