Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin version of satori/go.uuid #11

Merged
merged 10 commits into from
Jan 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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