use google/uuid
The old package was a fork that got unforked on this. Might as well use
it directly.
Bug: skia:
Change-Id: I58fd0b8d64d828707637fd2b3322d24f8013dc92
Reviewed-on: https://skia-review.googlesource.com/c/173910
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
diff --git a/debugger/go/instances/instances.go b/debugger/go/instances/instances.go
index 45378bc..b6ddc34 100644
--- a/debugger/go/instances/instances.go
+++ b/debugger/go/instances/instances.go
@@ -13,7 +13,7 @@
"sync"
"time"
- "github.com/pborman/uuid"
+ "github.com/google/uuid"
"go.skia.org/infra/go/exec"
"go.skia.org/infra/go/httputils"
"go.skia.org/infra/go/metrics2"
@@ -57,7 +57,7 @@
// NewInstanceID creates a new id for an instance of skiaserve.
func NewInstanceID() string {
- return fmt.Sprintf("%x", uuid.NewRandom())
+ return uuid.New().String()
}
// instance represents a single skiaserve instance, which may or may not
diff --git a/go/git/testutils/git_builder.go b/go/git/testutils/git_builder.go
index 950781d..ff93215 100644
--- a/go/git/testutils/git_builder.go
+++ b/go/git/testutils/git_builder.go
@@ -9,7 +9,7 @@
"strings"
"time"
- "github.com/pborman/uuid"
+ "github.com/google/uuid"
assert "github.com/stretchr/testify/require"
"go.skia.org/infra/go/exec"
"go.skia.org/infra/go/git/git_common"
@@ -93,7 +93,7 @@
// genString returns a string with arbitrary content.
func genString() string {
- return uuid.New()
+ return uuid.New().String()
}
// Add writes contents to file and adds it to the index.
diff --git a/golden/go/pdag/pdag.go b/golden/go/pdag/pdag.go
index e28bdd8..ed6b2f3 100644
--- a/golden/go/pdag/pdag.go
+++ b/golden/go/pdag/pdag.go
@@ -34,7 +34,7 @@
import (
"sync"
- "github.com/pborman/uuid"
+ "github.com/google/uuid"
"go.skia.org/infra/go/sklog"
)
@@ -64,8 +64,8 @@
// Create a new node with a unique id.
id := uuid.New()
node := &Node{
- id: id,
- name: id,
+ id: id.String(),
+ name: id.String(),
children: map[string]*Node{},
procFn: fn,
inputCh: make(chan *call),
@@ -98,7 +98,7 @@
func (n *Node) Trigger(state interface{}) error {
// Create a call message.
msg := call{
- id: uuid.New(),
+ id: uuid.New().String(),
state: state,
errCh: make(chan error, 1),
}
diff --git a/scripts/run_on_swarming_bots/run_on_swarming_bots.go b/scripts/run_on_swarming_bots/run_on_swarming_bots.go
index 9e90703..750a824 100644
--- a/scripts/run_on_swarming_bots/run_on_swarming_bots.go
+++ b/scripts/run_on_swarming_bots/run_on_swarming_bots.go
@@ -12,7 +12,7 @@
"sync"
"time"
- "github.com/pborman/uuid"
+ "github.com/google/uuid"
"go.skia.org/infra/go/auth"
"go.skia.org/infra/go/common"
"go.skia.org/infra/go/httputils"
diff --git a/task_driver/examples/basic/basic.go b/task_driver/examples/basic/basic.go
index fa4c812..b0f8157 100644
--- a/task_driver/examples/basic/basic.go
+++ b/task_driver/examples/basic/basic.go
@@ -14,7 +14,7 @@
"os"
"path/filepath"
- "github.com/pborman/uuid"
+ "github.com/google/uuid"
"go.skia.org/infra/go/exec"
"go.skia.org/infra/go/sklog"
"go.skia.org/infra/task_driver/go/lib/os_steps"
@@ -182,7 +182,7 @@
// 3. OS or filesystem interactions. We provide a library of steps which
// wrap the normal Go library functions so that they can be run as
// Steps.
- dir := filepath.Join(os.TempDir(), "task_driver_basic_example", uuid.New())
+ dir := filepath.Join(os.TempDir(), "task_driver_basic_example", uuid.New().String())
if err := os_steps.MkdirAll(ctx, dir); err != nil {
return td.FailStep(ctx, err)
}
diff --git a/task_driver/go/td/run.go b/task_driver/go/td/run.go
index 539a06e..b16e092 100644
--- a/task_driver/go/td/run.go
+++ b/task_driver/go/td/run.go
@@ -9,7 +9,7 @@
"strings"
"time"
- "github.com/pborman/uuid"
+ "github.com/google/uuid"
"go.skia.org/infra/go/auth"
"go.skia.org/infra/go/common"
"go.skia.org/infra/go/sklog"
@@ -311,7 +311,7 @@
// Open a log stream.
func (r *run) LogStream(stepId, logName, severity string) io.Writer {
- logId := uuid.New() // TODO(borenet): Come up with a better ID.
+ logId := uuid.New().String() // TODO(borenet): Come up with a better ID.
rv, err := r.receiver.LogStream(stepId, logId, severity)
if err != nil {
panic(err)
diff --git a/task_driver/go/td/step.go b/task_driver/go/td/step.go
index fd537fd..18c2d83 100644
--- a/task_driver/go/td/step.go
+++ b/task_driver/go/td/step.go
@@ -11,8 +11,8 @@
"strings"
"sync"
+ "github.com/google/uuid"
multierror "github.com/hashicorp/go-multierror"
- "github.com/pborman/uuid"
"go.skia.org/infra/go/exec"
"go.skia.org/infra/go/sklog"
"go.skia.org/infra/go/util"
@@ -62,7 +62,7 @@
// Create a step.
func StartStep(ctx context.Context, props *StepProperties) context.Context {
parent := getStep(ctx)
- return newStep(ctx, uuid.New(), parent, props)
+ return newStep(ctx, uuid.New().String(), parent, props)
}
// infraErrors collects all infrastructure errors.
diff --git a/task_scheduler/go/db/firestore/firestore_test.go b/task_scheduler/go/db/firestore/firestore_test.go
index f9d6fd1..71d9388 100644
--- a/task_scheduler/go/db/firestore/firestore_test.go
+++ b/task_scheduler/go/db/firestore/firestore_test.go
@@ -7,7 +7,7 @@
"testing"
"time"
- "github.com/pborman/uuid"
+ "github.com/google/uuid"
"github.com/stretchr/testify/assert"
"go.skia.org/infra/go/deepequal"
"go.skia.org/infra/go/firestore"
diff --git a/task_scheduler/go/db/memory/memory.go b/task_scheduler/go/db/memory/memory.go
index c9c880f..ce2e8d5 100644
--- a/task_scheduler/go/db/memory/memory.go
+++ b/task_scheduler/go/db/memory/memory.go
@@ -6,7 +6,7 @@
"sync"
"time"
- "github.com/pborman/uuid"
+ "github.com/google/uuid"
"go.skia.org/infra/go/sklog"
"go.skia.org/infra/go/util"
"go.skia.org/infra/task_scheduler/go/db"
@@ -25,7 +25,7 @@
if t.Id != "" {
return fmt.Errorf("Task Id already assigned: %v", t.Id)
}
- t.Id = uuid.New()
+ t.Id = uuid.New().String()
return nil
}
@@ -118,7 +118,7 @@
if j.Id != "" {
return fmt.Errorf("Job Id already assigned: %v", j.Id)
}
- j.Id = uuid.New()
+ j.Id = uuid.New().String()
return nil
}
diff --git a/task_scheduler/go/db/modified/modified_data.go b/task_scheduler/go/db/modified/modified_data.go
index 7b499a2..21b3f6f 100644
--- a/task_scheduler/go/db/modified/modified_data.go
+++ b/task_scheduler/go/db/modified/modified_data.go
@@ -7,7 +7,7 @@
"sync"
"time"
- "github.com/pborman/uuid"
+ "github.com/google/uuid"
"go.skia.org/infra/go/sklog"
"go.skia.org/infra/task_scheduler/go/db"
"go.skia.org/infra/task_scheduler/go/types"
@@ -100,7 +100,7 @@
} else if len(m.expiration) >= db.MAX_MODIFIED_DATA_USERS {
return "", db.ErrTooManyUsers
}
- id := uuid.New()
+ id := uuid.New().String()
m.expiration[id] = time.Now().Add(db.MODIFIED_DATA_TIMEOUT)
return id, nil
}
diff --git a/task_scheduler/go/db/pubsub/pubsub.go b/task_scheduler/go/db/pubsub/pubsub.go
index d78753d..e131744 100644
--- a/task_scheduler/go/db/pubsub/pubsub.go
+++ b/task_scheduler/go/db/pubsub/pubsub.go
@@ -8,7 +8,7 @@
"time"
"cloud.google.com/go/pubsub"
- "github.com/pborman/uuid"
+ "github.com/google/uuid"
"go.skia.org/infra/go/cleanup"
"go.skia.org/infra/go/sklog"
"go.skia.org/infra/go/util"
@@ -56,7 +56,7 @@
}
}
p := &publisher{
- senderId: uuid.New(),
+ senderId: uuid.New().String(),
topic: t,
}
cleanup.AtExit(func() {
diff --git a/task_scheduler/go/testutils/testutils.go b/task_scheduler/go/testutils/testutils.go
index ad021fa..5658ffa 100644
--- a/task_scheduler/go/testutils/testutils.go
+++ b/task_scheduler/go/testutils/testutils.go
@@ -7,7 +7,7 @@
"sync"
"time"
- "github.com/pborman/uuid"
+ "github.com/google/uuid"
swarming_api "go.chromium.org/luci/common/api/swarming/swarming/v1"
"go.skia.org/infra/go/sklog"
"go.skia.org/infra/go/swarming"
@@ -181,7 +181,7 @@
}
createdTs := time.Now().UTC().Format(swarming.TIMESTAMP_FORMAT)
- id := uuid.New()
+ id := uuid.New().String()
rv := &swarming_api.SwarmingRpcsTaskRequestMetadata{
Request: &swarming_api.SwarmingRpcsTaskRequest{
CreatedTs: createdTs,