MustGet retrieves a value from the State and panics if the key is not found.
(key string)
| 44 | |
| 45 | // MustGet retrieves a value from the State and panics if the key is not found. |
| 46 | func (s *State) MustGet(key string) any { |
| 47 | if dep, ok := s.Get(key); ok { |
| 48 | return dep |
| 49 | } |
| 50 | |
| 51 | panic("state: dependency not found!") |
| 52 | } |
| 53 | |
| 54 | // Has checks if a key is present in the State. |
| 55 | // It returns a boolean indicating if the key is present. |