You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by he...@apache.org on 2022/03/09 12:36:22 UTC

[incubator-inlong] branch master updated: [INLONG-3020][TubeMQ] Format the code of Go SDK (#3021)

This is an automated email from the ASF dual-hosted git repository.

healchow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 4dbb8ef  [INLONG-3020][TubeMQ] Format the code of Go SDK (#3021)
4dbb8ef is described below

commit 4dbb8ef1cb6791c4b1deeb6ba504d61dc63c2de2
Author: Zijie Lu <ws...@gmail.com>
AuthorDate: Wed Mar 9 20:36:18 2022 +0800

    [INLONG-3020][TubeMQ] Format the code of Go SDK (#3021)
---
 .../tubemq-client-twins/tubemq-client-go/config/config.go     | 11 +++++++----
 .../tubemq-client-twins/tubemq-client-go/util/util.go         |  3 ++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/inlong-tubemq/tubemq-client-twins/tubemq-client-go/config/config.go b/inlong-tubemq/tubemq-client-twins/tubemq-client-go/config/config.go
index b62ae0f..6d2ebeb 100644
--- a/inlong-tubemq/tubemq-client-twins/tubemq-client-go/config/config.go
+++ b/inlong-tubemq/tubemq-client-twins/tubemq-client-go/config/config.go
@@ -282,7 +282,8 @@ func (c *Config) validateTopicFilters() error {
 	for topic, filters := range c.Consumer.TopicFilters {
 		if len(topic) > MaxTopicLen {
 			return errs.New(errs.RetInvalidConfig,
-				fmt.Sprintf("Check parameter topicFilters error: topic's length over max length %d", MaxTopicLen))
+				fmt.Sprintf("Check parameter topicFilters error: topic's length " +
+					"over max length %d", MaxTopicLen))
 		}
 		if valid, err := util.IsValidString(topic); !valid {
 			return errs.New(errs.RetInvalidConfig, err.Error())
@@ -290,11 +291,12 @@ func (c *Config) validateTopicFilters() error {
 		for _, filter := range filters {
 			if len(filter) == 0 {
 				return errs.New(errs.RetInvalidConfig,
-					fmt.Sprintf("Checassert.Nil(t, c.ValidateConsumer())k parameter topicFilters error: topic %s's filter is empty", topic))
+					fmt.Sprintf("Check parameter topicFilters error: topic %s's filter is empty", topic))
 			}
 			if len(filter) > MaxFilterLen {
 				return errs.New(errs.RetInvalidConfig,
-					fmt.Sprintf("Check parameter topicFilters error: topic %s's filter's length over max length %d", topic, MaxFilterLen))
+					fmt.Sprintf("Check parameter topicFilters error: topic %s's filter's " +
+						"length over max length %d", topic, MaxFilterLen))
 			}
 			if valid, err := util.IsValidFilterItem(filter); !valid {
 				return errs.New(errs.RetInvalidConfig, err.Error())
@@ -302,7 +304,8 @@ func (c *Config) validateTopicFilters() error {
 		}
 		if len(filters) > MaxFilterLen {
 			return errs.New(errs.RetInvalidConfig,
-				fmt.Sprintf("Check parameter topicFilters error: topic %s's filter item over max item count %d", topic, MaxFilterLen))
+				fmt.Sprintf("Check parameter topicFilters error: topic %s's filter item " +
+					"over max item count %d", topic, MaxFilterLen))
 		}
 	}
 	return nil
diff --git a/inlong-tubemq/tubemq-client-twins/tubemq-client-go/util/util.go b/inlong-tubemq/tubemq-client-twins/tubemq-client-go/util/util.go
index e36f1e0..ed9cbd3 100644
--- a/inlong-tubemq/tubemq-client-twins/tubemq-client-go/util/util.go
+++ b/inlong-tubemq/tubemq-client-twins/tubemq-client-go/util/util.go
@@ -120,7 +120,8 @@ func SplitToMap(source string, step1 string, step2 string) map[string]string {
 func IsValidString(s string) (bool, error) {
 	if matched, _ := regexp.Match("^[a-zA-Z]\\w+$", []byte(s)); !matched {
 		return false,
-			errors.New(fmt.Sprintf("illegal parameter: %s must begin with a letter,can only contain characters,numbers,and underscores", s))
+			errors.New(fmt.Sprintf("illegal parameter: %s must begin with a letter, " +
+				"can only contain characters,numbers,and underscores", s))
 	}
 	return true, nil
 }