mirror of
https://github.com/caddyserver/caddy.git
synced 2025-10-19 15:53:17 +00:00
core: Add godoc examples for LoadModule
This commit is contained in:
parent
3c90e370a4
commit
fab5e4372a
2 changed files with 121 additions and 1 deletions
|
@ -124,7 +124,9 @@ func (ctx *Context) OnCancel(f func()) {
|
|||
// and store them on the same struct. Storing them on the same struct makes for
|
||||
// easy garbage collection when your host module is no longer needed.
|
||||
//
|
||||
// Loaded modules have already been provisioned and validated.
|
||||
// Loaded modules have already been provisioned and validated. Upon returning
|
||||
// successfully, this method clears the json.RawMessage(s) in the field since
|
||||
// the raw JSON is no longer needed, and this allows the GC to free up memory.
|
||||
func (ctx Context) LoadModule(structPointer interface{}, fieldName string) (interface{}, error) {
|
||||
val := reflect.ValueOf(structPointer).Elem().FieldByName(fieldName)
|
||||
typ := val.Type()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue