all: Apply staticcheck recommendations

This commit is contained in:
Bjørn Erik Pedersen
2019-03-24 10:11:16 +01:00
parent 3011f36c27
commit b5f39d23b8
41 changed files with 98 additions and 252 deletions

View File

@@ -22,7 +22,7 @@ import (
"github.com/BurntSushi/toml"
"gopkg.in/yaml.v2"
yaml "gopkg.in/yaml.v2"
)
const (
@@ -62,7 +62,7 @@ func InterfaceToConfig(in interface{}, format metadecoders.Format, w io.Writer)
return err
default:
return errors.New("Unsupported Format provided")
return errors.New("unsupported Format provided")
}
}

View File

@@ -442,13 +442,6 @@ func lexMainSection(l *pageLexer) stateFunc {
}
func (l *pageLexer) posFirstNonWhiteSpace() int {
f := func(c rune) bool {
return !unicode.IsSpace(c)
}
return bytes.IndexFunc(l.input[l.pos:], f)
}
func lexDone(l *pageLexer) stateFunc {
// Done!
@@ -477,14 +470,6 @@ func (l *pageLexer) hasPrefix(prefix []byte) bool {
return bytes.HasPrefix(l.input[l.pos:], prefix)
}
func (l *pageLexer) hasPrefixByte(prefix byte) bool {
b := l.input[l.pos:]
if len(b) == 0 {
return false
}
return b[0] == prefix
}
// helper functions
// returns the min index >= 0