github.com/metux/go-metabuild@v0.0.0-20240118143255-d9ed5ab697f9/util/panic.go (about)

     1  package util
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  func Panicf(format string, v ...any) {
     8  	panic(fmt.Sprintf(format, v...))
     9  }
    10  
    11  func ErrPanicf(err error, format string, v ...any) {
    12  	if err != nil {
    13  		panic(fmt.Sprintf(format, v...) + ": " + fmt.Sprintf("%s", err))
    14  	}
    15  }