add Module.RequireLoaded helper
This commit is contained in:
@@ -54,3 +54,10 @@ func (s *Module) Name() string {
|
|||||||
func (s *Module) Loaded() bool {
|
func (s *Module) Loaded() bool {
|
||||||
return s.loaded
|
return s.loaded
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RequireLoaded panics if the module is not loaded.
|
||||||
|
func (s *Module) RequireLoaded() {
|
||||||
|
if s == nil || !s.Loaded() {
|
||||||
|
panic(fmt.Sprintf("module %s not loaded", s.name))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user