shithub: hugo

Download patch

ref: 6027ee11082d0b9d72de1d4d1980a702be294ad2
parent: c577a9ed2347559783c44232e1f08414008c5203
author: Christian Muehlhaeuser <[email protected]>
date: Fri Aug 2 11:32:23 EDT 2019

Avoid unnecessary conversions

No need to convert these types.

--- a/parser/pageparser/pagelexer.go
+++ b/parser/pageparser/pagelexer.go
@@ -117,7 +117,7 @@
 )
 
 func (l *pageLexer) next() rune {
-	if int(l.pos) >= len(l.input) {
+	if l.pos >= len(l.input) {
 		l.width = 0
 		return eof
 	}
--- a/resources/page/permalinks.go
+++ b/resources/page/permalinks.go
@@ -188,7 +188,7 @@
 }
 
 func (pee *permalinkExpandError) Error() string {
-	return fmt.Sprintf("error expanding %q: %s", string(pee.pattern), pee.err)
+	return fmt.Sprintf("error expanding %q: %s", pee.pattern, pee.err)
 }
 
 var (
--- a/tpl/images/images_test.go
+++ b/tpl/images/images_test.go
@@ -93,7 +93,7 @@
 
 		// check for expected errors early to avoid writing files
 		if b, ok := test.expect.(bool); ok && !b {
-			_, err := ns.Config(interface{}(test.path))
+			_, err := ns.Config(test.path)
 			require.Error(t, err, errMsg)
 			continue
 		}