diff options
author | Matthew Holt <[email protected]> | 2019-12-10 14:06:35 -0700 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2019-12-10 14:06:35 -0700 |
commit | fab5e4372a941ee4259adea9295f49dcadca26a4 (patch) | |
tree | f86b3f0d5da925ca1df9b641dcc9f6727c15ee4a /context.go | |
parent | 3c90e370a49cafe7f58c7195187822ddc86ced4a (diff) | |
download | caddy-fab5e4372a941ee4259adea9295f49dcadca26a4.tar.gz caddy-fab5e4372a941ee4259adea9295f49dcadca26a4.zip |
core: Add godoc examples for LoadModule
Diffstat (limited to 'context.go')
-rw-r--r-- | context.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/context.go b/context.go index c95b08f51..e515cb975 100644 --- a/context.go +++ b/context.go @@ -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() |