From 4e09a76d64967c66642ca106942c2206aaf91288 Mon Sep 17 00:00:00 2001 From: "Jonathan Leibiusky @xetorthio" Date: Tue, 14 Nov 2017 16:42:02 -0300 Subject: [PATCH] Use a better uuid library --- Gopkg.lock | 14 +++++++------- Gopkg.toml | 8 ++++---- handlers/login.go | 2 +- handlers/ws.go | 2 +- pwd/playground.go | 6 +++--- pwd/playground_test.go | 4 ++-- pwd/types/playground_test.go | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 127e0fa..fb0425b 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -203,6 +203,12 @@ revision = "02dd45c33376f85d1064355dc790dcc4850596b1" version = "v1.1" +[[projects]] + branch = "master" + name = "github.com/satori/go.uuid" + packages = ["."] + revision = "5bf94b69c6b68ee1b541973bb8e1144db23a194b" + [[projects]] name = "github.com/shirou/gopsutil" packages = ["internal/common","load"] @@ -221,12 +227,6 @@ packages = ["assert","mock"] revision = "2aa2c176b9dab406a6970f6a55f513e8a8c8b18f" -[[projects]] - name = "github.com/twinj/uuid" - packages = ["."] - revision = "835a10bbd6bce40820349a68b1368a62c3c5617c" - version = "v1.0.0" - [[projects]] name = "github.com/urfave/negroni" packages = ["."] @@ -278,6 +278,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "b4e3f9681dc0f331b539efe648984eff43aaf82270bee1adfad1a7aa07732ffa" + inputs-digest = "c44df7b948bc670608433a44e0c0b7997ab6efe72869b805669503c1c66d651b" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 59926f2..6abc629 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -65,10 +65,6 @@ name = "github.com/shirou/gopsutil" version = "2.17.9" -[[constraint]] - name = "github.com/twinj/uuid" - version = "1.0.0" - [[constraint]] name = "github.com/urfave/negroni" version = "0.2.0" @@ -84,3 +80,7 @@ [[constraint]] branch = "master" name = "github.com/stretchr/testify" + +[[constraint]] + branch = "master" + name = "github.com/satori/go.uuid" diff --git a/handlers/login.go b/handlers/login.go index c2133f7..9ba7ae7 100644 --- a/handlers/login.go +++ b/handlers/login.go @@ -14,7 +14,7 @@ import ( fb "github.com/huandu/facebook" "github.com/play-with-docker/play-with-docker/config" "github.com/play-with-docker/play-with-docker/pwd/types" - "github.com/twinj/uuid" + "github.com/satori/go.uuid" ) func LoggedInUser(rw http.ResponseWriter, req *http.Request) { diff --git a/handlers/ws.go b/handlers/ws.go index 0c89e3c..bdde831 100644 --- a/handlers/ws.go +++ b/handlers/ws.go @@ -10,7 +10,7 @@ import ( "github.com/gorilla/mux" "github.com/gorilla/websocket" "github.com/play-with-docker/play-with-docker/event" - "github.com/twinj/uuid" + "github.com/satori/go.uuid" ) var upgrader = websocket.Upgrader{ diff --git a/pwd/playground.go b/pwd/playground.go index 812374f..1498f76 100644 --- a/pwd/playground.go +++ b/pwd/playground.go @@ -4,11 +4,11 @@ import ( "log" "github.com/play-with-docker/play-with-docker/pwd/types" - "github.com/twinj/uuid" + "github.com/satori/go.uuid" ) func (p *pwd) PlaygroundNew(playground types.Playground) (*types.Playground, error) { - playground.Id = uuid.NewV5(uuid.NameSpaceURL, uuid.Name(playground.Domain)).String() + playground.Id = uuid.NewV5(uuid.NamespaceOID, playground.Domain).String() if err := p.storage.PlaygroundPut(&playground); err != nil { log.Printf("Error saving playground %s. Got: %v\n", playground.Id, err) return nil, err @@ -27,7 +27,7 @@ func (p *pwd) PlaygroundGet(id string) *types.Playground { } func (p *pwd) PlaygroundFindByDomain(domain string) *types.Playground { - id := uuid.NewV5(uuid.NameSpaceURL, uuid.Name(domain)).String() + id := uuid.NewV5(uuid.NamespaceOID, domain).String() return p.PlaygroundGet(id) } diff --git a/pwd/playground_test.go b/pwd/playground_test.go index f3bf5e9..4d48f5e 100644 --- a/pwd/playground_test.go +++ b/pwd/playground_test.go @@ -10,9 +10,9 @@ import ( "github.com/play-with-docker/play-with-docker/provisioner" "github.com/play-with-docker/play-with-docker/pwd/types" "github.com/play-with-docker/play-with-docker/storage" + "github.com/satori/go.uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" - "github.com/twinj/uuid" ) func TestPlaygroundNew(t *testing.T) { @@ -35,7 +35,7 @@ func TestPlaygroundNew(t *testing.T) { assert.Nil(t, e) assert.NotNil(t, playground) - expectedPlayground.Id = uuid.NewV5(uuid.NameSpaceURL, uuid.Name("localhost")).String() + expectedPlayground.Id = uuid.NewV5(uuid.NamespaceOID, "localhost").String() assert.Equal(t, expectedPlayground, *playground) _d.AssertExpectations(t) diff --git a/pwd/types/playground_test.go b/pwd/types/playground_test.go index 42a2e94..e410888 100644 --- a/pwd/types/playground_test.go +++ b/pwd/types/playground_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" + "github.com/satori/go.uuid" "github.com/stretchr/testify/assert" - "github.com/twinj/uuid" ) func TestPlayground_Extras_GetInt(t *testing.T) {