Copilot commented on code in PR #1314:
URL: https://github.com/apache/dubbo-admin/pull/1314#discussion_r2296579440


##########
pkg/core/engine/component.go:
##########
@@ -1,38 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package engine
 
 import (
        "math"
 
+       "github.com/apache/dubbo-admin/pkg/core/controller"
+       "github.com/apache/dubbo-admin/pkg/core/events"
+       "github.com/apache/dubbo-admin/pkg/core/logger"
+       coremodel "github.com/apache/dubbo-admin/pkg/core/resource/model"
        "github.com/apache/dubbo-admin/pkg/core/runtime"
+       "github.com/apache/dubbo-admin/pkg/core/store"
 )
 
+func init() {
+       runtime.RegisterComponent(&engineComponent{})
+}
+
 type Component interface {
        runtime.Component
-       ResourceEngine() ResourceEngine
+       ResourceEngine
 }
 
-var _ Component = &BaseResourceEngineComponent{}
+var _ Component = &engineComponent{}
 
-type BaseResourceEngineComponent struct{}
+type engineComponent struct {
+       name      string
+       informers []controller.Informer
+}

Review Comment:
   The informers slice is declared but never initialized, which will cause 
issues when trying to append to it in the Init method.



##########
pkg/core/discovery/component.go:
##########
@@ -1,36 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package discovery
 
 import (
        "math"
 
+       "github.com/apache/dubbo-admin/pkg/config/discovery"
+       "github.com/apache/dubbo-admin/pkg/core/controller"
+       "github.com/apache/dubbo-admin/pkg/core/events"
+       "github.com/apache/dubbo-admin/pkg/core/logger"
+       coremodel "github.com/apache/dubbo-admin/pkg/core/resource/model"
        "github.com/apache/dubbo-admin/pkg/core/runtime"
+       "github.com/apache/dubbo-admin/pkg/core/store"
 )
 
 type Component interface {
        runtime.Component
-       ResourceDiscovery() ResourceDiscovery
+       ResourceDiscovery
 }
 
-var _ Component = &BaseResourceDiscoveryComponent{}
+var _ Component = &discoveryComponent{}
+
+type Informers []controller.Informer
 
-type BaseResourceDiscoveryComponent struct{}
+type discoveryComponent struct {
+       discoveryInformers map[string]Informers
+}

Review Comment:
   The discoveryInformers map is declared but never initialized in the Init 
method, which will cause a nil pointer dereference when trying to assign to it.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org

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


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

Reply via email to