use sys/unix package instead of syscall (#1340)

According to the golang docs, the syscall package is deprecated.
https://golang.org/pkg/syscall
This updates collectors to use the x/sys/unix package instead.
Also updates the vendored x/sys/unix module to latest.

Signed-off-by: Paul Gier <pgier@redhat.com>
This commit is contained in:
Paul Gier 2019-05-10 13:04:06 -05:00 committed by Ben Kochie
commit d0a66c4c40
39 changed files with 2942 additions and 19 deletions

View file

@ -23,10 +23,10 @@ import (
"regexp"
"strconv"
"strings"
"syscall"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/log"
"golang.org/x/sys/unix"
)
var (
@ -86,9 +86,9 @@ func sysReadFile(file string) ([]byte, error) {
// Go's ioutil.ReadFile implementation to poll forever.
//
// Since we either want to read data or bail immediately, do the simplest
// possible read using syscall directly.
// possible read using system call directly.
b := make([]byte, 128)
n, err := syscall.Read(int(f.Fd()), b)
n, err := unix.Read(int(f.Fd()), b)
if err != nil {
return nil, err
}