You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pegasus.apache.org by wa...@apache.org on 2023/12/20 02:53:19 UTC

(incubator-pegasus) branch master updated: chore(admin-cli&pegic): add go fmt in Makefile and fotmat files (#1793)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 211bbf313 chore(admin-cli&pegic): add go fmt in Makefile and fotmat files (#1793)
211bbf313 is described below

commit 211bbf3132b9a102b2783e8c9e1daabf8096f962
Author: Yingchun Lai <la...@apache.org>
AuthorDate: Wed Dec 20 10:53:14 2023 +0800

    chore(admin-cli&pegic): add go fmt in Makefile and fotmat files (#1793)
    
    Add fmt in Makefile for admin-cli and pegic, and format the golang files.
---
 admin-cli/Makefile                  |  3 +++
 admin-cli/cmd/remote_command.go     |  2 +-
 admin-cli/executor/server_config.go |  2 +-
 admin-cli/tabular/printer.go        | 17 +++++++++--------
 admin-cli/util/pegasus_node.go      |  4 ++--
 pegic/Makefile                      |  3 +++
 6 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/admin-cli/Makefile b/admin-cli/Makefile
index 85c728a2b..82e523883 100644
--- a/admin-cli/Makefile
+++ b/admin-cli/Makefile
@@ -20,5 +20,8 @@ build:
 	go mod tidy
 	go build -o bin/admin-cli main.go
 
+fmt:
+	go fmt ./...
+
 test:
 	go test -race -v -failfast -test.timeout 5m ./...
diff --git a/admin-cli/cmd/remote_command.go b/admin-cli/cmd/remote_command.go
index e5e8a822f..7395f26b6 100644
--- a/admin-cli/cmd/remote_command.go
+++ b/admin-cli/cmd/remote_command.go
@@ -27,7 +27,7 @@ import (
 	"github.com/desertbit/grumble"
 )
 
-//TODO(jiashuo1) The command will be replaced by `server-config` in server_config.go
+// TODO(jiashuo1) The command will be replaced by `server-config` in server_config.go
 func init() {
 	rootCmd := &grumble.Command{
 		Name: "remote-command",
diff --git a/admin-cli/executor/server_config.go b/admin-cli/executor/server_config.go
index 062d53d9e..70451e197 100644
--- a/admin-cli/executor/server_config.go
+++ b/admin-cli/executor/server_config.go
@@ -56,7 +56,7 @@ type response struct {
 	Value   string
 }
 
-//TODO(jiashuo1) not support update collector config
+// TODO(jiashuo1) not support update collector config
 func ConfigCommand(client *Client, nodeType session.NodeType, nodeAddr string, name string, actionType string, value string) error {
 	var nodes []*util.PegasusNode
 	if len(nodeAddr) == 0 {
diff --git a/admin-cli/tabular/printer.go b/admin-cli/tabular/printer.go
index 18d718909..de968dcb0 100644
--- a/admin-cli/tabular/printer.go
+++ b/admin-cli/tabular/printer.go
@@ -35,15 +35,16 @@ import (
 //
 // For example:
 // ```
-//  type tableStruct struct {
-//    PartitionCount int    `json:"partition_count"`
-//    TableName      string `json:"name"`
-//  }
-//  var tables []tableStruct
-//  ...
-//  tabular.Print(tables)
-// ```
 //
+//	type tableStruct struct {
+//	  PartitionCount int    `json:"partition_count"`
+//	  TableName      string `json:"name"`
+//	}
+//	var tables []tableStruct
+//	...
+//	tabular.Print(tables)
+//
+// ```
 func New(writer io.Writer, valueList []interface{}, configurer func(*tablewriter.Table)) *tablewriter.Table {
 	header := getHeaderFromValueList(valueList)
 	tabWriter := NewTabWriter(writer, header)
diff --git a/admin-cli/util/pegasus_node.go b/admin-cli/util/pegasus_node.go
index 73504214f..5f7320820 100644
--- a/admin-cli/util/pegasus_node.go
+++ b/admin-cli/util/pegasus_node.go
@@ -86,8 +86,8 @@ func (n *PegasusNode) RPCAddress() *base.RPCAddress {
 
 // NewNodeFromTCPAddr creates a node from tcp address.
 // NOTE:
-//  - Will not initialize TCP connection unless needed.
-//  - Should not be called too frequently because it costs 1 DNS resolution.
+//   - Will not initialize TCP connection unless needed.
+//   - Should not be called too frequently because it costs 1 DNS resolution.
 func NewNodeFromTCPAddr(addr string, ntype session.NodeType) *PegasusNode {
 	tcpAddr, err := net.ResolveTCPAddr("tcp", addr)
 	if err != nil {
diff --git a/pegic/Makefile b/pegic/Makefile
index 00454d5e1..9cfaa3552 100644
--- a/pegic/Makefile
+++ b/pegic/Makefile
@@ -18,3 +18,6 @@
 build:
 	go mod verify && go mod tidy
 	go build -o bin/pegic main.go
+
+fmt:
+	go fmt ./...


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pegasus.apache.org
For additional commands, e-mail: commits-help@pegasus.apache.org