github.com/wfusion/gofusion@v1.1.14/common/utils/inspect/misc_go118.go (about)

     1  //go:build go1.18
     2  // +build go1.18
     3  
     4  package inspect
     5  
     6  import "github.com/pkg/errors"
     7  
     8  func mustOk[T any](out T, ok bool) T {
     9  	if !ok {
    10  		panic(errors.Errorf("get %T with ok is false", out))
    11  	}
    12  	return out
    13  }