add Module.RequireLoaded helper
This commit is contained in:
1 parent
891035cf93
commit
5378c53537
1 file changed
+7
@@ -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