From 8292b073e3c10e41e41a3790071a5da03cd49986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Pa=C3=9F?= <22845248+mpass99@users.noreply.github.com> Date: Thu, 23 Nov 2023 14:27:01 +0100 Subject: [PATCH] Remove deprecated `syscall` dependency. --- cmd/poseidon/main.go | 6 +++--- cmd/poseidon/main_test.go | 4 ++-- go.mod | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/poseidon/main.go b/cmd/poseidon/main.go index b92fb30..814cca8 100644 --- a/cmd/poseidon/main.go +++ b/cmd/poseidon/main.go @@ -12,6 +12,7 @@ import ( "github.com/openHPI/poseidon/internal/runner" "github.com/openHPI/poseidon/pkg/logging" "github.com/openHPI/poseidon/pkg/monitoring" + "golang.org/x/sys/unix" "net/http" "os" "os/signal" @@ -19,7 +20,6 @@ import ( "runtime/debug" "runtime/pprof" "strconv" - "syscall" "time" ) @@ -243,11 +243,11 @@ func initServer(ctx context.Context) *http.Server { func shutdownOnOSSignal(server *http.Server, ctx context.Context, stopProfiling func()) { // wait for SIGINT shutdownSignals := make(chan os.Signal, 1) - signal.Notify(shutdownSignals, syscall.SIGINT, syscall.SIGTERM) + signal.Notify(shutdownSignals, unix.SIGINT, unix.SIGTERM) // wait for SIGUSR1 writeProfileSignal := make(chan os.Signal, 1) - signal.Notify(writeProfileSignal, syscall.SIGUSR1) + signal.Notify(writeProfileSignal, unix.SIGUSR1) select { case <-ctx.Done(): diff --git a/cmd/poseidon/main_test.go b/cmd/poseidon/main_test.go index 1870cb0..9150ca8 100644 --- a/cmd/poseidon/main_test.go +++ b/cmd/poseidon/main_test.go @@ -6,7 +6,7 @@ import ( "github.com/openHPI/poseidon/internal/runner" "github.com/openHPI/poseidon/tests" "github.com/stretchr/testify/suite" - "syscall" + "golang.org/x/sys/unix" "testing" "time" ) @@ -57,7 +57,7 @@ func (s *MainTestSuite) TestShutdownOnOSSignal_Profiling() { }) <-time.After(tests.ShortTimeout) - err := syscall.Kill(syscall.Getpid(), syscall.SIGUSR1) + err := unix.Kill(unix.Getpid(), unix.SIGUSR1) s.Require().NoError(err) <-time.After(tests.ShortTimeout) diff --git a/go.mod b/go.mod index 2a39e8b..b1a1573 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/mitchellh/mapstructure v1.5.0 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.8.4 + golang.org/x/sys v0.13.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -143,7 +144,6 @@ require ( golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.13.0 // indirect