Skip to content

Commit

Permalink
Resolved code issues of gofmt and golint (#55)
Browse files Browse the repository at this point in the history
* Resolved code issues of gofmt and golint

Code quality: https://goreportcard.com/report/github.com/google/uuid

* Fix typo

* Update comment
  • Loading branch information
panjf2000 authored Mar 31, 2020
1 parent 7c63a14 commit bd45158
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions uuid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,13 @@ var tests = []test{
{"f47ac10b-58cc-4372-e567-0e02b2c3d479", 4, Future, true},
{"f47ac10b-58cc-4372-f567-0e02b2c3d479", 4, Future, true},


{"f47ac10b158cc-5372-a567-0e02b2c3d479", 0, Invalid, false},
{"f47ac10b-58cc25372-a567-0e02b2c3d479", 0, Invalid, false},
{"f47ac10b-58cc-53723a567-0e02b2c3d479", 0, Invalid, false},
{"f47ac10b-58cc-5372-a56740e02b2c3d479", 0, Invalid, false},
{"f47ac10b-58cc-5372-a567-0e02-2c3d479", 0, Invalid, false},
{"g47ac10b-58cc-4372-a567-0e02b2c3d479", 0, Invalid, false},


{"{f47ac10b-58cc-0372-8567-0e02b2c3d479}", 0, RFC4122, true},
{"{f47ac10b-58cc-0372-8567-0e02b2c3d479", 0, Invalid, false},
{"f47ac10b-58cc-0372-8567-0e02b2c3d479}", 0, Invalid, false},
Expand Down Expand Up @@ -481,7 +479,7 @@ func TestBadRand(t *testing.T) {

func TestSetRand(t *testing.T) {
myString := "805-9dd6-1a877cb526c678e71d38-7122-44c0-9b7c-04e7001cc78783ac3e82-47a3-4cc3-9951-13f3339d88088f5d685a-11f7-4078-ada9-de44ad2daeb7"

SetRand(strings.NewReader(myString))
uuid1 := New()
uuid2 := New()
Expand Down
2 changes: 1 addition & 1 deletion version4.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func NewRandom() (UUID, error) {
return NewRandomFromReader(rander)
}

// NewRandomFromReader returns a UUID based on bytes read from a given io.Reader.
func NewRandomFromReader(r io.Reader) (UUID, error) {
var uuid UUID
_, err := io.ReadFull(r, uuid[:])
Expand All @@ -40,4 +41,3 @@ func NewRandomFromReader(r io.Reader) (UUID, error) {
uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10
return uuid, nil
}

0 comments on commit bd45158

Please sign in to comment.