diff --git a/Dockerfile b/Dockerfile index ccbcdfe..847e6f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG VPP_VERSION=v20.09 FROM ghcr.io/edwarnicke/govpp/vpp:${VPP_VERSION} as go -COPY --from=golang:1.15.3-buster /usr/local/go/ /go +COPY --from=golang:1.16.3-buster /usr/local/go/ /go ENV PATH ${PATH}:/go/bin ENV GO111MODULE=on ENV CGO_ENABLED=0 diff --git a/internal/imports/imports_linux.go b/internal/imports/imports_linux.go index b4a8069..abccb1c 100644 --- a/internal/imports/imports_linux.go +++ b/internal/imports/imports_linux.go @@ -28,7 +28,6 @@ import ( _ "github.com/networkservicemesh/sdk/pkg/tools/log" _ "github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger" _ "github.com/networkservicemesh/sdk/pkg/tools/opentracing" - _ "github.com/networkservicemesh/sdk/pkg/tools/signalctx" _ "github.com/networkservicemesh/sdk/pkg/tools/spiffejwt" _ "github.com/pkg/errors" _ "github.com/sirupsen/logrus" @@ -40,6 +39,8 @@ import ( _ "net" _ "net/url" _ "os" + _ "os/signal" _ "path/filepath" + _ "syscall" _ "time" ) diff --git a/main.go b/main.go index 43e3d2e..1835a19 100644 --- a/main.go +++ b/main.go @@ -24,7 +24,9 @@ import ( "net" "net/url" "os" + "os/signal" "path/filepath" + "syscall" "time" nested "github.com/antonfisher/nested-logrus-formatter" @@ -59,7 +61,6 @@ import ( "github.com/networkservicemesh/sdk/pkg/tools/log" "github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger" "github.com/networkservicemesh/sdk/pkg/tools/opentracing" - "github.com/networkservicemesh/sdk/pkg/tools/signalctx" "github.com/networkservicemesh/sdk/pkg/tools/spiffejwt" ) @@ -90,9 +91,8 @@ func main() { // ******************************************************************************** // setup context to catch signals // ******************************************************************************** - ctx := signalctx.WithSignals(context.Background()) - ctx, cancel := context.WithCancel(ctx) - + ctx, cancel := notifyContext() + defer cancel() // ******************************************************************************** // setup logging // ******************************************************************************** @@ -281,3 +281,14 @@ func exitOnErr(ctx context.Context, cancel context.CancelFunc, errCh <-chan erro cancel() }(ctx, errCh) } + +func notifyContext() (context.Context, context.CancelFunc) { + return signal.NotifyContext( + context.Background(), + os.Interrupt, + // More Linux signals here + syscall.SIGHUP, + syscall.SIGTERM, + syscall.SIGQUIT, + ) +}