Apply gofmt -s

This commit is contained in:
Bjørn Erik Pedersen 2016-02-06 12:29:13 +01:00
parent eebf00f702
commit 318a984526
6 changed files with 7 additions and 9 deletions

View file

@ -426,7 +426,7 @@ func TruncateWordsByRune(words []string, max int) (string, bool) {
} else if count+runeCount < max { } else if count+runeCount < max {
count += runeCount count += runeCount
} else { } else {
for ri, _ := range word { for ri := range word {
if count >= max { if count >= max {
truncatedWords := append(words[:index], word[:ri]) truncatedWords := append(words[:index], word[:ri])
return strings.Join(truncatedWords, " "), true return strings.Join(truncatedWords, " "), true

View file

@ -69,7 +69,6 @@ func TestParseDefaultPygmentsArgs(t *testing.T) {
{"", nil, nil, "style=foo,noclasses=false"}, {"", nil, nil, "style=foo,noclasses=false"},
{"style=foo,noclasses=false", nil, nil, "style=override,noclasses=override"}, {"style=foo,noclasses=false", nil, nil, "style=override,noclasses=override"},
{"style=foo,noclasses=false", "override", false, "style=override,noclasses=override"}, {"style=foo,noclasses=false", "override", false, "style=override,noclasses=override"},
} { } {
viper.Reset() viper.Reset()

View file

@ -66,7 +66,7 @@ func (c *pageCache) get(key string, p Pages, apply func(p Pages)) (Pages, bool)
if v, ok := c.m[key]; ok { if v, ok := c.m[key]; ok {
c.m[key] = append(v, [2]Pages{p, pagesCopy}) c.m[key] = append(v, [2]Pages{p, pagesCopy})
} else { } else {
c.m[key] = [][2]Pages{[2]Pages{p, pagesCopy}} c.m[key] = [][2]Pages{{p, pagesCopy}}
} }
return pagesCopy, false return pagesCopy, false

View file

@ -74,7 +74,7 @@ func (c *Scratch) GetSortedMapValues(key string) interface{} {
unsortedMap := c.values[key].(map[string]interface{}) unsortedMap := c.values[key].(map[string]interface{})
var keys []string var keys []string
for mapKey, _ := range unsortedMap { for mapKey := range unsortedMap {
keys = append(keys, mapKey) keys = append(keys, mapKey)
} }

View file

@ -20,12 +20,12 @@ import (
"fmt" "fmt"
"github.com/spf13/cast" "github.com/spf13/cast"
"html/template" "html/template"
"math/rand"
"path" "path"
"reflect" "reflect"
"runtime" "runtime"
"testing" "testing"
"time" "time"
"math/rand"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
@ -345,7 +345,7 @@ func TestAfter(t *testing.T) {
func TestShuffleInputAndOutputFormat(t *testing.T) { func TestShuffleInputAndOutputFormat(t *testing.T) {
for i, this := range []struct { for i, this := range []struct {
sequence interface{} sequence interface{}
success bool success bool
}{ }{
{[]string{"a", "b", "c", "d"}, true}, {[]string{"a", "b", "c", "d"}, true},
{[]int{100, 200, 300}, true}, {[]int{100, 200, 300}, true},
@ -406,7 +406,6 @@ func TestShuffleRandomising(t *testing.T) {
} }
} }
func TestDictionary(t *testing.T) { func TestDictionary(t *testing.T) {
for i, this := range []struct { for i, this := range []struct {
v1 []interface{} v1 []interface{}

View file

@ -270,7 +270,7 @@ func TestGetCSVFailParseSep(t *testing.T) {
url := ts.URL + "/test.csv" url := ts.URL + "/test.csv"
defer os.Remove(getCacheFileID(url)) 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) have := GetCSV(",", url)
assert.NotNil(t, have) assert.NotNil(t, have)
if have != nil { if have != nil {
@ -301,7 +301,7 @@ func TestGetCSVFailParse(t *testing.T) {
url := ts.URL + "/test.csv" url := ts.URL + "/test.csv"
defer os.Remove(getCacheFileID(url)) 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) have := GetCSV(",", url)
assert.NotNil(t, have) assert.NotNil(t, have)
if have != nil { if have != nil {