FILE / ScuroNeko/est

internal/app/context.go

Исходный файл и его история в репозитории.
FILE 149d20e501a94f82b49aa9947e5e9b2c264f98e4
Files
est/internal/app/context.go
T
ScuroNeko bb2fa57bbe
Golang lint / docker-smoke (push) Successful in 17s
Golang lint / lint (push) Failing after 18s
v1.0.0
2026-08-06 12:22:44 +03:00

19 lines
577 B
Go

// Package app provides application lifecycle primitives.
package app
import (
"context"
"os"
"os/signal"
"syscall"
)
// NewContext returns a context for the whole application lifecycle.
//
// The context is cancelled when the parent is cancelled or when the process
// receives an interrupt or a termination signal. Call the returned function
// during shutdown to unregister signal notifications and release resources.
func NewContext(parent context.Context) (context.Context, context.CancelFunc) {
return signal.NotifyContext(parent, os.Interrupt, syscall.SIGTERM)
}