From 598c606a99a003787712b559b38ae6034fd7e4e7 Mon Sep 17 00:00:00 2001 From: criyle Date: Fri, 5 Apr 2024 04:24:10 +0000 Subject: [PATCH] deps: upgrade to rand/v2 --- container/container_init_linux.go | 2 +- go.mod | 6 ++---- go.sum | 12 ++++++------ pkg/cgroup/utils_linux.go | 8 ++++---- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/container/container_init_linux.go b/container/container_init_linux.go index 479701a..df958d9 100644 --- a/container/container_init_linux.go +++ b/container/container_init_linux.go @@ -310,7 +310,7 @@ func (c *containerServer) sendReplyFiles(rep reply, msg unixsocket.Msg, fileToCl case <-c.done: return c.err - case c.sendCh <- sendReply{Reply: rep, Msg: msg}: + case c.sendCh <- sendReply{Reply: rep, Msg: msg, FileToClose: fileToClose}: return nil } } diff --git a/go.mod b/go.mod index dbae146..6d97868 100644 --- a/go.mod +++ b/go.mod @@ -4,8 +4,6 @@ go 1.21 require ( github.com/elastic/go-seccomp-bpf v1.4.0 - golang.org/x/net v0.20.0 - golang.org/x/sys v0.16.0 + golang.org/x/net v0.24.0 + golang.org/x/sys v0.19.0 ) - -require github.com/stretchr/testify v1.8.4 // indirect diff --git a/go.sum b/go.sum index 8e5e44b..ece2777 100644 --- a/go.sum +++ b/go.sum @@ -4,11 +4,11 @@ github.com/elastic/go-seccomp-bpf v1.4.0 h1:6y3lYrEHrLH9QzUgOiK8WDqmPaMnnB785Wxi github.com/elastic/go-seccomp-bpf v1.4.0/go.mod h1:wIMxjTbKpWGQk4CV9WltlG6haB4brjSH/dvAohBPM1I= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/cgroup/utils_linux.go b/pkg/cgroup/utils_linux.go index 6a1c233..0a76fd1 100644 --- a/pkg/cgroup/utils_linux.go +++ b/pkg/cgroup/utils_linux.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" "io/fs" - "math/rand" + "math/rand/v2" "os" "path" "strconv" @@ -148,15 +148,15 @@ func readFile(p string) ([]byte, error) { } func writeFile(p string, content []byte, perm fs.FileMode) error { - err := os.WriteFile(p, content, filePerm) + err := os.WriteFile(p, content, perm) for err != nil && errors.Is(err, syscall.EINTR) { - err = os.WriteFile(p, content, filePerm) + err = os.WriteFile(p, content, perm) } return err } func nextRandom() string { - return strconv.Itoa(int(rand.Int31())) + return strconv.Itoa(int(rand.Int32())) } // randomBuild creates a cgroup with random directory, similar to os.MkdirTemp