Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch uuid package to get around GO-2020-0018 #1

Merged
merged 1 commit into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ require (
github.com/evanphx/json-patch v4.5.0+incompatible
github.com/golang/mock v1.4.0
github.com/google/go-cmp v0.4.0
github.com/google/uuid v1.3.0
github.com/hashicorp/consul/api v1.4.0
github.com/lib/pq v1.3.0
github.com/mattn/go-isatty v0.0.12
github.com/mitchellh/copystructure v1.0.0
github.com/prometheus/client_golang v1.4.1
github.com/satori/go.uuid v1.2.0
github.com/sgotti/gexpect v0.0.0-20210315095146-1ec64e69809b
github.com/sorintlab/pollon v0.0.0-20181009091703-248c68238c16
github.com/spf13/cobra v0.0.5
Expand Down
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d h1:7XGaL1e6bYS1yIonGp9761ExpPPV1ui0SAC59Yube9k=
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
Expand Down Expand Up @@ -290,8 +291,6 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/sgotti/gexpect v0.0.0-20210315095146-1ec64e69809b h1:rGT0mqolw5UvjfByF0vWfFEhtL7Hn6P7dNKz7iHBMdA=
Expand Down
6 changes: 3 additions & 3 deletions internal/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"reflect"
"strings"

"github.com/satori/go.uuid"
"github.com/google/uuid"
)

const (
Expand All @@ -50,12 +50,12 @@ var Roles = []Role{
}

func UID() string {
u := uuid.NewV4()
u := uuid.Must(uuid.NewRandom())
return fmt.Sprintf("%x", u[:4])
}

func UUID() string {
return uuid.NewV4().String()
return uuid.Must(uuid.NewRandom()).String()
}

const (
Expand Down
16 changes: 8 additions & 8 deletions tests/integration/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/sorintlab/stolon/internal/common"
"github.com/sorintlab/stolon/internal/store"

uuid "github.com/satori/go.uuid"
"github.com/google/uuid"
)

func TestServerParameters(t *testing.T) {
Expand All @@ -52,7 +52,7 @@ func TestServerParameters(t *testing.T) {
storeEndpoints := fmt.Sprintf("%s:%s", tstore.listenAddress, tstore.port)
defer tstore.Stop()

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

storePath := filepath.Join(common.StorePrefix, clusterName)

Expand Down Expand Up @@ -149,7 +149,7 @@ func TestWalLevel(t *testing.T) {
storeEndpoints := fmt.Sprintf("%s:%s", tstore.listenAddress, tstore.port)
defer tstore.Stop()

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

storePath := filepath.Join(common.StorePrefix, clusterName)

Expand Down Expand Up @@ -264,7 +264,7 @@ func TestWalKeepSegments(t *testing.T) {
storeEndpoints := fmt.Sprintf("%s:%s", tstore.listenAddress, tstore.port)
defer tstore.Stop()

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

storePath := filepath.Join(common.StorePrefix, clusterName)

Expand Down Expand Up @@ -437,7 +437,7 @@ func TestAlterSystem(t *testing.T) {
storeEndpoints := fmt.Sprintf("%s:%s", tstore.listenAddress, tstore.port)
defer tstore.Stop()

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

storePath := filepath.Join(common.StorePrefix, clusterName)

Expand Down Expand Up @@ -509,7 +509,7 @@ func TestAdditionalReplicationSlots(t *testing.T) {
}
defer os.RemoveAll(dir)

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, false, false, nil)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -658,7 +658,7 @@ func TestAutomaticPgRestart(t *testing.T) {
storeEndpoints := fmt.Sprintf("%s:%s", tstore.listenAddress, tstore.port)
defer tstore.Stop()

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

storePath := filepath.Join(common.StorePrefix, clusterName)

Expand Down Expand Up @@ -782,7 +782,7 @@ func TestAdvertise(t *testing.T) {
storeEndpoints := fmt.Sprintf("%s:%s", tstore.listenAddress, tstore.port)
defer tstore.Stop()

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

storePath := filepath.Join(common.StorePrefix, clusterName)

Expand Down
50 changes: 25 additions & 25 deletions tests/integration/ha_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"testing"
"time"

uuid "github.com/satori/go.uuid"
"github.com/google/uuid"
"github.com/sorintlab/stolon/internal/cluster"
"github.com/sorintlab/stolon/internal/common"
pg "github.com/sorintlab/stolon/internal/postgresql"
Expand Down Expand Up @@ -70,7 +70,7 @@ func TestInitWithMultipleKeepers(t *testing.T) {

storeEndpoints := fmt.Sprintf("%s:%s", tstore.listenAddress, tstore.port)

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

storePath := filepath.Join(common.StorePrefix, clusterName)

Expand Down Expand Up @@ -333,7 +333,7 @@ func testMasterStandby(t *testing.T, syncRepl bool) {
}
defer os.RemoveAll(dir)

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, syncRepl, false, nil)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -388,7 +388,7 @@ func testFailover(t *testing.T, syncRepl bool, standbyCluster bool) {
var ptk *TestKeeper
var primary *TestKeeper
if standbyCluster {
primaryClusterName := uuid.NewV4().String()
primaryClusterName := uuid.Must(uuid.NewRandom()).String()
ptks, ptss, ptp, ptstore := setupServers(t, primaryClusterName, dir, 1, 1, false, false, nil)
defer shutdown(ptks, ptss, ptp, ptstore)
for _, ptk = range ptks {
Expand All @@ -397,7 +397,7 @@ func testFailover(t *testing.T, syncRepl bool, standbyCluster bool) {
primary = ptk
}

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, syncRepl, false, ptk)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -499,7 +499,7 @@ func testFailoverFailed(t *testing.T, syncRepl bool, standbyCluster bool) {
var ptk *TestKeeper
var primary *TestKeeper
if standbyCluster {
primaryClusterName := uuid.NewV4().String()
primaryClusterName := uuid.Must(uuid.NewRandom()).String()
ptks, ptss, ptp, ptstore := setupServers(t, primaryClusterName, dir, 1, 1, false, false, nil)
defer shutdown(ptks, ptss, ptp, ptstore)
for _, ptk = range ptks {
Expand All @@ -508,7 +508,7 @@ func testFailoverFailed(t *testing.T, syncRepl bool, standbyCluster bool) {
primary = ptk
}

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, syncRepl, false, ptk)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -611,7 +611,7 @@ func testFailoverTooMuchLag(t *testing.T, standbyCluster bool) {
var ptk *TestKeeper
var primary *TestKeeper
if standbyCluster {
primaryClusterName := uuid.NewV4().String()
primaryClusterName := uuid.Must(uuid.NewRandom()).String()
ptks, ptss, ptp, ptstore := setupServers(t, primaryClusterName, dir, 1, 1, false, false, nil)
defer shutdown(ptks, ptss, ptp, ptstore)
for _, ptk = range ptks {
Expand All @@ -620,7 +620,7 @@ func testFailoverTooMuchLag(t *testing.T, standbyCluster bool) {
primary = ptk
}

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, false, false, ptk)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -690,7 +690,7 @@ func testOldMasterRestart(t *testing.T, syncRepl, minSync0 bool, usePgrewind boo
var ptk *TestKeeper
var primary *TestKeeper
if standbyCluster {
primaryClusterName := uuid.NewV4().String()
primaryClusterName := uuid.Must(uuid.NewRandom()).String()
ptks, ptss, ptp, ptstore := setupServers(t, primaryClusterName, dir, 1, 1, false, false, nil)
defer shutdown(ptks, ptss, ptp, ptstore)
for _, ptk = range ptks {
Expand All @@ -699,7 +699,7 @@ func testOldMasterRestart(t *testing.T, syncRepl, minSync0 bool, usePgrewind boo
primary = ptk
}

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

specOptions := []optionSetter{
withMinSync0(minSync0),
Expand Down Expand Up @@ -844,7 +844,7 @@ func testPartition1(t *testing.T, syncRepl, minSync0, usePgrewind bool, standbyC
var ptk *TestKeeper
var primary *TestKeeper
if standbyCluster {
primaryClusterName := uuid.NewV4().String()
primaryClusterName := uuid.Must(uuid.NewRandom()).String()
ptks, ptss, ptp, ptstore := setupServers(t, primaryClusterName, dir, 1, 1, false, false, nil)
defer shutdown(ptks, ptss, ptp, ptstore)
for _, ptk = range ptks {
Expand All @@ -853,7 +853,7 @@ func testPartition1(t *testing.T, syncRepl, minSync0, usePgrewind bool, standbyC
primary = ptk
}

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

specOptions := []optionSetter{
withMinSync0(minSync0),
Expand Down Expand Up @@ -1010,7 +1010,7 @@ func testTimelineFork(t *testing.T, syncRepl, usePgrewind bool) {
}
defer os.RemoveAll(dir)

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, syncRepl, usePgrewind, nil)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -1206,7 +1206,7 @@ func testMasterChangedAddress(t *testing.T, standbyCluster bool) {
var ptk *TestKeeper
var primary *TestKeeper
if standbyCluster {
primaryClusterName := uuid.NewV4().String()
primaryClusterName := uuid.Must(uuid.NewRandom()).String()
ptks, ptss, ptp, ptstore := setupServers(t, primaryClusterName, dir, 1, 1, false, false, nil)
defer shutdown(ptks, ptss, ptp, ptstore)
for _, ptk = range ptks {
Expand All @@ -1215,7 +1215,7 @@ func testMasterChangedAddress(t *testing.T, standbyCluster bool) {
primary = ptk
}

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, false, false, ptk)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -1301,7 +1301,7 @@ func TestFailedStandby(t *testing.T) {
}
defer os.RemoveAll(dir)

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

initialClusterSpec := &cluster.ClusterSpec{
InitMode: cluster.ClusterInitModeP(cluster.ClusterInitModeNew),
Expand Down Expand Up @@ -1392,7 +1392,7 @@ func TestLoweredMaxStandbysPerSender(t *testing.T) {
}
defer os.RemoveAll(dir)

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

initialClusterSpec := &cluster.ClusterSpec{
InitMode: cluster.ClusterInitModeP(cluster.ClusterInitModeNew),
Expand Down Expand Up @@ -1457,7 +1457,7 @@ func TestKeeperRemoval(t *testing.T) {
}
defer os.RemoveAll(dir)

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

initialClusterSpec := &cluster.ClusterSpec{
InitMode: cluster.ClusterInitModeP(cluster.ClusterInitModeNew),
Expand Down Expand Up @@ -1565,7 +1565,7 @@ func testKeeperRemovalStolonCtl(t *testing.T, syncRepl bool) {
}
defer os.RemoveAll(dir)

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

initialClusterSpec := &cluster.ClusterSpec{
InitMode: cluster.ClusterInitModeP(cluster.ClusterInitModeNew),
Expand Down Expand Up @@ -1691,7 +1691,7 @@ func TestStandbyCantSync(t *testing.T) {
}
defer os.RemoveAll(dir)

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

initialClusterSpec := &cluster.ClusterSpec{
InitMode: cluster.ClusterInitModeP(cluster.ClusterInitModeNew),
Expand Down Expand Up @@ -1821,7 +1821,7 @@ func TestDisappearedKeeperData(t *testing.T) {
}
defer os.RemoveAll(dir)

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, false, false, nil)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -1905,7 +1905,7 @@ func testForceFail(t *testing.T, syncRepl bool, standbyCluster bool) {
var ptk *TestKeeper
var primary *TestKeeper
if standbyCluster {
primaryClusterName := uuid.NewV4().String()
primaryClusterName := uuid.Must(uuid.NewRandom()).String()
ptks, ptss, ptp, ptstore := setupServers(t, primaryClusterName, dir, 1, 1, false, false, nil)
defer shutdown(ptks, ptss, ptp, ptstore)
for _, ptk = range ptks {
Expand All @@ -1914,7 +1914,7 @@ func testForceFail(t *testing.T, syncRepl bool, standbyCluster bool) {
primary = ptk
}

clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, syncRepl, false, ptk)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -2017,7 +2017,7 @@ func testSyncStandbyNotInSync(t *testing.T, minSync0 bool) {
t.Fatalf("unexpected err: %v", err)
}
defer os.RemoveAll(dir)
clusterName := uuid.NewV4().String()
clusterName := uuid.Must(uuid.NewRandom()).String()
clusterOpts := []optionSetter{
withMinSync0(minSync0),
}
Expand Down
Loading