Workgroup provides a mechanism for controlling the lifetime of a set of related goroutines
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
Makefile
README.md
example_test.go
group.go
group_test.go initial import Jun 3, 2018

README.md

Heptio Workgroup

Maintainers: Heptio

Build Status

godoc

Overview

Workgroup is a small utility to manage the lifetime of a set of related goroutines.

Examples

http.Serve

var g workgroup.Group

g.Add(func(stop <-chan struct{}) error {
	l, err := net.Listen("tcp", ":80") // listen on port 80
        if err != nil {
                return err
        }

        go func() {
                <-stop // close listener on stop request
                l.Close()
        }()
        return http.Serve(l, mux)
})
g.Run()

Related work

workgroup.Group is heavily inspired by prior art including oklog's run.Group and Gustavo Niemeyer's tomb packages.

Contributing

Thanks for taking the time to join our community and start contributing!

Bug reports are most welcome, but with the exception of #5, this project is closed.

  • Please familiarize yourself with the Code of Conduct before contributing.
  • See CONTRIBUTING.md for information about setting up your environment, the workflow that we expect, and instructions on the developer certificate of origin that we require.

Changelog

See the list of releases to find out about feature changes.