From 1f1ba6fb7a18af3513249fdbdeb6795a98855b68 Mon Sep 17 00:00:00 2001 From: Martin Lindhe Date: Wed, 22 Nov 2017 06:14:10 +0100 Subject: [PATCH] make 'go vet' happy --- sql_test.go | 6 +++--- time.go | 6 +++--- uuid.go | 12 ++++++------ uuid_test.go | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/sql_test.go b/sql_test.go index 4fbd01b..1803dfd 100644 --- a/sql_test.go +++ b/sql_test.go @@ -10,9 +10,9 @@ import ( ) func TestScan(t *testing.T) { - var stringTest string = "f47ac10b-58cc-0372-8567-0e02b2c3d479" - var badTypeTest int = 6 - var invalidTest string = "f47ac10b-58cc-0372-8567-0e02b2c3d4" + stringTest := "f47ac10b-58cc-0372-8567-0e02b2c3d479" + badTypeTest := 6 + invalidTest := "f47ac10b-58cc-0372-8567-0e02b2c3d4" byteTest := make([]byte, 16) byteTestUUID := Must(Parse(stringTest)) diff --git a/time.go b/time.go index fd7fe0a..e6ef06c 100644 --- a/time.go +++ b/time.go @@ -86,7 +86,7 @@ func clockSequence() int { 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. func SetClockSequence(seq int) { defer timeMu.Unlock() @@ -100,9 +100,9 @@ func setClockSequence(seq int) { randomBits(b[:]) // clock sequence seq = int(b[0])<<8 | int(b[1]) } - old_seq := clockSeq + oldSeq := clockSeq clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant - if old_seq != clockSeq { + if oldSeq != clockSeq { lasttime = 0 } } diff --git a/uuid.go b/uuid.go index 1320d60..7f3643f 100644 --- a/uuid.go +++ b/uuid.go @@ -58,11 +58,11 @@ func Parse(s string) (UUID, error) { 14, 16, 19, 21, 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") - } else { - uuid[i] = v } + uuid[i] = v } return uuid, nil } @@ -88,11 +88,11 @@ func ParseBytes(b []byte) (UUID, error) { 14, 16, 19, 21, 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") - } else { - uuid[i] = v } + uuid[i] = v } return uuid, nil } diff --git a/uuid_test.go b/uuid_test.go index 3ecd8c2..407a9b1 100644 --- a/uuid_test.go +++ b/uuid_test.go @@ -443,7 +443,7 @@ func TestDCE(t *testing.T) { type badRand struct{} func (r badRand) Read(buf []byte) (int, error) { - for i, _ := range buf { + for i := range buf { buf[i] = byte(i) } return len(buf), nil