Pass battery of linting/vetting

including:

- gofmt -s to simplify some code
- Properly capture range variable (go vet)
- Update doc comments (fix golint errors)
This commit is contained in:
sm
2017-04-30 19:45:06 -07:00
parent f73e2280ec
commit 6b566c2c3a
3 changed files with 50 additions and 44 deletions
+12 -12
View File
@@ -108,11 +108,11 @@ func TestCacheTimes(t *testing.T) {
func TestNewFrom(t *testing.T) {
m := map[string]Item{
"a": Item{
"a": {
Object: 1,
Expiration: 0,
},
"b": Item{
"b": {
Object: 2,
Expiration: 0,
},
@@ -1302,14 +1302,14 @@ func testFillAndSerialize(t *testing.T, tc *Cache) {
{Num: 3},
}, DefaultExpiration)
tc.Set("[]*struct", []*TestStruct{
&TestStruct{Num: 4},
&TestStruct{Num: 5},
{Num: 4},
{Num: 5},
}, DefaultExpiration)
tc.Set("structception", &TestStruct{
Num: 42,
Children: []*TestStruct{
&TestStruct{Num: 6174},
&TestStruct{Num: 4716},
{Num: 6174},
{Num: 4716},
},
}, DefaultExpiration)
@@ -1644,12 +1644,12 @@ func benchmarkCacheGetManyConcurrent(b *testing.B, exp time.Duration) {
wg := new(sync.WaitGroup)
wg.Add(n)
for _, v := range keys {
go func() {
go func(key string) {
for j := 0; j < each; j++ {
tc.Get(v)
tc.Get(key)
}
wg.Done()
}()
}(v)
}
b.StartTimer()
wg.Wait()
@@ -1680,12 +1680,12 @@ func benchmarkCacheWithLRUGetManyConcurrent(b *testing.B, exp time.Duration, max
wg := new(sync.WaitGroup)
wg.Add(n)
for _, v := range keys {
go func() {
go func(key string) {
for j := 0; j < each; j++ {
tc.Get(v)
tc.Get(key)
}
wg.Done()
}()
}(v)
}
b.StartTimer()
wg.Wait()