You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/03/15 11:14:56 UTC

[GitHub] [dubbo-go] AlexStocks commented on a change in pull request #1073: Ftr: provide a default config

AlexStocks commented on a change in pull request #1073:
URL: https://github.com/apache/dubbo-go/pull/1073#discussion_r594246981



##########
File path: config/config_loader.go
##########
@@ -86,12 +100,48 @@ func init() {
 		log.Printf("[providerInit] %#v", errPro)
 		providerConfig = nil
 	} else {
+		// Check if there are some important key fields missing,
+		// if so, we set a default value for it
+		setDefaultValue(providerConfig)
 		// Even though baseConfig has been initialized, we override it
 		// because we think read from config file is correct config
 		baseConfig = &providerConfig.BaseConfig
 	}
 }
 
+// setDefaultValue set default value for providerConfig or consumerConfig if it is null
+func setDefaultValue(target interface{}) {

Review comment:
       > Can you use annotation in [this line](https://github.com/apache/dubbo-go/blob/274718b650e71ee55a832203e87088f9762d4ff7/config/consumer_config.go#L53) for default value?
   
   in go we can use annotation as Java?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org