Vivalldi / muster

A golang tool to automate the creation of Must funcs

Home Page:https://pkg.go.dev/github.com/vivalldi/muster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

A golang tool to automate the creation of Must funcs

https://pkg.go.dev/github.com/vivalldi/muster

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Go 100.0%