Run gofmt -s with Go 1.10

See #4434
This commit is contained in:
Bjørn Erik Pedersen 2018-02-21 09:23:43 +01:00
parent c2c4cb1f9f
commit 772128485a
9 changed files with 37 additions and 37 deletions

View file

@ -359,7 +359,7 @@ func (c *commandeer) serve() error {
var sigs = make(chan os.Signal) var sigs = make(chan os.Signal)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
for i, _ := range baseURLs { for i := range baseURLs {
mu, serverURL, endpoint, err := srv.createEndpoint(i) mu, serverURL, endpoint, err := srv.createEndpoint(i)
if doLiveReload { if doLiveReload {

View file

@ -41,14 +41,14 @@ type processingStatsTitleVal struct {
func (s *ProcessingStats) toVals() []processingStatsTitleVal { func (s *ProcessingStats) toVals() []processingStatsTitleVal {
return []processingStatsTitleVal{ return []processingStatsTitleVal{
processingStatsTitleVal{"Pages", s.Pages}, {"Pages", s.Pages},
processingStatsTitleVal{"Paginator pages", s.PaginatorPages}, {"Paginator pages", s.PaginatorPages},
processingStatsTitleVal{"Non-page files", s.Files}, {"Non-page files", s.Files},
processingStatsTitleVal{"Static files", s.Static}, {"Static files", s.Static},
processingStatsTitleVal{"Processed images", s.ProcessedImages}, {"Processed images", s.ProcessedImages},
processingStatsTitleVal{"Aliases", s.Aliases}, {"Aliases", s.Aliases},
processingStatsTitleVal{"Sitemaps", s.Sitemaps}, {"Sitemaps", s.Sitemaps},
processingStatsTitleVal{"Cleaned", s.Cleaned}, {"Cleaned", s.Cleaned},
} }
} }

View file

@ -739,7 +739,7 @@ func (m *contentChangeMap) GetSymbolicLinkMappings(dir string) []string {
} }
dirs := make([]string, len(mm)) dirs := make([]string, len(mm))
i := 0 i := 0
for dir, _ := range mm { for dir := range mm {
dirs[i] = dir dirs[i] = dir
i++ i++
} }

View file

@ -122,7 +122,7 @@ func TestRace() error {
// Run gofmt linter // Run gofmt linter
func Fmt() error { func Fmt() error {
if isGoTip() { if !isGoLatest() {
return nil return nil
} }
pkgs, err := hugoPackages() pkgs, err := hugoPackages()
@ -258,6 +258,6 @@ func CheckVendor() error {
return nil return nil
} }
func isGoTip() bool { func isGoLatest() bool {
return strings.Contains(runtime.Version(), "devel") || strings.Contains(runtime.Version(), "1.10") return strings.Contains(runtime.Version(), "1.10")
} }

View file

@ -42,7 +42,7 @@ func (c *imageCache) isInCache(key string) bool {
func (c *imageCache) deleteByPrefix(prefix string) { func (c *imageCache) deleteByPrefix(prefix string) {
c.mu.Lock() c.mu.Lock()
defer c.mu.Unlock() defer c.mu.Unlock()
for k, _ := range c.store { for k := range c.store {
if strings.HasPrefix(k, prefix) { if strings.HasPrefix(k, prefix) {
delete(c.store, k) delete(c.store, k)
} }

View file

@ -244,7 +244,7 @@ func TestImageWithMetadata(t *testing.T) {
image := fetchSunset(assert) image := fetchSunset(assert)
var meta = []map[string]interface{}{ var meta = []map[string]interface{}{
map[string]interface{}{ {
"title": "My Sunset", "title": "My Sunset",
"name": "Sunset #:counter", "name": "Sunset #:counter",
"src": "*.jpg", "src": "*.jpg",

View file

@ -332,7 +332,7 @@ func (r *Spec) CacheStats() string {
s := fmt.Sprintf("Cache entries: %d", len(r.imageCache.store)) s := fmt.Sprintf("Cache entries: %d", len(r.imageCache.store))
count := 0 count := 0
for k, _ := range r.imageCache.store { for k := range r.imageCache.store {
if count > 5 { if count > 5 {
break break
} }

View file

@ -198,7 +198,7 @@ func TestAssignMetadata(t *testing.T) {
assertFunc func(err error) assertFunc func(err error)
}{ }{
{[]map[string]interface{}{ {[]map[string]interface{}{
map[string]interface{}{ {
"title": "My Resource", "title": "My Resource",
"name": "My Name", "name": "My Name",
"src": "*", "src": "*",
@ -210,11 +210,11 @@ func TestAssignMetadata(t *testing.T) {
}}, }},
{[]map[string]interface{}{ {[]map[string]interface{}{
map[string]interface{}{ {
"title": "My Logo", "title": "My Logo",
"src": "*loGo*", "src": "*loGo*",
}, },
map[string]interface{}{ {
"title": "My Resource", "title": "My Resource",
"name": "My Name", "name": "My Name",
"src": "*", "src": "*",
@ -229,7 +229,7 @@ func TestAssignMetadata(t *testing.T) {
}}, }},
{[]map[string]interface{}{ {[]map[string]interface{}{
map[string]interface{}{ {
"title": "My Logo", "title": "My Logo",
"src": "*loGo*", "src": "*loGo*",
"params": map[string]interface{}{ "params": map[string]interface{}{
@ -237,7 +237,7 @@ func TestAssignMetadata(t *testing.T) {
"icon": "logo", "icon": "logo",
}, },
}, },
map[string]interface{}{ {
"title": "My Resource", "title": "My Resource",
"src": "*", "src": "*",
"params": map[string]interface{}{ "params": map[string]interface{}{
@ -269,11 +269,11 @@ func TestAssignMetadata(t *testing.T) {
}}, }},
{[]map[string]interface{}{ {[]map[string]interface{}{
map[string]interface{}{ {
"name": "Logo Name #:counter", "name": "Logo Name #:counter",
"src": "*logo*", "src": "*logo*",
}, },
map[string]interface{}{ {
"title": "Resource #:counter", "title": "Resource #:counter",
"name": "Name #:counter", "name": "Name #:counter",
"src": "*", "src": "*",
@ -293,11 +293,11 @@ func TestAssignMetadata(t *testing.T) {
}}, }},
{[]map[string]interface{}{ {[]map[string]interface{}{
map[string]interface{}{ {
"title": "Third Logo #:counter", "title": "Third Logo #:counter",
"src": "logo3.png", "src": "logo3.png",
}, },
map[string]interface{}{ {
"title": "Other Logo #:counter", "title": "Other Logo #:counter",
"name": "Name #:counter", "name": "Name #:counter",
"src": "logo*", "src": "logo*",
@ -313,11 +313,11 @@ func TestAssignMetadata(t *testing.T) {
}}, }},
{[]map[string]interface{}{ {[]map[string]interface{}{
map[string]interface{}{ {
"title": "Third Logo", "title": "Third Logo",
"src": "logo3.png", "src": "logo3.png",
}, },
map[string]interface{}{ {
"title": "Other Logo #:counter", "title": "Other Logo #:counter",
"name": "Name #:counter", "name": "Name #:counter",
"src": "logo*", "src": "logo*",
@ -333,11 +333,11 @@ func TestAssignMetadata(t *testing.T) {
}}, }},
{[]map[string]interface{}{ {[]map[string]interface{}{
map[string]interface{}{ {
"name": "third-logo", "name": "third-logo",
"src": "logo3.png", "src": "logo3.png",
}, },
map[string]interface{}{ {
"title": "Logo #:counter", "title": "Logo #:counter",
"name": "Name #:counter", "name": "Name #:counter",
"src": "logo*", "src": "logo*",
@ -353,7 +353,7 @@ func TestAssignMetadata(t *testing.T) {
}}, }},
{[]map[string]interface{}{ {[]map[string]interface{}{
map[string]interface{}{ {
"title": "Third Logo #:counter", "title": "Third Logo #:counter",
}, },
}, func(err error) { }, func(err error) {
@ -362,7 +362,7 @@ func TestAssignMetadata(t *testing.T) {
}}, }},
{[]map[string]interface{}{ {[]map[string]interface{}{
map[string]interface{}{ {
"title": "Title", "title": "Title",
"src": "[]", "src": "[]",
}, },
@ -469,12 +469,12 @@ func BenchmarkAssignMetadata(b *testing.B) {
b.StopTimer() b.StopTimer()
var resources Resources var resources Resources
var meta = []map[string]interface{}{ var meta = []map[string]interface{}{
map[string]interface{}{ {
"title": "Foo #:counter", "title": "Foo #:counter",
"name": "Foo Name #:counter", "name": "Foo Name #:counter",
"src": "foo1*", "src": "foo1*",
}, },
map[string]interface{}{ {
"title": "Rest #:counter", "title": "Rest #:counter",
"name": "Rest Name #:counter", "name": "Rest Name #:counter",
"src": "*", "src": "*",