Avoid unnecessary conversions
authorChristian Muehlhaeuser <muesli@gmail.com>
Fri, 2 Aug 2019 15:32:23 +0000 (15:32 +0000)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 10 Aug 2019 18:12:38 +0000 (20:12 +0200)
No need to convert these types.

parser/pageparser/pagelexer.go
resources/page/permalinks.go
tpl/images/images_test.go

index d010c8152016da3d01019e76edcd4be444deed6c..2da8ebdc3bfa2978521c93b032ac3d45bf998336 100644 (file)
@@ -117,7 +117,7 @@ var (
 )
 
 func (l *pageLexer) next() rune {
-       if int(l.pos) >= len(l.input) {
+       if l.pos >= len(l.input) {
                l.width = 0
                return eof
        }
index 59f2da91671fe80ab335a9d1635702ce421cbd86..e82ee1a4f9320cf801f8aba2f1bfaf288d346db7 100644 (file)
@@ -188,7 +188,7 @@ type permalinkExpandError struct {
 }
 
 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 (
index c9b78ea9ac0b7f205a04769e2e4ad8472646f8a1..f2b4a426a61da319f04de27a5689ce89d7246ec1 100644 (file)
@@ -93,7 +93,7 @@ func TestNSConfig(t *testing.T) {
 
                // 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
                }