Skip to content

Commit d823811

Browse files
committed
Forbid the use of pborman/uuid and remove uses
1 parent 7be52d5 commit d823811

File tree

174 files changed

+1887
-1858
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+1887
-1858
lines changed

.github/.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ linters:
3535
msg: "Please use require.Eventually or assert.Eventually instead unless you've no other option"
3636
- pattern: panic
3737
msg: "Please avoid using panic in application code"
38+
- pattern: github.com/pborman/uuid
39+
msg: "Importing github.com/pborman/uuid is disallowed; use github.com/google/uuid or the project's uuid utility instead"
3840
importas:
3941
# Enforce the aliases below.
4042
no-unaliased: true

chasm/lib/scheduler/backfiller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package scheduler
33
import (
44
"time"
55

6-
"github.com/pborman/uuid"
6+
"github.com/google/uuid"
77
schedulespb "go.temporal.io/server/api/schedule/v1"
88
"go.temporal.io/server/chasm"
99
"go.temporal.io/server/chasm/lib/scheduler/gen/schedulerpb/v1"
@@ -33,7 +33,7 @@ func newBackfiller(
3333
ctx chasm.MutableContext,
3434
scheduler *Scheduler,
3535
) *Backfiller {
36-
id := uuid.New()
36+
id := uuid.NewString()
3737
backfiller := &Backfiller{
3838
BackfillerState: &schedulerpb.BackfillerState{
3939
BackfillId: id,

common/checksum/crc_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"testing"
77
"time"
88

9-
"github.com/pborman/uuid"
9+
"github.com/google/uuid"
1010
"github.com/stretchr/testify/assert"
1111
commonpb "go.temporal.io/api/common/v1"
1212
workflowpb "go.temporal.io/api/workflow/v1"
@@ -21,8 +21,8 @@ func TestCRC32OverProto(t *testing.T) {
2121
// different set of serialized bytes
2222
obj := &workflowpb.WorkflowExecutionInfo{
2323
Execution: &commonpb.WorkflowExecution{
24-
WorkflowId: uuid.New(),
25-
RunId: uuid.New(),
24+
WorkflowId: uuid.NewString(),
25+
RunId: uuid.NewString(),
2626
},
2727
StartTime: timestamppb.New(time.Now().UTC()),
2828
HistoryLength: 550,

common/cluster/metadata_test.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66
"time"
77

8-
"github.com/pborman/uuid"
8+
"github.com/google/uuid"
99
"github.com/stretchr/testify/require"
1010
"github.com/stretchr/testify/suite"
1111
persistencespb "go.temporal.io/server/api/persistence/v1"
@@ -51,29 +51,29 @@ func (s *metadataSuite) SetupTest() {
5151

5252
s.isGlobalNamespaceEnabled = true
5353
s.failoverVersionIncrement = 100
54-
s.clusterName = uuid.New()
55-
s.secondClusterName = uuid.New()
56-
s.thirdClusterName = uuid.New()
54+
s.clusterName = uuid.NewString()
55+
s.secondClusterName = uuid.NewString()
56+
s.thirdClusterName = uuid.NewString()
5757

5858
clusterInfo := map[string]ClusterInformation{
5959
s.clusterName: {
6060
Enabled: true,
6161
InitialFailoverVersion: int64(1),
62-
RPCAddress: uuid.New(),
62+
RPCAddress: uuid.NewString(),
6363
ShardCount: 1,
6464
version: 1,
6565
},
6666
s.secondClusterName: {
6767
Enabled: true,
6868
InitialFailoverVersion: int64(4),
69-
RPCAddress: uuid.New(),
69+
RPCAddress: uuid.NewString(),
7070
ShardCount: 2,
7171
version: 1,
7272
},
7373
s.thirdClusterName: {
7474
Enabled: true,
7575
InitialFailoverVersion: int64(5),
76-
RPCAddress: uuid.New(),
76+
RPCAddress: uuid.NewString(),
7777
ShardCount: 1,
7878
version: 1,
7979
},
@@ -135,7 +135,7 @@ func (s *metadataSuite) Test_RegisterMetadataChangeCallback() {
135135
}
136136

137137
func (s *metadataSuite) Test_RefreshClusterMetadata_Success() {
138-
id := uuid.New()
138+
id := uuid.NewString()
139139
s.metadata.clusterChangeCallback[id] = func(oldClusterMetadata map[string]*ClusterInformation, newClusterMetadata map[string]*ClusterInformation) {
140140
oldMetadata, ok := oldClusterMetadata[id]
141141
s.True(ok)
@@ -169,8 +169,8 @@ func (s *metadataSuite) Test_RefreshClusterMetadata_Success() {
169169
IsConnectionEnabled: true,
170170
InitialFailoverVersion: 1,
171171
HistoryShardCount: 1,
172-
ClusterAddress: uuid.New(),
173-
HttpAddress: uuid.New(),
172+
ClusterAddress: uuid.NewString(),
173+
HttpAddress: uuid.NewString(),
174174
},
175175
Version: 1,
176176
},
@@ -181,8 +181,8 @@ func (s *metadataSuite) Test_RefreshClusterMetadata_Success() {
181181
IsConnectionEnabled: true,
182182
InitialFailoverVersion: 1,
183183
HistoryShardCount: 1,
184-
ClusterAddress: uuid.New(),
185-
HttpAddress: uuid.New(),
184+
ClusterAddress: uuid.NewString(),
185+
HttpAddress: uuid.NewString(),
186186
Tags: map[string]string{"test": "test"},
187187
},
188188
Version: 2,
@@ -194,8 +194,8 @@ func (s *metadataSuite) Test_RefreshClusterMetadata_Success() {
194194
IsConnectionEnabled: true,
195195
InitialFailoverVersion: 2,
196196
HistoryShardCount: 2,
197-
ClusterAddress: uuid.New(),
198-
HttpAddress: uuid.New(),
197+
ClusterAddress: uuid.NewString(),
198+
HttpAddress: uuid.NewString(),
199199
Tags: map[string]string{"test": "test"},
200200
},
201201
Version: 2,
@@ -211,7 +211,7 @@ func (s *metadataSuite) Test_RefreshClusterMetadata_Success() {
211211

212212
func (s *metadataSuite) Test_ListAllClusterMetadataFromDB_Success() {
213213
nextPageSizeToken := []byte{1}
214-
newClusterName := uuid.New()
214+
newClusterName := uuid.NewString()
215215
s.mockClusterMetadataStore.EXPECT().ListClusterMetadata(gomock.Any(), &persistence.ListClusterMetadataRequest{
216216
PageSize: defaultClusterMetadataPageSize,
217217
NextPageToken: nil,
@@ -224,8 +224,8 @@ func (s *metadataSuite) Test_ListAllClusterMetadataFromDB_Success() {
224224
IsConnectionEnabled: true,
225225
InitialFailoverVersion: 1,
226226
HistoryShardCount: 1,
227-
ClusterAddress: uuid.New(),
228-
HttpAddress: uuid.New(),
227+
ClusterAddress: uuid.NewString(),
228+
HttpAddress: uuid.NewString(),
229229
},
230230
Version: 1,
231231
},
@@ -244,8 +244,8 @@ func (s *metadataSuite) Test_ListAllClusterMetadataFromDB_Success() {
244244
IsConnectionEnabled: true,
245245
InitialFailoverVersion: 2,
246246
HistoryShardCount: 2,
247-
ClusterAddress: uuid.New(),
248-
HttpAddress: uuid.New(),
247+
ClusterAddress: uuid.NewString(),
248+
HttpAddress: uuid.NewString(),
249249
},
250250
Version: 2,
251251
},

common/collection/concurrent_tx_map_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"sync/atomic"
88
"testing"
99

10-
"github.com/pborman/uuid"
10+
"github.com/google/uuid"
1111
"github.com/stretchr/testify/require"
1212
"github.com/stretchr/testify/suite"
1313
)
@@ -55,7 +55,7 @@ func (s *ConcurrentTxMapSuite) TestLen() {
5555

5656
func (s *ConcurrentTxMapSuite) TestGetAndDo() {
5757
testMap := NewShardedConcurrentTxMap(1, UUIDHashCode)
58-
key := uuid.New()
58+
key := uuid.NewString()
5959
var value intType
6060
fnApplied := false
6161

@@ -86,7 +86,7 @@ func (s *ConcurrentTxMapSuite) TestGetAndDo() {
8686

8787
func (s *ConcurrentTxMapSuite) TestPutOrDo() {
8888
testMap := NewShardedConcurrentTxMap(1, UUIDHashCode)
89-
key := uuid.New()
89+
key := uuid.NewString()
9090
var value intType
9191
fnApplied := false
9292

@@ -117,7 +117,7 @@ func (s *ConcurrentTxMapSuite) TestPutOrDo() {
117117

118118
func (s *ConcurrentTxMapSuite) TestRemoveIf() {
119119
testMap := NewShardedConcurrentTxMap(1, UUIDHashCode)
120-
key := uuid.New()
120+
key := uuid.NewString()
121121
value := intType(1)
122122
testMap.Put(key, &value)
123123

@@ -142,7 +142,7 @@ func (s *ConcurrentTxMapSuite) TestGetAfterPut() {
142142
testMap := NewShardedConcurrentTxMap(1, UUIDHashCode)
143143

144144
for i := 0; i < 1024; i++ {
145-
key := uuid.New()
145+
key := uuid.NewString()
146146
countMap[key] = 0
147147
testMap.Put(key, boolType(true))
148148
}
@@ -175,7 +175,7 @@ func (s *ConcurrentTxMapSuite) TestGetAfterPut() {
175175

176176
func (s *ConcurrentTxMapSuite) TestPutIfNotExist() {
177177
testMap := NewShardedConcurrentTxMap(1, UUIDHashCode)
178-
key := uuid.New()
178+
key := uuid.NewString()
179179
ok := testMap.PutIfNotExist(key, boolType(true))
180180
s.True(ok, "PutIfNotExist failed to insert item")
181181
ok = testMap.PutIfNotExist(key, boolType(true))
@@ -186,7 +186,7 @@ func (s *ConcurrentTxMapSuite) TestMapConcurrency() {
186186
nKeys := 1024
187187
keys := make([]string, nKeys)
188188
for i := 0; i < nKeys; i++ {
189-
keys[i] = uuid.New()
189+
keys[i] = uuid.NewString()
190190
}
191191

192192
var total int32

common/membership/ringpop/monitor.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"sync"
1212
"time"
1313

14-
"github.com/pborman/uuid"
14+
"github.com/google/uuid"
1515
"github.com/temporalio/ringpop-go"
1616
"github.com/temporalio/ringpop-go/discovery/statichosts"
1717
"github.com/temporalio/ringpop-go/swim"
@@ -101,7 +101,7 @@ func newMonitor(
101101
logger: logger,
102102
metadataManager: metadataManager,
103103
broadcastHostPortResolver: broadcastHostPortResolver,
104-
hostID: uuid.NewUUID(),
104+
hostID: uuid.New(),
105105
initialized: future.NewFuture[struct{}](),
106106
maxJoinDuration: maxJoinDuration,
107107
propagationTime: propagationTime,
@@ -347,6 +347,7 @@ func (rpo *monitor) fetchCurrentBootstrapHostports() ([]string, error) {
347347
for _, host := range resp.ActiveMembers {
348348
set[net.JoinHostPort(host.RPCAddress.String(), convert.Uint16ToString(host.RPCPort))] = struct{}{}
349349
}
350+
nextPageToken = resp.NextPageToken
350351

351352
// Stop iterating once we have either 500 unique ip:port combos or there is no more results.
352353
if nextPageToken == nil || len(set) >= 500 {

common/membership/ringpop/test_cluster.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66
"time"
77

8-
"github.com/pborman/uuid"
8+
"github.com/google/uuid"
99
"github.com/temporalio/ringpop-go"
1010
"github.com/temporalio/tchannel-go"
1111
"go.temporal.io/server/common/config"
@@ -71,7 +71,7 @@ func newTestCluster(
7171
logger.Error("tchannel listen failed", tag.Error(err))
7272
return nil
7373
}
74-
cluster.hostUUIDs[i] = uuid.New()
74+
cluster.hostUUIDs[i] = uuid.NewString()
7575
cluster.hostAddrs[i], err = buildBroadcastHostPort(cluster.channels[i].PeerInfo(), broadcastAddress)
7676
if err != nil {
7777
logger.Error("Failed to build broadcast hostport", tag.Error(err))
@@ -92,7 +92,7 @@ func newTestCluster(
9292
return nil
9393
}
9494
seedMember := &persistence.ClusterMember{
95-
HostID: uuid.NewUUID(),
95+
HostID: uuid.New(),
9696
RPCAddress: seedAddress,
9797
RPCPort: seedPort,
9898
SessionStart: time.Now().UTC(),
@@ -109,7 +109,7 @@ func newTestCluster(
109109
// All subsequent calls only return the single "good" seed member
110110
// This ensures that we exercise the retry path in bootstrap properly.
111111
badSeedMember := &persistence.ClusterMember{
112-
HostID: uuid.NewUUID(),
112+
HostID: uuid.New(),
113113
RPCAddress: seedAddress,
114114
RPCPort: seedPort + 1,
115115
SessionStart: time.Now().UTC(),

common/metrics/tally_metrics_handler_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66
"time"
77

8-
"github.com/pborman/uuid"
8+
"github.com/google/uuid"
99
"github.com/stretchr/testify/assert"
1010
"github.com/uber-go/tally/v4"
1111
)
@@ -62,7 +62,7 @@ func TestTallyScope(t *testing.T) {
6262
assert.EqualValues(t, map[time.Duration]int64(nil), histograms["test.transmission+"].Durations())
6363
assert.EqualValues(t, map[string]string{}, histograms["test.transmission+"].Tags())
6464

65-
newTaggedHandler := mp.WithTags(NamespaceTag(uuid.New()))
65+
newTaggedHandler := mp.WithTags(NamespaceTag(uuid.NewString()))
6666
recordTallyMetrics(newTaggedHandler)
6767
snap = scope.Snapshot()
6868
counters = snap.Counters()

common/namespace/nsreplication/dlq_message_handler_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"testing"
77

8-
"github.com/pborman/uuid"
8+
"github.com/google/uuid"
99
"github.com/stretchr/testify/require"
1010
"github.com/stretchr/testify/suite"
1111
enumsspb "go.temporal.io/server/api/enums/v1"
@@ -163,7 +163,7 @@ func (s *dlqMessageHandlerSuite) TestMergeMessages() {
163163
messageID := int64(11)
164164

165165
namespaceAttribute := &replicationspb.NamespaceTaskAttributes{
166-
Id: uuid.New(),
166+
Id: uuid.NewString(),
167167
}
168168

169169
tasks := []*replicationspb.ReplicationTask{
@@ -194,7 +194,7 @@ func (s *dlqMessageHandlerSuite) TestMergeMessages_ThrowErrorOnGetDLQAckLevel()
194194
messageID := int64(11)
195195
testError := fmt.Errorf("test")
196196
namespaceAttribute := &replicationspb.NamespaceTaskAttributes{
197-
Id: uuid.New(),
197+
Id: uuid.NewString(),
198198
}
199199

200200
tasks := []*replicationspb.ReplicationTask{
@@ -246,10 +246,10 @@ func (s *dlqMessageHandlerSuite) TestMergeMessages_ThrowErrorOnHandleReceivingTa
246246
messageID2 := int64(12)
247247
testError := fmt.Errorf("test")
248248
namespaceAttribute1 := &replicationspb.NamespaceTaskAttributes{
249-
Id: uuid.New(),
249+
Id: uuid.NewString(),
250250
}
251251
namespaceAttribute2 := &replicationspb.NamespaceTaskAttributes{
252-
Id: uuid.New(),
252+
Id: uuid.NewString(),
253253
}
254254
tasks := []*replicationspb.ReplicationTask{
255255
{
@@ -287,10 +287,10 @@ func (s *dlqMessageHandlerSuite) TestMergeMessages_ThrowErrorOnDeleteMessages()
287287
messageID2 := int64(12)
288288
testError := fmt.Errorf("test")
289289
namespaceAttribute1 := &replicationspb.NamespaceTaskAttributes{
290-
Id: uuid.New(),
290+
Id: uuid.NewString(),
291291
}
292292
namespaceAttribute2 := &replicationspb.NamespaceTaskAttributes{
293-
Id: uuid.New(),
293+
Id: uuid.NewString(),
294294
}
295295
tasks := []*replicationspb.ReplicationTask{
296296
{
@@ -328,7 +328,7 @@ func (s *dlqMessageHandlerSuite) TestMergeMessages_IgnoreErrorOnUpdateDLQAckLeve
328328
messageID := int64(11)
329329
testError := fmt.Errorf("test")
330330
namespaceAttribute := &replicationspb.NamespaceTaskAttributes{
331-
Id: uuid.New(),
331+
Id: uuid.NewString(),
332332
}
333333

334334
tasks := []*replicationspb.ReplicationTask{

0 commit comments

Comments
 (0)