Skip to content

Commit

Permalink
meta: allow panic in Must
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Aug 21, 2023
1 parent 486e715 commit d4f54bc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
12 changes: 0 additions & 12 deletions admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,6 @@ func New(opts Opts) (*Server, error) {
return svc, nil
}

// NewServer has been replaced by New.
// Deprecated: Callers should use New instead to avoid panics when the port is already.
func NewServer(addr string) *Server {
svc, err := New(Opts{
Addr: addr,
})
if err != nil {
panic(fmt.Errorf("runtime error occurred when binding admin server: %v", err))
}
return svc
}

// Server represents a holder around a net/http Server which
// is used for admin endpoints. (i.e. metrics, healthcheck)
type Server struct {
Expand Down
2 changes: 1 addition & 1 deletion randx/randx.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func Between(lower, upper int) (int64, error) {
// Must is a helper that wraps a call to Between and panics if the error is non-nil.
func Must(n int64, err error) int64 {
if err != nil {
panic(err)
panic(err) //nolint:forbidigo
}
return n
}

0 comments on commit d4f54bc

Please sign in to comment.