diff --git a/Dockerfile b/Dockerfile index 374a1a7..2898f28 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/go.mod b/go.mod index 332e541..4711aa9 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ require ( github.com/antonfisher/nested-logrus-formatter v1.3.0 github.com/edwarnicke/debug v1.0.0 github.com/edwarnicke/grpcfd v0.0.0-20210219150442-10fb469a6976 - github.com/edwarnicke/signalctx v0.0.0-20201105214533-3a35840b3011 github.com/edwarnicke/vpphelper v0.0.0-20210225052320-b4f1f1aff45d github.com/google/uuid v1.1.2 github.com/kelseyhightower/envconfig v1.4.0 diff --git a/go.sum b/go.sum index a6f02b5..ccfeea8 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,6 @@ github.com/edwarnicke/log v1.0.0/go.mod h1:eWsQQlQ0IU5wHlJvyXFH3dS8s2g9GzN7JnXod github.com/edwarnicke/serialize v0.0.0-20200705214914-ebc43080eecf/go.mod h1:XvbCO/QGsl3X8RzjBMoRpkm54FIAZH5ChK2j+aox7pw= github.com/edwarnicke/serialize v1.0.7 h1:geX8vmyu8Ij2S5fFIXjy9gBDkKxXnrMIzMoDvV0Ddac= github.com/edwarnicke/serialize v1.0.7/go.mod h1:y79KgU2P7ALH/4j37uTSIdNavHFNttqN7pzO6Y8B2aw= -github.com/edwarnicke/signalctx v0.0.0-20201105214533-3a35840b3011 h1:rlA4xj11pzxP9w/qVP11qZkRN+7UfA8MiW6pPljW0CM= -github.com/edwarnicke/signalctx v0.0.0-20201105214533-3a35840b3011/go.mod h1:Z9/3G9n/oPyXJzsF4ucVh8YOxTlTidDLqOeWlGV1JAw= github.com/edwarnicke/vpphelper v0.0.0-20210225052320-b4f1f1aff45d h1:Okg1uazbTBFvNTrWP5AbTLgG/xMsnZNIobxJYpyvyK8= github.com/edwarnicke/vpphelper v0.0.0-20210225052320-b4f1f1aff45d/go.mod h1:2KXgJqOUUCh9S4Zs2jAycQLqAcRGge3q+GXV2rN55ZQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= diff --git a/internal/imports/imports_linux.go b/internal/imports/imports_linux.go index 36f427b..edd4a88 100644 --- a/internal/imports/imports_linux.go +++ b/internal/imports/imports_linux.go @@ -7,7 +7,6 @@ import ( _ "github.com/antonfisher/nested-logrus-formatter" _ "github.com/edwarnicke/debug" _ "github.com/edwarnicke/grpcfd" - _ "github.com/edwarnicke/signalctx" _ "github.com/edwarnicke/vpphelper" _ "github.com/google/uuid" _ "github.com/kelseyhightower/envconfig" @@ -33,5 +32,7 @@ import ( _ "google.golang.org/grpc/credentials" _ "net/url" _ "os" + _ "os/signal" + _ "syscall" _ "time" ) diff --git a/main.go b/main.go index 51768f2..e3f1d24 100644 --- a/main.go +++ b/main.go @@ -23,12 +23,13 @@ import ( "fmt" "net/url" "os" + "os/signal" + "syscall" "time" nested "github.com/antonfisher/nested-logrus-formatter" "github.com/edwarnicke/debug" "github.com/edwarnicke/grpcfd" - "github.com/edwarnicke/signalctx" "github.com/edwarnicke/vpphelper" "github.com/google/uuid" "github.com/kelseyhightower/envconfig" @@ -69,8 +70,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 // ******************************************************************************** @@ -230,3 +231,14 @@ func exitOnErrCh(ctx context.Context, cancel context.CancelFunc, errCh <-chan er 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, + ) +}