/muster

A golang tool to automate the creation of Must funcs

Primary LanguageGoBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Muster

A golang tool to automate the creation of Must funcs

Go Reference

Usage/Examples

Given this snippet,

package person

func DoGood(name str) error {
	return errors.New("bad")
}

running this command

muster -func=DoGood

in the same directory will create the file dogood_must.go, in package person, containing a definition of

func MustDoGood(name string)

That method will panic if the result of DoGood is not nil.

Go Generate

Add this snipet in a file to use with go generate

//go:generate muster -func=DoGood