common.go 458 B

12345678910111213141516171819
  1. // Package common contains common utilities that are shared among other packages.
  2. // See each sub-package for detail.
  3. package common
  4. //go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg common -path Common
  5. // Must panics if err is not nil.
  6. func Must(err error) {
  7. if err != nil {
  8. panic(err)
  9. }
  10. }
  11. // Must2 panics if the second parameter is not nil.
  12. func Must2(v interface{}, err error) {
  13. if err != nil {
  14. panic(err)
  15. }
  16. }