Use a better uuid library

This commit is contained in:
Jonathan Leibiusky @xetorthio
2017-11-14 16:42:02 -03:00
parent 3f5b3882dd
commit 4e09a76d64
7 changed files with 19 additions and 19 deletions

14
Gopkg.lock generated
View File

@@ -203,6 +203,12 @@
revision = "02dd45c33376f85d1064355dc790dcc4850596b1" revision = "02dd45c33376f85d1064355dc790dcc4850596b1"
version = "v1.1" version = "v1.1"
[[projects]]
branch = "master"
name = "github.com/satori/go.uuid"
packages = ["."]
revision = "5bf94b69c6b68ee1b541973bb8e1144db23a194b"
[[projects]] [[projects]]
name = "github.com/shirou/gopsutil" name = "github.com/shirou/gopsutil"
packages = ["internal/common","load"] packages = ["internal/common","load"]
@@ -221,12 +227,6 @@
packages = ["assert","mock"] packages = ["assert","mock"]
revision = "2aa2c176b9dab406a6970f6a55f513e8a8c8b18f" revision = "2aa2c176b9dab406a6970f6a55f513e8a8c8b18f"
[[projects]]
name = "github.com/twinj/uuid"
packages = ["."]
revision = "835a10bbd6bce40820349a68b1368a62c3c5617c"
version = "v1.0.0"
[[projects]] [[projects]]
name = "github.com/urfave/negroni" name = "github.com/urfave/negroni"
packages = ["."] packages = ["."]
@@ -278,6 +278,6 @@
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "b4e3f9681dc0f331b539efe648984eff43aaf82270bee1adfad1a7aa07732ffa" inputs-digest = "c44df7b948bc670608433a44e0c0b7997ab6efe72869b805669503c1c66d651b"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View File

@@ -65,10 +65,6 @@
name = "github.com/shirou/gopsutil" name = "github.com/shirou/gopsutil"
version = "2.17.9" version = "2.17.9"
[[constraint]]
name = "github.com/twinj/uuid"
version = "1.0.0"
[[constraint]] [[constraint]]
name = "github.com/urfave/negroni" name = "github.com/urfave/negroni"
version = "0.2.0" version = "0.2.0"
@@ -84,3 +80,7 @@
[[constraint]] [[constraint]]
branch = "master" branch = "master"
name = "github.com/stretchr/testify" name = "github.com/stretchr/testify"
[[constraint]]
branch = "master"
name = "github.com/satori/go.uuid"

View File

@@ -14,7 +14,7 @@ import (
fb "github.com/huandu/facebook" fb "github.com/huandu/facebook"
"github.com/play-with-docker/play-with-docker/config" "github.com/play-with-docker/play-with-docker/config"
"github.com/play-with-docker/play-with-docker/pwd/types" "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) { func LoggedInUser(rw http.ResponseWriter, req *http.Request) {

View File

@@ -10,7 +10,7 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"github.com/play-with-docker/play-with-docker/event" "github.com/play-with-docker/play-with-docker/event"
"github.com/twinj/uuid" "github.com/satori/go.uuid"
) )
var upgrader = websocket.Upgrader{ var upgrader = websocket.Upgrader{

View File

@@ -4,11 +4,11 @@ import (
"log" "log"
"github.com/play-with-docker/play-with-docker/pwd/types" "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) { 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 { if err := p.storage.PlaygroundPut(&playground); err != nil {
log.Printf("Error saving playground %s. Got: %v\n", playground.Id, err) log.Printf("Error saving playground %s. Got: %v\n", playground.Id, err)
return nil, err return nil, err
@@ -27,7 +27,7 @@ func (p *pwd) PlaygroundGet(id string) *types.Playground {
} }
func (p *pwd) PlaygroundFindByDomain(domain 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) return p.PlaygroundGet(id)
} }

View File

@@ -10,9 +10,9 @@ import (
"github.com/play-with-docker/play-with-docker/provisioner" "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/pwd/types"
"github.com/play-with-docker/play-with-docker/storage" "github.com/play-with-docker/play-with-docker/storage"
"github.com/satori/go.uuid"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
"github.com/twinj/uuid"
) )
func TestPlaygroundNew(t *testing.T) { func TestPlaygroundNew(t *testing.T) {
@@ -35,7 +35,7 @@ func TestPlaygroundNew(t *testing.T) {
assert.Nil(t, e) assert.Nil(t, e)
assert.NotNil(t, playground) 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) assert.Equal(t, expectedPlayground, *playground)
_d.AssertExpectations(t) _d.AssertExpectations(t)

View File

@@ -5,8 +5,8 @@ import (
"testing" "testing"
"time" "time"
"github.com/satori/go.uuid"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/twinj/uuid"
) )
func TestPlayground_Extras_GetInt(t *testing.T) { func TestPlayground_Extras_GetInt(t *testing.T) {