Permalink
Browse files

all: Fix some govet complaints

  • Loading branch information...
bogem authored and bep committed Mar 9, 2017
1 parent 560ed6e commit 48120ccfd2138ff2b308081cd7cb9cee033db691
Showing with 12 additions and 15 deletions.
  1. +4 −4 commands/convert.go
  2. +0 −4 config/configProvider.go
  3. +1 −1 deps/deps.go
  4. +1 −1 hugofs/fs.go
  5. +0 −1 hugolib/hugo_sites.go
  6. +2 −2 hugolib/page.go
  7. +1 −1 hugolib/page_test.go
  8. +0 −1 hugolib/site.go
  9. +3 −0 tpl/tplimpl/template.go
View
@@ -123,14 +123,14 @@ func convertContents(mark rune) error {
// 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()))
View
@@ -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.
View
@@ -45,7 +45,7 @@ type Deps struct {
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
View
@@ -44,7 +44,7 @@ func NewDefault(cfg config.Provider) *Fs {
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 {
View
@@ -302,7 +302,6 @@ func (h *HugoSites) createMissingPages() error {
var newPages Pages
for _, s := range h.Sites {
if s.isEnabled(KindHome) {
// home pages
home := s.findPagesByKind(KindHome)
View
@@ -254,8 +254,8 @@ type Position struct {
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 {
View
@@ -1361,7 +1361,7 @@ func TestPageParams(t *testing.T) {
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)
}
}
View
@@ -546,7 +546,6 @@ type whatChanged struct {
// 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")
View
@@ -452,18 +452,21 @@ func (t *GoHTMLTemplate) loadTemplates(absPath string, prefix string) {
if err != nil {
return nil
}
t.Log.DEBUG.Println("Template path", path)
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
link, err := filepath.EvalSymlinks(absPath)
if err != nil {
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)
}

0 comments on commit 48120cc

Please sign in to comment.