lang
Package lang provides some helpful language features excluded from the Go language.
Getting Started
The lang package can be added to a Go project with go get.
go get github.com/shoenig/lang@latest
import "github.com/shoenig/lang"
Examples
Maybe
Use lang.Maybe as the ternary-operator for Go.
passing := lang.Maybe[string](check, "ok", "fail")
Pairs
Use lang.Pair to conveniently associate two types together.
p := lang.Pair[string, int]{A: "bob", B: 42}
Contributing
Contributions are welcome! Feel free to help make lang better by filing an
issue or opening a PR.
License
The github.com/shoenig/lang module is open source under the BSD-3-Clause license.