Skip to content

Commit

Permalink
Merge pull request #11 from renstrom/pin-version
Browse files Browse the repository at this point in the history
Pin version of satori/go.uuid
  • Loading branch information
Peter Renström authored Jan 15, 2018
2 parents f7bce94 + 37315b2 commit e8e2dcc
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor
11 changes: 10 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
language: go

go:
- 1.4
- 1.5
- 1.6
- 1.7
- 1.8
- 1.9

env:
- DEP_VERSION="0.3.2" GO15VENDOREXPERIMENT=1

before_install:
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
- chmod +x $GOPATH/bin/dep

install:
- dep ensure

script:
go test -v

Expand Down
3 changes: 3 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[[constraint]]
name = "github.com/satori/go.uuid"
version = "1.2"
8 changes: 4 additions & 4 deletions shortuuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ type Encoder interface {

// New returns a new UUIDv4, encoded with base57.
func New() string {
return DefaultEncoder.Encode(uuid.Must(uuid.NewV4()))
return DefaultEncoder.Encode(uuid.NewV4())
}

// NewWithEncoder returns a new UUIDv4, encoded with enc.
func NewWithEncoder(enc Encoder) string {
return enc.Encode(uuid.Must(uuid.NewV4()))
return enc.Encode(uuid.NewV4())
}

// NewWithNamespace returns a new UUIDv5 (or v4 if name is empty), encoded with base57.
Expand All @@ -32,7 +32,7 @@ func NewWithNamespace(name string) string {

switch {
case name == "":
u = uuid.Must(uuid.NewV4())
u = uuid.NewV4()
case strings.HasPrefix(name, "http"):
u = uuid.NewV5(uuid.NamespaceURL, name)
default:
Expand All @@ -46,5 +46,5 @@ func NewWithNamespace(name string) string {
// alternative alphabet abc.
func NewWithAlphabet(abc string) string {
enc := base57{newAlphabet(abc)}
return enc.Encode(uuid.Must(uuid.NewV4()))
return enc.Encode(uuid.NewV4())
}
6 changes: 1 addition & 5 deletions shortuuid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,7 @@ func BenchmarkUUID(b *testing.B) {
}

func BenchmarkEncoding(b *testing.B) {
u, err := uuid.NewV4()
if err != nil {
b.Logf("Unable to create UUIDv4: %s", err)
b.FailNow()
}
u := uuid.NewV4()
for i := 0; i < b.N; i++ {
DefaultEncoder.Encode(u)
}
Expand Down

0 comments on commit e8e2dcc

Please sign in to comment.