This is an automated email from the ASF dual-hosted git repository.
djwang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry-pxf.git
The following commit(s) were added to refs/heads/main by this push:
new 2e5b2fe9 Update go-libs url to `apache/cloudberry-go-libs` (#47)
2e5b2fe9 is described below
commit 2e5b2fe9e8f4479380dad5a87aa9f47f14ffbcf1
Author: Dianjin Wang <[email protected]>
AuthorDate: Thu Feb 5 10:20:02 2026 +0800
Update go-libs url to `apache/cloudberry-go-libs` (#47)
* Update go-libs url to `apache/cloudberry-go-libs`
* Run go mod tidy to update go.mod and go.sum file
* Update cluster_test.go
* Remove the nil check for `failedCommand` in GenerateOutput function.
After replacing greenplum-db/go-libs with apache/cloudberry-go-libs,
the `FailedCommands` field type changed from `[]*cluster.ShellCommand`
(pointer slice) to `[]cluster.ShellCommand` (value slice).
In Go, struct values cannot be compared to nil, which caused the
build error:
```
invalid operation: failedCommand == nil (mismatched types
cluster.ShellCommand and untyped nil)
```
This nil check is no longer needed because:
1. Value-type slice elements are always valid structs, never nil
2. The NewRemoteOutput function only appends commands with non-nil
errors to FailedCommands, so empty iterations won't occur
---
cli/README.md | 2 +-
cli/cmd/cluster.go | 13 +++++--------
cli/cmd/cluster_test.go | 28 +++++++++++-----------------
cli/cmd/cmd_suite_test.go | 4 ++--
cli/cmd/pxf.go | 2 +-
cli/cmd/root.go | 2 +-
cli/go.mod | 10 +++++-----
cli/go.sum | 16 ++++++++--------
8 files changed, 34 insertions(+), 43 deletions(-)
diff --git a/cli/README.md b/cli/README.md
index 39ee217e..27d4aa76 100644
--- a/cli/README.md
+++ b/cli/README.md
@@ -34,7 +34,7 @@ go install github.com/go-delve/delve/cmd/dlv@latest
```
config max-string-len 1000
-break vendor/github.com/greenplum-db/gp-common-go-libs/cluster/cluster.go:351
+break vendor/github.com/apache/cloudberry-go-libs/cluster/cluster.go:351
continue
print commandList
```
diff --git a/cli/cmd/cluster.go b/cli/cmd/cluster.go
index 68a7b301..ee3c6b74 100644
--- a/cli/cmd/cluster.go
+++ b/cli/cmd/cluster.go
@@ -6,9 +6,9 @@ import (
"os"
"strings"
- "github.com/greenplum-db/gp-common-go-libs/cluster"
- "github.com/greenplum-db/gp-common-go-libs/dbconn"
- "github.com/greenplum-db/gp-common-go-libs/gplog"
+ "github.com/apache/cloudberry-go-libs/cluster"
+ "github.com/apache/cloudberry-go-libs/dbconn"
+ "github.com/apache/cloudberry-go-libs/gplog"
"github.com/spf13/cobra"
"github.com/blang/semver"
)
@@ -111,9 +111,6 @@ func GenerateOutput(cmd *command, clusterData *ClusterData)
error {
}
response := ""
for _, failedCommand := range clusterData.Output.FailedCommands {
- if failedCommand == nil {
- continue
- }
host := failedCommand.Host
errorMessage := failedCommand.Stderr
if len(errorMessage) == 0 {
@@ -138,8 +135,8 @@ func doSetup() (*ClusterData, error) {
connection := dbconn.NewDBConnFromEnvironment("postgres")
err := connection.Connect(1)
if err != nil {
- gplog.Error(fmt.Sprintf("ERROR: Could not connect to
GPDB.\n%s\n"+
- "Please make sure that your Greenplum database is
running and you are on the coordinator node.", err.Error()))
+ gplog.Error(fmt.Sprintf("ERROR: Could not connect to
Cloudberry.\n%s\n"+
+ "Please make sure that your Apache Cloudberry is
running and you are on the coordinator node.", err.Error()))
return nil, err
}
diff --git a/cli/cmd/cluster_test.go b/cli/cmd/cluster_test.go
index ee078821..3fe4d798 100644
--- a/cli/cmd/cluster_test.go
+++ b/cli/cmd/cluster_test.go
@@ -3,7 +3,7 @@ package cmd_test
import (
"pxf-cli/cmd"
- "github.com/greenplum-db/gp-common-go-libs/cluster"
+ "github.com/apache/cloudberry-go-libs/cluster"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
@@ -145,11 +145,7 @@ var _ = Describe("GenerateOutput()", func() {
BeforeEach(func() {
clusterData.Output = &cluster.RemoteOutput{
NumErrors: 0,
- FailedCommands: []*cluster.ShellCommand{
- nil,
- nil,
- nil,
- },
+ FailedCommands: []cluster.ShellCommand{},
Commands: []cluster.ShellCommand{
{
Host: "mdw",
@@ -234,8 +230,8 @@ var _ = Describe("GenerateOutput()", func() {
}
clusterData.Output = &cluster.RemoteOutput{
NumErrors: 1,
- FailedCommands: []*cluster.ShellCommand{
- &failedCommand,
+ FailedCommands: []cluster.ShellCommand{
+ failedCommand,
},
Commands: []cluster.ShellCommand{
{
@@ -358,8 +354,8 @@ stderr line three`
}
clusterData.Output = &cluster.RemoteOutput{
NumErrors: 1,
- FailedCommands: []*cluster.ShellCommand{
- &failedCommand,
+ FailedCommands: []cluster.ShellCommand{
+ failedCommand,
},
Commands: []cluster.ShellCommand{
{
@@ -393,8 +389,8 @@ stderr line three`
}
clusterData.Output = &cluster.RemoteOutput{
NumErrors: 1,
- FailedCommands: []*cluster.ShellCommand{
- &failedCommand,
+ FailedCommands: []cluster.ShellCommand{
+ failedCommand,
},
Commands: []cluster.ShellCommand{
{
@@ -422,9 +418,7 @@ stderr line three`
BeforeEach(func() {
clusterDataWithOneHost.Output = &cluster.RemoteOutput{
NumErrors: 0,
- FailedCommands: []*cluster.ShellCommand{
- nil,
- },
+ FailedCommands: []cluster.ShellCommand{},
Commands: []cluster.ShellCommand{
{
Host: "mdw",
@@ -496,8 +490,8 @@ stderr line three`
}
clusterDataWithOneHost.Output =
&cluster.RemoteOutput{
NumErrors: 1,
- FailedCommands: []*cluster.ShellCommand{
- &failedCommand,
+ FailedCommands: []cluster.ShellCommand{
+ failedCommand,
},
Commands: []cluster.ShellCommand{
failedCommand,
diff --git a/cli/cmd/cmd_suite_test.go b/cli/cmd/cmd_suite_test.go
index 191728d9..37cae08c 100644
--- a/cli/cmd/cmd_suite_test.go
+++ b/cli/cmd/cmd_suite_test.go
@@ -4,8 +4,8 @@ import (
"os/user"
"testing"
- "github.com/greenplum-db/gp-common-go-libs/operating"
- "github.com/greenplum-db/gp-common-go-libs/testhelper"
+ "github.com/apache/cloudberry-go-libs/operating"
+ "github.com/apache/cloudberry-go-libs/testhelper"
"github.com/onsi/gomega/gbytes"
. "github.com/onsi/ginkgo/v2"
diff --git a/cli/cmd/pxf.go b/cli/cmd/pxf.go
index e7850ed7..88e21ec9 100644
--- a/cli/cmd/pxf.go
+++ b/cli/cmd/pxf.go
@@ -8,7 +8,7 @@ import (
"os"
"strings"
- "github.com/greenplum-db/gp-common-go-libs/cluster"
+ "github.com/apache/cloudberry-go-libs/cluster"
)
type envVar string
diff --git a/cli/cmd/root.go b/cli/cmd/root.go
index 7117789e..dc47bb8c 100644
--- a/cli/cmd/root.go
+++ b/cli/cmd/root.go
@@ -3,7 +3,7 @@ package cmd
import (
"os"
- "github.com/greenplum-db/gp-common-go-libs/gplog"
+ "github.com/apache/cloudberry-go-libs/gplog"
"github.com/spf13/cobra"
)
diff --git a/cli/go.mod b/cli/go.mod
index 6be15270..e05e448f 100644
--- a/cli/go.mod
+++ b/cli/go.mod
@@ -3,7 +3,8 @@ module pxf-cli
go 1.21.3
require (
- github.com/greenplum-db/gp-common-go-libs v1.0.16
+ github.com/apache/cloudberry-go-libs
v1.0.12-0.20250910014224-fc376e8a1056
+ github.com/blang/semver v3.5.1+incompatible
github.com/onsi/ginkgo/v2 v2.13.0
github.com/onsi/gomega v1.28.0
github.com/pkg/errors v0.9.1
@@ -12,7 +13,6 @@ require (
require (
github.com/DATA-DOG/go-sqlmock v1.5.0 // indirect
- github.com/blang/semver v3.5.1+incompatible // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 //
indirect
github.com/google/go-cmp v0.6.0 // indirect
@@ -28,9 +28,9 @@ require (
github.com/jackc/pgx/v4 v4.18.2 // indirect
github.com/jmoiron/sqlx v1.3.5 // indirect
github.com/spf13/pflag v1.0.3 // indirect
- golang.org/x/crypto v0.20.0 // indirect
- golang.org/x/net v0.21.0 // indirect
- golang.org/x/sys v0.17.0 // indirect
+ golang.org/x/crypto v0.21.0 // indirect
+ golang.org/x/net v0.23.0 // indirect
+ golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.12.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
diff --git a/cli/go.sum b/cli/go.sum
index 0e25b4f9..3bd88f83 100644
--- a/cli/go.sum
+++ b/cli/go.sum
@@ -7,6 +7,8 @@ github.com/Masterminds/semver/v3 v3.1.1/go.mod
h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0
github.com/OneOfOne/xxhash v1.2.2/go.mod
h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod
h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod
h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+github.com/apache/cloudberry-go-libs v1.0.12-0.20250910014224-fc376e8a1056
h1:ycrFztmYATpidbSAU1rw60XuhuDxgBHtLD3Sueu947c=
+github.com/apache/cloudberry-go-libs
v1.0.12-0.20250910014224-fc376e8a1056/go.mod
h1:lfHWkNYsno/lV+Nee0OoCmlOlBz5yvT6EW8WQEOUI5c=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod
h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod
h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod
h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
@@ -66,8 +68,6 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38
h1:yAJXTCF9TqKcTiHJAE
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod
h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/renameio v0.1.0/go.mod
h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/gorilla/websocket v1.4.0/go.mod
h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
-github.com/greenplum-db/gp-common-go-libs v1.0.16
h1:3YcbbSHZ5CEDesRXbSD08BDHcr88xwu73GYWmv5wXsw=
-github.com/greenplum-db/gp-common-go-libs v1.0.16/go.mod
h1:3vYQDev2Dke3W16fLYrApd/isXoi/lHspdbsqOJqRx0=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod
h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod
h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod
h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
@@ -238,8 +238,8 @@ golang.org/x/crypto
v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod
h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod
h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod
h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
-golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg=
-golang.org/x/crypto v0.20.0/go.mod
h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
+golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
+golang.org/x/crypto v0.21.0/go.mod
h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod
h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod
h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod
h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
@@ -256,8 +256,8 @@ golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod
h1:HSz+uSET+XFnRR8LxR
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod
h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod
h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod
h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
-golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
+golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
+golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod
h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod
h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod
h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -279,8 +279,8 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod
h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod
h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
-golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
+golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod
h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod
h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]