ref: 48120ccfd2138ff2b308081cd7cb9cee033db691
parent: 560ed6e686f19c58dc98af9f47bb35c81f4d7979
author: Albert Nigmatzianov <albertnigma@gmail.com>
date: Thu Mar 9 13:18:12 EST 2017
all: Fix some govet complaints
--- a/commands/convert.go
+++ b/commands/convert.go
@@ -123,14 +123,14 @@
// better handling of dates in formats that don't have support for them
if mark == parser.FormatToLeadRune("json") || mark == parser.FormatToLeadRune("yaml") || mark == parser.FormatToLeadRune("toml") {
- newmetadata := cast.ToStringMap(metadata)
- for k, v := range newmetadata {
+ newMetadata := cast.ToStringMap(metadata)
+ for k, v := range newMetadata {
switch vv := v.(type) {
case time.Time:
- newmetadata[k] = vv.Format(time.RFC3339)
+ newMetadata[k] = vv.Format(time.RFC3339)
}
}
- metadata = newmetadata
+ metadata = newMetadata
}
page.SetDir(filepath.Join(contentDir, file.Dir()))
--- a/config/configProvider.go
+++ b/config/configProvider.go
@@ -11,10 +11,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// Package helpers implements general utility functions that work with
-// and on content. The helper functions defined here lay down the
-// foundation of how Hugo works with files and filepaths, and perform
-// string operations on content.
package config
// Provider provides the configuration settings for Hugo.
--- a/deps/deps.go
+++ b/deps/deps.go
@@ -45,7 +45,7 @@
translationProvider ResourceProvider
}
-// Used to create and refresh, and clone resources needed.
+// ResourceProvider is used to create and refresh, and clone resources needed.
type ResourceProvider interface {
Update(deps *Deps) error
Clone(deps *Deps) error
--- a/hugofs/fs.go
+++ b/hugofs/fs.go
@@ -44,7 +44,7 @@
return newFs(fs, cfg)
}
-// NewDefault creates a new Fs with the MemMapFs
+// NewMem creates a new Fs with the MemMapFs
// as source and destination file systems.
// Useful for testing.
func NewMem(cfg config.Provider) *Fs {
--- a/hugolib/hugo_sites.go
+++ b/hugolib/hugo_sites.go
@@ -302,7 +302,6 @@
var newPages Pages
for _, s := range h.Sites {
-
if s.isEnabled(KindHome) {
// home pages
home := s.findPagesByKind(KindHome)
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -254,8 +254,8 @@
type Pages []*Page
-func (p Pages) String() string {
- return fmt.Sprintf("Pages(%d)", len(p))
+func (ps Pages) String() string {
+ return fmt.Sprintf("Pages(%d)", len(ps))
}
func (ps Pages) FindPagePosByFilePath(inPath string) int {
--- a/hugolib/page_test.go
+++ b/hugolib/page_test.go
@@ -1361,7 +1361,7 @@
for i, c := range pagesParamsTemplate {
p, err := s.NewPageFrom(strings.NewReader(c), "content/post/params.md")
require.NoError(t, err, "err during parse", "#%d", i)
- for key, _ := range wantedMap {
+ for key := range wantedMap {
assert.Equal(t, wantedMap[key], p.Params[key], "#%d", key)
}
}
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -546,7 +546,6 @@
// reBuild partially rebuilds a site given the filesystem events.
// It returns whetever the content source was changed.
func (s *Site) reProcess(events []fsnotify.Event) (whatChanged, error) {
-
s.Log.DEBUG.Printf("Rebuild for events %q", events)
s.timerStep("initialize rebuild")
--- a/tpl/tplimpl/template.go
+++ b/tpl/tplimpl/template.go
@@ -452,6 +452,7 @@
if err != nil {
return nil
}
+
t.Log.DEBUG.Println("Template path", path)
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
link, err := filepath.EvalSymlinks(absPath)
@@ -459,11 +460,13 @@
t.Log.ERROR.Printf("Cannot read symbolic link '%s', error was: %s", absPath, err)
return nil
}
+
linkfi, err := t.Fs.Source.Stat(link)
if err != nil {
t.Log.ERROR.Printf("Cannot stat '%s', error was: %s", link, err)
return nil
}
+
if !linkfi.Mode().IsRegular() {
t.Log.ERROR.Printf("Symbolic links for directories not supported, skipping '%s'", absPath)
}
--
⑨