Skip to content

Alternatives

George Xie edited this page Dec 10, 2022 · 5 revisions

Great minds think alike, if an idea is any good, it's probably already been done countless times.

  • date is the last date the commentary was confirmed as up-to-date.

Alternatives that are almost the same

https://github.com/ridge/must 5 stars date:2022-12-11 Most like this library. calls panic on error OK instead of V/Value. Have a defer-friendly Do, no B* like assertions.

https://github.com/v-braun/go-must date:2022-12-11 Pre-generics, no value passthrough.

https://pkg.go.dev/github.com/grailbio/base/must 62 starts in parent date:2022-12-11 Pre-generics, no value passthrough. Sub-package of a large module.

https://pkg.go.dev/github.com/sapcc/go-bits/must 8 starts date:2022-12-11 Calls os.Exit(1) instead of panic. Sub-package of a large module.

pre-generic std-lib wappers

https://github.com/powerman/must 4 starts date:2022-12-11

https://pkg.go.dev/github.com/gmlewis/advent-of-code-2021/must 5 starts in parent date:2022-12-11 parent project say "Advent of Code 2021 solutions using Go 1.18 Generics" but not used in must

Alternatives that you should use if

Assertions that can be turned off at compile time.

https://github.com/openacid/must 6 starts date:2022-12-11 "Design by contract" and support go 1.12

(Found by name search, maybe more popular alternatives exist)

defer friendly

https://go4.org/must 307 starts in parent date:2022-12-11 Accept functions instead of value to run the functions on defer.

(Should we add them to this library too? But defer is for clean-up, so an error shouldn't be panic worthy.)

You like try-catch better (not suggested)

https://github.com/mcesar/must 21 starts date:2022-12-11 Generic error handling with panic, recover, and defer.

Assertions in unit tests

https://github.com/stretchr/testify/assert and https://github.com/stretchr/testify/require are the most commonly used.

Clone this wiki locally