Help us shape the future of Go! Take the 2026 Go Developer Survey

types

package module
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: MIT Imports: 0 Imported by: 8

README

Useful generic types for Go

PkgGoDev GHA Build Slack chat

I've found myself reimplementing some small types and patterns in a lot of my recent Go projects, so I thought I'd distill them into a single package.

Refer to the package docs for details.

Documentation

Overview

Package types contains a collection of types and functions that are useful in Go.

Directories

Path Synopsis
Package either provides a simple implementation of a sum type, Either, that can be either a Left or a Right.
Package either provides a simple implementation of a sum type, Either, that can be either a Left or a Right.
Package eventsource provides a pubsub.Topic that also stores the last published value in an atomic.Value.
Package eventsource provides a pubsub.Topic that also stores the last published value in an atomic.Value.
Package must provides a way to panic if the result of a multi-value function call returns an error, or return just the values if there is no error.
Package must provides a way to panic if the result of a multi-value function call returns an error, or return just the values if there is no error.
Package once provides a way to call a function exactly once (memoisation).
Package once provides a way to call a function exactly once (memoisation).
Package optional provides an Option type that can contain a value or nothing.
Package optional provides an Option type that can contain a value or nothing.
Package pubsub provides a simple publish/subscribe mechanism.
Package pubsub provides a simple publish/subscribe mechanism.
Package result provides a Result type that can contain a value or an error.
Package result provides a Result type that can contain a value or an error.
Package tuple provides pseudo-tuple types.
Package tuple provides pseudo-tuple types.

Jump to

Keyboard shortcuts

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