Closed coffeeTu-code closed 1 year ago
Would you please help to submit a unit test to reproduce this bug and it would also be great to submit a patch for that.
为什么在没有完成parser的情况下改变了 apolloConfig.Configurations ,这会导致数据前后不一致
func processJSONFiles(b []byte, callback http.CallBack) (o interface{}, err error) { apolloConfig := &config.ApolloConfig{} apolloConfig.NamespaceName = callback.Namespace
configurations := make(map[string]interface{}, 0) apolloConfig.Configurations = configurations err = json.Unmarshal(b, &apolloConfig.Configurations) if utils.IsNotNil(err) { return nil, err } parser := extension.GetFormatParser(constant.ConfigFileFormat(path.Ext(apolloConfig.NamespaceName))) if parser == nil { parser = extension.GetFormatParser(constant.DEFAULT) } if parser == nil { return apolloConfig, nil } content, ok := configurations[defaultContentKey] if !ok { content = string(b) } m, err := parser.Parse(content) if err != nil { log.Debugf("GetContent fail ! error: %v", err) } if len(m) > 0 { apolloConfig.Configurations = m } return apolloConfig, nil
}
不太明白遇到了什么问题?是否能提供一下背景和问题描述,或者 unit test 也可以。
为什么在没有完成parser的情况下改变了 apolloConfig.Configurations ,这会导致数据前后不一致
func processJSONFiles(b []byte, callback http.CallBack) (o interface{}, err error) { apolloConfig := &config.ApolloConfig{} apolloConfig.NamespaceName = callback.Namespace
}