diff --git a/docs/client/repository_test.go b/docs/client/repository_test.go index 9530bd37c..6551c4920 100644 --- a/docs/client/repository_test.go +++ b/docs/client/repository_test.go @@ -12,7 +12,7 @@ import ( "testing" "time" - "code.google.com/p/go-uuid/uuid" + "github.com/docker/distribution/uuid" "github.com/docker/distribution" "github.com/docker/distribution/context" @@ -141,7 +141,7 @@ func TestBlobUploadChunked(t *testing.T) { b1[513:1024], } repo := "test.example.com/uploadrepo" - uuids := []string{uuid.New()} + uuids := []string{uuid.Generate().String()} m = append(m, testutil.RequestResponseMapping{ Request: testutil.Request{ Method: "POST", @@ -159,7 +159,7 @@ func TestBlobUploadChunked(t *testing.T) { }) offset := 0 for i, chunk := range chunks { - uuids = append(uuids, uuid.New()) + uuids = append(uuids, uuid.Generate().String()) newOffset := offset + len(chunk) m = append(m, testutil.RequestResponseMapping{ Request: testutil.Request{ @@ -256,7 +256,7 @@ func TestBlobUploadMonolithic(t *testing.T) { dgst, b1 := newRandomBlob(1024) var m testutil.RequestResponseMap repo := "test.example.com/uploadrepo" - uploadID := uuid.New() + uploadID := uuid.Generate().String() m = append(m, testutil.RequestResponseMapping{ Request: testutil.Request{ Method: "POST", diff --git a/docs/storage/linkedblobstore.go b/docs/storage/linkedblobstore.go index cb06e354b..cb9d9b2bf 100644 --- a/docs/storage/linkedblobstore.go +++ b/docs/storage/linkedblobstore.go @@ -4,11 +4,11 @@ import ( "net/http" "time" - "code.google.com/p/go-uuid/uuid" "github.com/docker/distribution" "github.com/docker/distribution/context" "github.com/docker/distribution/digest" "github.com/docker/distribution/registry/storage/driver" + "github.com/docker/distribution/uuid" ) // linkedBlobStore provides a full BlobService that namespaces the blobs to a @@ -85,7 +85,7 @@ func (lbs *linkedBlobStore) Put(ctx context.Context, mediaType string, p []byte) func (lbs *linkedBlobStore) Create(ctx context.Context) (distribution.BlobWriter, error) { context.GetLogger(ctx).Debug("(*linkedBlobStore).Writer") - uuid := uuid.New() + uuid := uuid.Generate().String() startedAt := time.Now().UTC() path, err := lbs.blobStore.pm.path(uploadDataPathSpec{ diff --git a/docs/storage/purgeuploads.go b/docs/storage/purgeuploads.go index cf723070d..c66f8881a 100644 --- a/docs/storage/purgeuploads.go +++ b/docs/storage/purgeuploads.go @@ -5,10 +5,10 @@ import ( "strings" "time" - "code.google.com/p/go-uuid/uuid" log "github.com/Sirupsen/logrus" "github.com/docker/distribution/context" storageDriver "github.com/docker/distribution/registry/storage/driver" + "github.com/docker/distribution/uuid" ) // uploadData stored the location of temporary files created during a layer upload @@ -116,8 +116,8 @@ func getOutstandingUploads(ctx context.Context, driver storageDriver.StorageDriv func uUIDFromPath(path string) (string, bool) { components := strings.Split(path, "/") for i := len(components) - 1; i >= 0; i-- { - if uuid := uuid.Parse(components[i]); uuid != nil { - return uuid.String(), i == len(components)-1 + if u, err := uuid.Parse(components[i]); err == nil { + return u.String(), i == len(components)-1 } } return "", false diff --git a/docs/storage/purgeuploads_test.go b/docs/storage/purgeuploads_test.go index d44084791..18c98af8f 100644 --- a/docs/storage/purgeuploads_test.go +++ b/docs/storage/purgeuploads_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" - "code.google.com/p/go-uuid/uuid" "github.com/docker/distribution/context" "github.com/docker/distribution/registry/storage/driver" "github.com/docker/distribution/registry/storage/driver/inmemory" + "github.com/docker/distribution/uuid" ) var pm = defaultPathMapper @@ -18,7 +18,7 @@ func testUploadFS(t *testing.T, numUploads int, repoName string, startedAt time. d := inmemory.New() ctx := context.Background() for i := 0; i < numUploads; i++ { - addUploads(ctx, t, d, uuid.New(), repoName, startedAt) + addUploads(ctx, t, d, uuid.Generate().String(), repoName, startedAt) } return d, ctx } @@ -73,7 +73,7 @@ func TestPurgeAll(t *testing.T) { fs, ctx := testUploadFS(t, uploadCount, "test-repo", oneHourAgo) // Ensure > 1 repos are purged - addUploads(ctx, t, fs, uuid.New(), "test-repo2", oneHourAgo) + addUploads(ctx, t, fs, uuid.Generate().String(), "test-repo2", oneHourAgo) uploadCount++ deleted, errs := PurgeUploads(ctx, fs, time.Now(), true) @@ -95,7 +95,7 @@ func TestPurgeSome(t *testing.T) { newUploadCount := 4 for i := 0; i < newUploadCount; i++ { - addUploads(ctx, t, fs, uuid.New(), "test-repo", time.Now().Add(1*time.Hour)) + addUploads(ctx, t, fs, uuid.Generate().String(), "test-repo", time.Now().Add(1*time.Hour)) } deleted, errs := PurgeUploads(ctx, fs, time.Now(), true) @@ -115,7 +115,7 @@ func TestPurgeOnlyUploads(t *testing.T) { // Create a directory tree outside _uploads and ensure // these files aren't deleted. - dataPath, err := pm.path(uploadDataPathSpec{name: "test-repo", id: uuid.New()}) + dataPath, err := pm.path(uploadDataPathSpec{name: "test-repo", id: uuid.Generate().String()}) if err != nil { t.Fatalf(err.Error()) }