@@ -42,7 +42,7 @@ func NewCmdInventoryList() *cobra.Command {
4242 }
4343
4444 w := tabwriter .NewWriter (os .Stdout , 0 , 0 , 3 , ' ' , 0 )
45- fmt .Fprintln (w , "名称/ID\t 别名\t 主机地址\t 用户\t 认证方式\t 跳板机\t 标签" )
45+ _ , _ = fmt .Fprintln (w , "名称/ID\t 别名\t 主机地址\t 用户\t 认证方式\t 跳板机\t 标签" )
4646
4747 keys := make ([]string , 0 , len (nodes ))
4848 for k := range nodes {
@@ -55,7 +55,7 @@ func NewCmdInventoryList() *cobra.Command {
5555 host , _ := provider .GetHost (nodeId )
5656 identity , _ := provider .GetIdentity (nodeId )
5757
58- fmt .Fprintf (w , "%s\t %s\t %s\t %s\t %s\t %s\t %s\n " ,
58+ _ , _ = fmt .Fprintf (w , "%s\t %s\t %s\t %s\t %s\t %s\t %s\n " ,
5959 nodeId ,
6060 strings .Join (node .Alias , ", " ),
6161 fmt .Sprintf ("%s:%d" , host .Address , host .Port ),
@@ -65,7 +65,7 @@ func NewCmdInventoryList() *cobra.Command {
6565 strings .Join (node .Tags , ", " ),
6666 )
6767 }
68- w .Flush ()
68+ _ = w .Flush ()
6969 },
7070 }
7171 cmd .Flags ().StringVarP (& tagFilter , "tag" , "t" , "" , "按标签筛选节点" )
@@ -97,7 +97,7 @@ func NewCmdInventoryTags() *cobra.Command {
9797 }
9898
9999 w := tabwriter .NewWriter (os .Stdout , 0 , 0 , 3 , ' ' , 0 )
100- fmt .Fprintln (w , "标签\t 节点数量" )
100+ _ , _ = fmt .Fprintln (w , "标签\t 节点数量" )
101101
102102 tags := make ([]string , 0 , len (tagMap ))
103103 for t := range tagMap {
@@ -106,9 +106,9 @@ func NewCmdInventoryTags() *cobra.Command {
106106 sort .Strings (tags )
107107
108108 for _ , t := range tags {
109- fmt .Fprintf (w , "%s\t %d\n " , t , tagMap [t ])
109+ _ , _ = fmt .Fprintf (w , "%s\t %d\n " , t , tagMap [t ])
110110 }
111- w .Flush ()
111+ _ = w .Flush ()
112112 },
113113 }
114114}
0 commit comments