mirror of
https://github.com/google/uuid.git
synced 2024-11-24 08:32:23 +02:00
make 'go vet' happy
This commit is contained in:
parent
8c31c18f31
commit
1f1ba6fb7a
@ -10,9 +10,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestScan(t *testing.T) {
|
func TestScan(t *testing.T) {
|
||||||
var stringTest string = "f47ac10b-58cc-0372-8567-0e02b2c3d479"
|
stringTest := "f47ac10b-58cc-0372-8567-0e02b2c3d479"
|
||||||
var badTypeTest int = 6
|
badTypeTest := 6
|
||||||
var invalidTest string = "f47ac10b-58cc-0372-8567-0e02b2c3d4"
|
invalidTest := "f47ac10b-58cc-0372-8567-0e02b2c3d4"
|
||||||
|
|
||||||
byteTest := make([]byte, 16)
|
byteTest := make([]byte, 16)
|
||||||
byteTestUUID := Must(Parse(stringTest))
|
byteTestUUID := Must(Parse(stringTest))
|
||||||
|
6
time.go
6
time.go
@ -86,7 +86,7 @@ func clockSequence() int {
|
|||||||
return int(clockSeq & 0x3fff)
|
return int(clockSeq & 0x3fff)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetClockSeq sets the clock sequence to the lower 14 bits of seq. Setting to
|
// SetClockSequence sets the clock sequence to the lower 14 bits of seq. Setting to
|
||||||
// -1 causes a new sequence to be generated.
|
// -1 causes a new sequence to be generated.
|
||||||
func SetClockSequence(seq int) {
|
func SetClockSequence(seq int) {
|
||||||
defer timeMu.Unlock()
|
defer timeMu.Unlock()
|
||||||
@ -100,9 +100,9 @@ func setClockSequence(seq int) {
|
|||||||
randomBits(b[:]) // clock sequence
|
randomBits(b[:]) // clock sequence
|
||||||
seq = int(b[0])<<8 | int(b[1])
|
seq = int(b[0])<<8 | int(b[1])
|
||||||
}
|
}
|
||||||
old_seq := clockSeq
|
oldSeq := clockSeq
|
||||||
clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant
|
clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant
|
||||||
if old_seq != clockSeq {
|
if oldSeq != clockSeq {
|
||||||
lasttime = 0
|
lasttime = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
uuid.go
12
uuid.go
@ -58,11 +58,11 @@ func Parse(s string) (UUID, error) {
|
|||||||
14, 16,
|
14, 16,
|
||||||
19, 21,
|
19, 21,
|
||||||
24, 26, 28, 30, 32, 34} {
|
24, 26, 28, 30, 32, 34} {
|
||||||
if v, ok := xtob(s[x], s[x+1]); !ok {
|
v, ok := xtob(s[x], s[x+1])
|
||||||
|
if !ok {
|
||||||
return uuid, errors.New("invalid UUID format")
|
return uuid, errors.New("invalid UUID format")
|
||||||
} else {
|
|
||||||
uuid[i] = v
|
|
||||||
}
|
}
|
||||||
|
uuid[i] = v
|
||||||
}
|
}
|
||||||
return uuid, nil
|
return uuid, nil
|
||||||
}
|
}
|
||||||
@ -88,11 +88,11 @@ func ParseBytes(b []byte) (UUID, error) {
|
|||||||
14, 16,
|
14, 16,
|
||||||
19, 21,
|
19, 21,
|
||||||
24, 26, 28, 30, 32, 34} {
|
24, 26, 28, 30, 32, 34} {
|
||||||
if v, ok := xtob(b[x], b[x+1]); !ok {
|
v, ok := xtob(b[x], b[x+1])
|
||||||
|
if !ok {
|
||||||
return uuid, errors.New("invalid UUID format")
|
return uuid, errors.New("invalid UUID format")
|
||||||
} else {
|
|
||||||
uuid[i] = v
|
|
||||||
}
|
}
|
||||||
|
uuid[i] = v
|
||||||
}
|
}
|
||||||
return uuid, nil
|
return uuid, nil
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ func TestDCE(t *testing.T) {
|
|||||||
type badRand struct{}
|
type badRand struct{}
|
||||||
|
|
||||||
func (r badRand) Read(buf []byte) (int, error) {
|
func (r badRand) Read(buf []byte) (int, error) {
|
||||||
for i, _ := range buf {
|
for i := range buf {
|
||||||
buf[i] = byte(i)
|
buf[i] = byte(i)
|
||||||
}
|
}
|
||||||
return len(buf), nil
|
return len(buf), nil
|
||||||
|
Loading…
Reference in New Issue
Block a user