Description
The library helps to end the go routines in your program and collects potential errors.
An exit strategy for go routines. alternatives and similar packages
Based on the "Go Tools" category.
Alternatively, view An exit strategy for go routines. alternatives based on common mentions on social networks and blogs.
-
JuiceFS
JuiceFS is a distributed POSIX file system built on top of Redis and S3. -
OctoLinker
OctoLinker — Links together, what belongs together -
go-callvis
Visualize call graph of a Go program using Graphviz -
JSON-to-Go
Translates JSON into a Go type in your browser instantly (original) -
gb
An easy to use project based build tool for the Go programming language. -
kube-prompt
An interactive kubernetes client featuring auto-complete. -
go-critic
The most opinionated Go source code linter for code audit. -
The Go Play Space
Advanced Go Playground frontend written in Go, with syntax highlighting, turtle graphics mode, and more -
richgo
Enrich `go test` outputs with text decorations. -
Peanut
🐺 Deploy Databases and Services Easily for Development and Testing Pipelines. -
golang-tutorials
Golang Tutorials. Learn Golang from Scratch with simple examples. -
xdg-go
Go implementation of the XDG Base Directory Specification and XDG user directories -
rts
RTS: request to struct. Generates Go structs from JSON server responses. -
typex
[TOOL, CLI] - Filter and examine Go type structures, interfaces and their transitive dependencies and relationships. Export structural types as TypeScript value object or bare type representations. -
roumon
Universal goroutine monitor using pprof and termui -
golang-ipc
Golang Inter-process communication library for Window, Mac and Linux. -
colorgo
Colorize (highlight) `go build` command output -
gothanks
GoThanks automatically stars Go's official repository and your go.mod github dependencies, providing a simple way to say thanks to the maintainers of the modules you use and the contributors of Go itself. -
zb
an opinionated repo based tool for linting, testing and building go source -
Viney's go-cache
A flexible multi-layer Go caching library to deal with in-memory and shared cache by adopting Cache-Aside pattern. -
goroutines
It is an efficient, flexible, and lightweight goroutine pool. It provides an easy way to deal with concurrent tasks with limited resource. -
go-lock
go-lock is a lock library implementing read-write mutex and read-write trylock without starvation -
terminal-Task
Terminal tasks todo with reminder tool for geek -
import "github/shuLhan/share"
A collection of libraries and tools written in Go; including DNS, email, git ini file format, HTTP, memfs (embedding file into Go), paseto, SMTP, TOTP, WebSocket, XMLRPC, and many more. -
go-james
James is your butler and helps you to create, build, debug, test and run your Go projects -
version
Go package to present your CLI version with an upgrade notice. -
generator-go-lang
A Yeoman generator to get new Go projects started. -
PDF to Image Converter Using Golang
This project will help you to convert PDF file to IMAGE using golang. -
go-pkg-complete
bash completion for go and wgo -
gotestdox
Show Go test results as readable sentences -
go-sanitize
:bathtub: Golang library of simple to use sanitation functions -
docs
Automatically generate RESTful API documentation for GO projects - aligned with Open API Specification standard -
gomodrun
The forgotten go tool that executes and caches binaries included in go.mod files. -
go-whatsonchain
:link: Unofficial golang implementation for the WhatsOnChain API -
Proofable
General purpose proving framework for certifying digital assets to public blockchains -
channelize
A websocket framework to manage outbound streams. Allowing to have multiple channels per connection that includes public and private channels. -
ciiigo
[mirror] Go static website generator with asciidoc markup language -
go-preev
:link: Unofficial golang implementation for the Preev API -
try
A go package that offers a try/catch statement block. -
go-slices
Helper functions for the manipulation of slices of all types in Go -
MessageBus implementation for CQRS projects
CQRS Implementation for Golang language -
redispubsub
Redis Streams queue driver for https://godoc.org/gocloud.dev/pubsub package -
modver
Compare two versions of a Go module to check the version-number change required (major, minor, or patchlevel), according to semver rules. -
retry
Small, full-featured, 100% test-covered retry package for golang. -
num30/go-cache
An in-memory key:value store/cache (similar to Memcached) library that takes advantage of Go Generics
Access the most powerful time series database as a service
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of An exit strategy for go routines. or a related project?
README
An exit strategy for go routines.
The library helps to end the go routines in your program and collects potential errors.
Install
go get github.com/simia-tech/go-exit
Example (main)
func main() {
exit.Main.SetTimeout(2 * time.Second)
counterExitSignal := exit.Main.NewSignal("counter")
go func() {
counter := 0
var reply exit.Reply
for reply == nil {
select {
case reply = <-counterExitSignal.Chan:
break
case <-time.After(1 * time.Second):
counter++
fmt.Printf("%d ", counter)
}
}
switch {
case counter%5 == 0:
// Don't send a return via reply to simulate
// an infinite running go routine. The timeout
// should be hit in this case.
case counter%2 == 1:
reply.Err(fmt.Errorf("exit on the odd counter %d", counter))
default:
reply.Ok()
}
}()
if report := exit.Main.ExitOn(syscall.SIGINT); report != nil {
fmt.Println()
report.WriteTo(os.Stderr)
os.Exit(-1)
}
fmt.Println()
}
The default exit exit.Main
should be used by the main program to exit it's go routines. If go-exit
is used
in a library, a separate exit should be created and used to end the library's go routines. This way the library
stays independent from other exit code.
Example (library)
type Server struct {
Address string
exit *exit.Exit
}
func New(address string) *Server {
return &Server{
Address: address,
exit: exit.New("server"),
}
}
func (s *Server) Open() error {
listener, err := net.Listen("tcp", s.Address)
if err != nil {
return err
}
signal := s.exit.NewSignal("acceptor")
go func() {
var reply exit.Reply
go func() {
for {
connection, err := listener.Accept()
if err != nil {
if reply != nil && strings.Contains(
err.Error(), "closed network connection") {
reply.Ok()
} else {
reply.Err(err)
}
return
}
log.Printf("connected %v", connection.RemoteAddr())
// handle connection
}
}()
reply = <-signal.Chan
if err := listener.Close(); err != nil {
reply.Err(err)
}
}()
return nil
}
func (s *Server) Close() error {
if report := s.exit.Exit(); report != nil {
return report
}
return nil
}
License
The project is licensed under Apache 2.0.
*Note that all licence references and agreements mentioned in the An exit strategy for go routines. README section above
are relevant to that project's source code only.