package module
v0.0.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2021 License: Apache-2.0 Imports: 9 Imported by: 0



A collection of packages for building Go services.

Quick Start

Below is an example for how to get running quickly.
This code can be found in the examples folder.

package main

import (


func main() {
        router := http.NewServeMux()
        router.HandleFunc("/", func(rw http.ResponseWriter, r *http.Request) {
                fmt.Fprint(rw, "hello, world\n")

        srv := &http.Server{
                Addr:    ":8080",
                Handler: router,


// TODO: this functionality should be provided by a plugin.
// for now this is an example on how to implement our interfaces.
type Server struct{ *http.Server }

func NewHTTPServer(s *http.Server) *Server {
        return &Server{Server: s}

func (s *Server) Run(_ context.Context) error {
        log.Printf("serving on: http://localhost%s\n", s.Addr)
        return s.ListenAndServe()

func (s *Server) Halt(ctx context.Context) error {
        return s.Shutdown(ctx)


Contributors listed in alphabetical order.




This section is empty.


This section is empty.


func MustStart

func MustStart(ctx context.Context, workers ...Worker)

MustStart is like Start, but panics if there is an error.

func Start

func Start(ctx context.Context, workers ...Worker) error

Start is a blocking operation that will start processing the workers.


type Halter

type Halter interface {
	// Halt should tell the worker to stop doing work.
	Halt(context.Context) error

Halter represents the behaviour for stopping a service worker.

type MultiError

type MultiError struct{ Errors []error }

MultiError holds a slice of errors and implements the error interface.

func (MultiError) Error

func (e MultiError) Error() string

Error returns a string representation of the MultiError.

func (MultiError) Unwrap

func (e MultiError) Unwrap() error

Unwrap returns an error from Error (or nil if there are no errors). This error returned will further support Unwrap to get the next error, etc. The order will match the order of Errors in the multierror.Error at the time of calling.

func (MultiError) Valid

func (e MultiError) Valid() bool

Valid returns true if the MultiError Errors slice is not empty.

type Runner

type Runner interface {
	// Run should run start processing the worker and be a blocking operation.
	Run(context.Context) error

Runner represents the behaviour for running a service worker.

type Worker

type Worker interface {

Worker represents the behaviour for a service worker.


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL