fix(docs): fix godoc badge and add some godoc comments
diff --git a/README.md b/README.md
index c32182d..dc0db07 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
## RocketMQ Operator
[](https://www.apache.org/licenses/LICENSE-2.0.html)
[](https://golang.org/)
+[](https://godoc.org/github.com/apache/rocketmq-operator/pkg)
[](https://goreportcard.com/report/github.com/apache/rocketmq-operator)
-[](https://godoc.org/github.com/apache/rocketmq-operator)
## Table of Contents
- [Overview](#overview)
diff --git a/pkg/apis/apis.go b/pkg/apis/apis.go
index e52f5f6..a3741aa 100644
--- a/pkg/apis/apis.go
+++ b/pkg/apis/apis.go
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+// Package apis defines the customized resource definition (CRD)
package apis
import (
diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go
index 1b88668..8661833 100644
--- a/pkg/constants/constants.go
+++ b/pkg/constants/constants.go
@@ -15,118 +15,121 @@
* limitations under the License.
*/
+// Package constants defines some global constants
package constants
-// BrokerContainerName is the name of broker container
-const BrokerContainerName = "broker"
+const (
+ // BrokerContainerName is the name of broker container
+ BrokerContainerName = "broker"
-// BasicCommand is basic command of exec function
-const BasicCommand = "sh"
+ // BasicCommand is basic command of exec function
+ BasicCommand = "sh"
-// AdminToolDir is the RocketMQ Admin directory in operator image
-const AdminToolDir = "/home/rocketmq/rocketmq-4.5.0/bin/mqadmin"
+ // AdminToolDir is the RocketMQ Admin directory in operator image
+ AdminToolDir = "/home/rocketmq/rocketmq-4.5.0/bin/mqadmin"
-// StoreConfigDir is the directory of config file
-const StoreConfigDir = "/home/rocketmq/store/config"
+ // StoreConfigDir is the directory of config file
+ StoreConfigDir = "/home/rocketmq/store/config"
-// TopicJsonDir is the directory of topics.json
-const TopicJsonDir = "/home/rocketmq/store/config/topics.json"
+ // TopicJsonDir is the directory of topics.json
+ TopicJsonDir = "/home/rocketmq/store/config/topics.json"
-// SubscriptionGroupJsonDir is the directory of subscriptionGroup.json
-const SubscriptionGroupJsonDir = "/home/rocketmq/store/config/subscriptionGroup.json"
+ // SubscriptionGroupJsonDir is the directory of subscriptionGroup.json
+ SubscriptionGroupJsonDir = "/home/rocketmq/store/config/subscriptionGroup.json"
-// UpdateBrokerConfig is update broker config command
-const UpdateBrokerConfig = "updateBrokerConfig"
+ // UpdateBrokerConfig is update broker config command
+ UpdateBrokerConfig = "updateBrokerConfig"
-// ParamNameServiceAddress is the name of name server list parameter
-const ParamNameServiceAddress = "namesrvAddr"
+ // ParamNameServiceAddress is the name of name server list parameter
+ ParamNameServiceAddress = "namesrvAddr"
-// EnvNameServiceAddress is the container environment variable name of name server list
-const EnvNameServiceAddress = "NAMESRV_ADDR"
+ // EnvNameServiceAddress is the container environment variable name of name server list
+ EnvNameServiceAddress = "NAMESRV_ADDR"
-// EnvReplicationMode is the container environment variable name of replication mode
-const EnvReplicationMode = "REPLICATION_MODE"
+ // EnvReplicationMode is the container environment variable name of replication mode
+ EnvReplicationMode = "REPLICATION_MODE"
-// EnvBrokerId is the container environment variable name of broker id
-const EnvBrokerId = "BROKER_ID"
+ // EnvBrokerId is the container environment variable name of broker id
+ EnvBrokerId = "BROKER_ID"
-// EnvBrokerClusterName is the container environment variable name of broker cluster name
-const EnvBrokerClusterName = "BROKER_CLUSTER_NAME"
+ // EnvBrokerClusterName is the container environment variable name of broker cluster name
+ EnvBrokerClusterName = "BROKER_CLUSTER_NAME"
-// EnvBrokerName is the container environment variable name of broker name
-const EnvBrokerName = "BROKER_NAME"
+ // EnvBrokerName is the container environment variable name of broker name
+ EnvBrokerName = "BROKER_NAME"
-// LogMountPath is the directory of RocketMQ log files
-const LogMountPath = "/home/rocketmq/logs"
+ // LogMountPath is the directory of RocketMQ log files
+ LogMountPath = "/home/rocketmq/logs"
-// StoreMountPath is the directory of RocketMQ store files
-const StoreMountPath = "/home/rocketmq/store"
+ // StoreMountPath is the directory of RocketMQ store files
+ StoreMountPath = "/home/rocketmq/store"
-// LogSubPathName is the sub-path name of log dir under mounted host dir
-const LogSubPathName = "logs"
+ // LogSubPathName is the sub-path name of log dir under mounted host dir
+ LogSubPathName = "logs"
-// StoreSubPathName is the sub-path name of store dir under mounted host dir
-const StoreSubPathName = "store"
+ // StoreSubPathName is the sub-path name of store dir under mounted host dir
+ StoreSubPathName = "store"
-// NameServiceMainContainerPort is the main port number of name server container
-const NameServiceMainContainerPort = 9876
+ // NameServiceMainContainerPort is the main port number of name server container
+ NameServiceMainContainerPort = 9876
-// NameServiceMainContainerPortName is the main port name of name server container
-const NameServiceMainContainerPortName = "main"
+ // NameServiceMainContainerPortName is the main port name of name server container
+ NameServiceMainContainerPortName = "main"
-// BrokerVipContainerPort is the VIP port number of broker container
-const BrokerVipContainerPort = 10909
+ // BrokerVipContainerPort is the VIP port number of broker container
+ BrokerVipContainerPort = 10909
-// BrokerVipContainerPortName is the VIP port name of broker container
-const BrokerVipContainerPortName = "vip"
+ // BrokerVipContainerPortName is the VIP port name of broker container
+ BrokerVipContainerPortName = "vip"
-// BrokerMainContainerPort is the main port number of broker container
-const BrokerMainContainerPort = 10911
+ // BrokerMainContainerPort is the main port number of broker container
+ BrokerMainContainerPort = 10911
-// BrokerMainContainerPortName is the main port name of broker container
-const BrokerMainContainerPortName = "main"
+ // BrokerMainContainerPortName is the main port name of broker container
+ BrokerMainContainerPortName = "main"
-// BrokerHighAvailabilityContainerPort is the high availability port number of broker container
-const BrokerHighAvailabilityContainerPort = 10912
+ // BrokerHighAvailabilityContainerPort is the high availability port number of broker container
+ BrokerHighAvailabilityContainerPort = 10912
-// BrokerHighAvailabilityContainerPortName is the high availability port name of broker container
-const BrokerHighAvailabilityContainerPortName = "ha"
+ // BrokerHighAvailabilityContainerPortName is the high availability port name of broker container
+ BrokerHighAvailabilityContainerPortName = "ha"
-// StorageModeNFS is the name of NFS storage mode
-const StorageModeNFS = "NFS"
+ // StorageModeNFS is the name of NFS storage mode
+ StorageModeNFS = "NFS"
-// StorageModeEmptyDir is the name of EmptyDir storage mode
-const StorageModeEmptyDir = "EmptyDir"
+ // StorageModeEmptyDir is the name of EmptyDir storage mode
+ StorageModeEmptyDir = "EmptyDir"
-// StorageModeHostPath is the name pf HostPath storage mode
-const StorageModeHostPath = "HostPath"
+ // StorageModeHostPath is the name pf HostPath storage mode
+ StorageModeHostPath = "HostPath"
-// RestartBrokerPodIntervalInSecond is restart broker pod interval in second
-const RestartBrokerPodIntervalInSecond = 30
+ // RestartBrokerPodIntervalInSecond is restart broker pod interval in second
+ RestartBrokerPodIntervalInSecond = 30
-// MinMetadataJsonFileSize is the threshold value if file length is lower than this will be considered as invalid
-const MinMetadataJsonFileSize = 5
+ // MinMetadataJsonFileSize is the threshold value if file length is lower than this will be considered as invalid
+ MinMetadataJsonFileSize = 5
-// MinIpListLength is the threshold value if the name server list parameter length is shorter than this will be considered as invalid
-const MinIpListLength = 8
+ // MinIpListLength is the threshold value if the name server list parameter length is shorter than this will be considered as invalid
+ MinIpListLength = 8
-// CheckConsumeFinishIntervalInSecond is the interval of checking whether the consumption process is finished in second
-const CheckConsumeFinishIntervalInSecond = 5
+ // CheckConsumeFinishIntervalInSecond is the interval of checking whether the consumption process is finished in second
+ CheckConsumeFinishIntervalInSecond = 5
-// RequeueIntervalInSecond is an universal interval of the reconcile function
-const RequeueIntervalInSecond = 6
+ // RequeueIntervalInSecond is an universal interval of the reconcile function
+ RequeueIntervalInSecond = 6
-// Topic is the topic field index of the output when using command check consume progress
-const Topic = 0
+ // Topic is the topic field index of the output when using command check consume progress
+ Topic = 0
-// BrokerName is the broker name field index of the output when using command check consume progress
-const BrokerName = 1
+ // BrokerName is the broker name field index of the output when using command check consume progress
+ BrokerName = 1
-// Diff is the diff field index of the output when using command check consume progress
-const Diff = 6
+ // Diff is the diff field index of the output when using command check consume progress
+ Diff = 6
-// TopicListTopic is the topic field index of the output when using command check topic list
-const TopicListTopic = 1
+ // TopicListTopic is the topic field index of the output when using command check topic list
+ TopicListTopic = 1
-// TopicListConsumerGroup is the consumer group field index of the output when using command check topic list
-const TopicListConsumerGroup = 2
+ // TopicListConsumerGroup is the consumer group field index of the output when using command check topic list
+ TopicListConsumerGroup = 2
+)
diff --git a/pkg/controller/broker/broker_controller.go b/pkg/controller/broker/broker_controller.go
index 5b99ed8..6780b86 100644
--- a/pkg/controller/broker/broker_controller.go
+++ b/pkg/controller/broker/broker_controller.go
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+// Package broker contains the implementation of the Broker CRD reconcile function
package broker
import (
diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go
index a1c1758..4e15ecc 100644
--- a/pkg/controller/controller.go
+++ b/pkg/controller/controller.go
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+// Package controller contains the controller of different CRDs
package controller
import (
diff --git a/pkg/controller/nameservice/nameservice_controller.go b/pkg/controller/nameservice/nameservice_controller.go
index b3706ae..a4afff4 100644
--- a/pkg/controller/nameservice/nameservice_controller.go
+++ b/pkg/controller/nameservice/nameservice_controller.go
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+// Package nameservice contains the implementation of the NameService CRD reconcile function
package nameservice
import (
diff --git a/pkg/controller/topictransfer/topictransfer_controller.go b/pkg/controller/topictransfer/topictransfer_controller.go
index 8ff318c..f6c842c 100644
--- a/pkg/controller/topictransfer/topictransfer_controller.go
+++ b/pkg/controller/topictransfer/topictransfer_controller.go
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+// Package topictransfer contains the implementation of the TopicTransfer CRD reconcile function
package topictransfer
import (
diff --git a/pkg/share/share.go b/pkg/share/share.go
index 174075d..08547a1 100644
--- a/pkg/share/share.go
+++ b/pkg/share/share.go
@@ -15,16 +15,19 @@
* limitations under the License.
*/
+// Package share defines some variables shared by different packages
package share
-// GroupNum is the number of broker group
-var GroupNum = 0
+var (
+ // GroupNum is the number of broker group
+ GroupNum = 0
-// NameServersStr is the name server list
-var NameServersStr = ""
+ // NameServersStr is the name server list
+ NameServersStr = ""
-// IsNameServersStrUpdated is whether the name server list is updated
-var IsNameServersStrUpdated = false
+ // IsNameServersStrUpdated is whether the name server list is updated
+ IsNameServersStrUpdated = false
-// BrokerClusterName is the broker cluster name
-var BrokerClusterName = ""
+ // BrokerClusterName is the broker cluster name
+ BrokerClusterName = ""
+)