shithub: hugo

Download patch

ref: c577a9ed2347559783c44232e1f08414008c5203
parent: a93cbb0d6cc6e3a78ba34aa372abc5b41ca24b2c
author: Christian Muehlhaeuser <muesli@gmail.com>
date: Fri Aug 2 11:28:43 EDT 2019

Fixed ineffectual assignments

Dropped/fixed ineffectual assignments after static code analysis.

--- a/hugofs/nosymlink_test.go
+++ b/hugofs/nosymlink_test.go
@@ -102,9 +102,9 @@
 					return fi, err
 				},
 			} {
-				fi, err := stat(symlinkedDir)
+				_, err := stat(symlinkedDir)
 				assert.Equal(ErrPermissionSymlink, err)
-				fi, err = stat(symlinkedFile)
+				fi, err := stat(symlinkedFile)
 				assertFileStat(symlinkedFilename, fi, err)
 
 				fi, err = stat(filepath.Join(workDir, "blog"))
--- a/hugolib/config.go
+++ b/hugolib/config.go
@@ -256,8 +256,7 @@
 	}
 
 	var filename string
-	fileExt := helpers.ExtNoDelimiter(configName)
-	if fileExt != "" {
+	if helpers.ExtNoDelimiter(configName) != "" {
 		exists, _ := helpers.Exists(baseFilename, l.Fs)
 		if exists {
 			filename = baseFilename
@@ -268,7 +267,6 @@
 			exists, _ := helpers.Exists(filenameToCheck, l.Fs)
 			if exists {
 				filename = filenameToCheck
-				fileExt = ext
 				break
 			}
 		}
--- a/hugolib/hugo_sites_build_test.go
+++ b/hugolib/hugo_sites_build_test.go
@@ -1204,12 +1204,15 @@
 			end++
 		}
 
-		root := filepath.Join(parts[start:end]...)
-		if hadSlash {
-			root = helpers.FilePathSeparator + root
-		}
+		/*
+			root := filepath.Join(parts[start:end]...)
+			if hadSlash {
+				root = helpers.FilePathSeparator + root
+			}
 
-		//helpers.PrintFs(fs, root, os.Stdout)
+			helpers.PrintFs(fs, root, os.Stdout)
+		*/
+
 		t.Fatalf("Failed to read file: %s", err)
 	}
 	return string(b)
--- a/output/outputFormat_test.go
+++ b/output/outputFormat_test.go
@@ -118,7 +118,7 @@
 	f, found := formats.FromFilename("my.amp.html")
 	require.True(t, found)
 	require.Equal(t, AMPFormat, f)
-	f, found = formats.FromFilename("my.ics")
+	_, found = formats.FromFilename("my.ics")
 	require.True(t, found)
 	f, found = formats.FromFilename("my.html")
 	require.True(t, found)
--- a/tpl/collections/collections.go
+++ b/tpl/collections/collections.go
@@ -98,8 +98,9 @@
 		dStr, err := cast.ToStringE(l)
 		if err != nil {
 			dLast = nil
+		} else {
+			dLast = &dStr
 		}
-		dLast = &dStr
 	}
 
 	seqv := reflect.ValueOf(seq)