} else if count+runeCount < max {
count += runeCount
} else {
- for ri, _ := range word {
+ for ri := range word {
if count >= max {
truncatedWords := append(words[:index], word[:ri])
return strings.Join(truncatedWords, " "), true
{"", nil, nil, "style=foo,noclasses=false"},
{"style=foo,noclasses=false", nil, nil, "style=override,noclasses=override"},
{"style=foo,noclasses=false", "override", false, "style=override,noclasses=override"},
-
} {
viper.Reset()
if v, ok := c.m[key]; ok {
c.m[key] = append(v, [2]Pages{p, pagesCopy})
} else {
- c.m[key] = [][2]Pages{[2]Pages{p, pagesCopy}}
+ c.m[key] = [][2]Pages{{p, pagesCopy}}
}
return pagesCopy, false
unsortedMap := c.values[key].(map[string]interface{})
var keys []string
- for mapKey, _ := range unsortedMap {
+ for mapKey := range unsortedMap {
keys = append(keys, mapKey)
}
"fmt"
"github.com/spf13/cast"
"html/template"
+ "math/rand"
"path"
"reflect"
"runtime"
"testing"
"time"
- "math/rand"
"github.com/stretchr/testify/assert"
)
func TestShuffleInputAndOutputFormat(t *testing.T) {
for i, this := range []struct {
sequence interface{}
- success bool
+ success bool
}{
{[]string{"a", "b", "c", "d"}, true},
{[]int{100, 200, 300}, true},
}
}
-
func TestDictionary(t *testing.T) {
for i, this := range []struct {
v1 []interface{}
url := ts.URL + "/test.csv"
defer os.Remove(getCacheFileID(url))
- want := [][]string{[]string{"gomeetup", "city"}, []string{"yes", "Sydney"}, []string{"yes", "San Francisco"}, []string{"yes", "Stockholm"}}
+ want := [][]string{{"gomeetup", "city"}, {"yes", "Sydney"}, {"yes", "San Francisco"}, {"yes", "Stockholm"}}
have := GetCSV(",", url)
assert.NotNil(t, have)
if have != nil {
url := ts.URL + "/test.csv"
defer os.Remove(getCacheFileID(url))
- want := [][]string{[]string{"gomeetup", "city"}, []string{"yes", "Sydney"}, []string{"yes", "San Francisco"}, []string{"yes", "Stockholm"}}
+ want := [][]string{{"gomeetup", "city"}, {"yes", "Sydney"}, {"yes", "San Francisco"}, {"yes", "Stockholm"}}
have := GetCSV(",", url)
assert.NotNil(t, have)
if have != nil {