diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-02-21 09:23:43 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-02-21 09:59:33 +0100 |
commit | 772128485a7e94932cd18b5e3a78d8cfb273e797 (patch) | |
tree | 1d0f54b218927859cabd5bc62f32e94668450f10 | |
parent | c2c4cb1f9f9ea9f05a9c9cf7123a17660208cad4 (diff) |
Run gofmt -s with Go 1.10
See #4434
-rw-r--r-- | commands/server.go | 2 | ||||
-rw-r--r-- | helpers/path_test.go | 8 | ||||
-rw-r--r-- | helpers/processing_stats.go | 16 | ||||
-rw-r--r-- | hugolib/hugo_sites.go | 2 | ||||
-rw-r--r-- | magefile.go | 6 | ||||
-rw-r--r-- | resource/image_cache.go | 2 | ||||
-rw-r--r-- | resource/image_test.go | 2 | ||||
-rw-r--r-- | resource/resource.go | 2 | ||||
-rw-r--r-- | resource/resource_test.go | 34 |
9 files changed, 37 insertions, 37 deletions
diff --git a/commands/server.go b/commands/server.go index be93489d4..130ac18be 100644 --- a/commands/server.go +++ b/commands/server.go @@ -359,7 +359,7 @@ func (c *commandeer) serve() error { var sigs = make(chan os.Signal) signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) - for i, _ := range baseURLs { + for i := range baseURLs { mu, serverURL, endpoint, err := srv.createEndpoint(i) if doLiveReload { diff --git a/helpers/path_test.go b/helpers/path_test.go index bb5125034..d2c577dae 100644 --- a/helpers/path_test.go +++ b/helpers/path_test.go @@ -670,10 +670,10 @@ func TestFindCWD(t *testing.T) { //cwd, _ := os.Getwd() data := []test{ - //{cwd, nil}, - // Commenting this out. It doesn't work properly. - // There's a good reason why we don't use os.Getwd(), it doesn't actually work the way we want it to. - // I really don't know a better way to test this function. - SPF 2014.11.04 + //{cwd, nil}, + // Commenting this out. It doesn't work properly. + // There's a good reason why we don't use os.Getwd(), it doesn't actually work the way we want it to. + // I really don't know a better way to test this function. - SPF 2014.11.04 } for i, d := range data { dir, err := FindCWD() diff --git a/helpers/processing_stats.go b/helpers/processing_stats.go index 36dfcda69..2d7fcb4de 100644 --- a/helpers/processing_stats.go +++ b/helpers/processing_stats.go @@ -41,14 +41,14 @@ type processingStatsTitleVal struct { func (s *ProcessingStats) toVals() []processingStatsTitleVal { return []processingStatsTitleVal{ - processingStatsTitleVal{"Pages", s.Pages}, - processingStatsTitleVal{"Paginator pages", s.PaginatorPages}, - processingStatsTitleVal{"Non-page files", s.Files}, - processingStatsTitleVal{"Static files", s.Static}, - processingStatsTitleVal{"Processed images", s.ProcessedImages}, - processingStatsTitleVal{"Aliases", s.Aliases}, - processingStatsTitleVal{"Sitemaps", s.Sitemaps}, - processingStatsTitleVal{"Cleaned", s.Cleaned}, + {"Pages", s.Pages}, + {"Paginator pages", s.PaginatorPages}, + {"Non-page files", s.Files}, + {"Static files", s.Static}, + {"Processed images", s.ProcessedImages}, + {"Aliases", s.Aliases}, + {"Sitemaps", s.Sitemaps}, + {"Cleaned", s.Cleaned}, } } diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go index e6000e06d..6c2a5c153 100644 --- a/hugolib/hugo_sites.go +++ b/hugolib/hugo_sites.go @@ -739,7 +739,7 @@ func (m *contentChangeMap) GetSymbolicLinkMappings(dir string) []string { } dirs := make([]string, len(mm)) i := 0 - for dir, _ := range mm { + for dir := range mm { dirs[i] = dir i++ } diff --git a/magefile.go b/magefile.go index 8ab594a02..883f96620 100644 --- a/magefile.go +++ b/magefile.go @@ -122,7 +122,7 @@ func TestRace() error { // Run gofmt linter func Fmt() error { - if isGoTip() { + if !isGoLatest() { return nil } pkgs, err := hugoPackages() @@ -258,6 +258,6 @@ func CheckVendor() error { return nil } -func isGoTip() bool { - return strings.Contains(runtime.Version(), "devel") || strings.Contains(runtime.Version(), "1.10") +func isGoLatest() bool { + return strings.Contains(runtime.Version(), "1.10") } diff --git a/resource/image_cache.go b/resource/image_cache.go index 250155db1..a1d41ec38 100644 --- a/resource/image_cache.go +++ b/resource/image_cache.go @@ -42,7 +42,7 @@ func (c *imageCache) isInCache(key string) bool { func (c *imageCache) deleteByPrefix(prefix string) { c.mu.Lock() defer c.mu.Unlock() - for k, _ := range c.store { + for k := range c.store { if strings.HasPrefix(k, prefix) { delete(c.store, k) } diff --git a/resource/image_test.go b/resource/image_test.go index 1a937d56b..03cd1726f 100644 --- a/resource/image_test.go +++ b/resource/image_test.go @@ -244,7 +244,7 @@ func TestImageWithMetadata(t *testing.T) { image := fetchSunset(assert) var meta = []map[string]interface{}{ - map[string]interface{}{ + { "title": "My Sunset", "name": "Sunset #:counter", "src": "*.jpg", diff --git a/resource/resource.go b/resource/resource.go index 66fda4c1b..67aed39c2 100644 --- a/resource/resource.go +++ b/resource/resource.go @@ -332,7 +332,7 @@ func (r *Spec) CacheStats() string { s := fmt.Sprintf("Cache entries: %d", len(r.imageCache.store)) count := 0 - for k, _ := range r.imageCache.store { + for k := range r.imageCache.store { if count > 5 { break } diff --git a/resource/resource_test.go b/resource/resource_test.go index 1ff979846..f4c652d43 100644 --- a/resource/resource_test.go +++ b/resource/resource_test.go @@ -198,7 +198,7 @@ func TestAssignMetadata(t *testing.T) { assertFunc func(err error) }{ {[]map[string]interface{}{ - map[string]interface{}{ + { "title": "My Resource", "name": "My Name", "src": "*", @@ -210,11 +210,11 @@ func TestAssignMetadata(t *testing.T) { }}, {[]map[string]interface{}{ - map[string]interface{}{ + { "title": "My Logo", "src": "*loGo*", }, - map[string]interface{}{ + { "title": "My Resource", "name": "My Name", "src": "*", @@ -229,7 +229,7 @@ func TestAssignMetadata(t *testing.T) { }}, {[]map[string]interface{}{ - map[string]interface{}{ + { "title": "My Logo", "src": "*loGo*", "params": map[string]interface{}{ @@ -237,7 +237,7 @@ func TestAssignMetadata(t *testing.T) { "icon": "logo", }, }, - map[string]interface{}{ + { "title": "My Resource", "src": "*", "params": map[string]interface{}{ @@ -269,11 +269,11 @@ func TestAssignMetadata(t *testing.T) { }}, {[]map[string]interface{}{ - map[string]interface{}{ + { "name": "Logo Name #:counter", "src": "*logo*", }, - map[string]interface{}{ + { "title": "Resource #:counter", "name": "Name #:counter", "src": "*", @@ -293,11 +293,11 @@ func TestAssignMetadata(t *testing.T) { }}, {[]map[string]interface{}{ - map[string]interface{}{ + { "title": "Third Logo #:counter", "src": "logo3.png", }, - map[string]interface{}{ + { "title": "Other Logo #:counter", "name": "Name #:counter", "src": "logo*", @@ -313,11 +313,11 @@ func TestAssignMetadata(t *testing.T) { }}, {[]map[string]interface{}{ - map[string]interface{}{ + { "title": "Third Logo", "src": "logo3.png", }, - map[string]interface{}{ + { "title": "Other Logo #:counter", "name": "Name #:counter", "src": "logo*", @@ -333,11 +333,11 @@ func TestAssignMetadata(t *testing.T) { }}, {[]map[string]interface{}{ - map[string]interface{}{ + { "name": "third-logo", "src": "logo3.png", }, - map[string]interface{}{ + { "title": "Logo #:counter", "name": "Name #:counter", "src": "logo*", @@ -353,7 +353,7 @@ func TestAssignMetadata(t *testing.T) { }}, {[]map[string]interface{}{ - map[string]interface{}{ + { "title": "Third Logo #:counter", }, }, func(err error) { @@ -362,7 +362,7 @@ func TestAssignMetadata(t *testing.T) { }}, {[]map[string]interface{}{ - map[string]interface{}{ + { "title": "Title", "src": "[]", }, @@ -469,12 +469,12 @@ func BenchmarkAssignMetadata(b *testing.B) { b.StopTimer() var resources Resources var meta = []map[string]interface{}{ - map[string]interface{}{ + { "title": "Foo #:counter", "name": "Foo Name #:counter", "src": "foo1*", }, - map[string]interface{}{ + { "title": "Rest #:counter", "name": "Rest Name #:counter", "src": "*", |