Allow ModuleConfig.WithName("") to clear the module name (#1277)
We currently allow clearing other config with nil, such as FSConfig. However, we missed a spot as internally we couldn't differentiate between name never set, or explicitly set to empty. Now, when someone sets the module name to empty, the name in the binary section is ignored. Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -283,7 +283,7 @@ func (r *runtime) InstantiateModule(
|
||||
}
|
||||
|
||||
name := config.name
|
||||
if name == "" && code.module.NameSection != nil && code.module.NameSection.ModuleName != "" {
|
||||
if !config.nameSet && code.module.NameSection != nil && code.module.NameSection.ModuleName != "" {
|
||||
name = code.module.NameSection.ModuleName
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user